1SINCOS(3)                  Linux Programmer's Manual                 SINCOS(3)
2
3
4

NAME

6       sincos, sincosf, sincosl - calculate sin and cos simultaneously
7

SYNOPSIS

9       #define _GNU_SOURCE         /* See feature_test_macros(7) */
10       #include <math.h>
11
12       void sincos(double x, double *sin, double *cos);
13       void sincosf(float x, float *sin, float *cos);
14       void sincosl(long double x, long double *sin, long double *cos);
15
16       Link with -lm.
17

DESCRIPTION

19       Several  applications  need sine and cosine of the same angle x.  These
20       functions compute both at the same time, and store the results in  *sin
21       and  *cos.  Using this function can be more efficient than two separate
22       calls to sin(3) and cos(3).
23
24       If x is a NaN, a NaN is returned in *sin and *cos.
25
26       If x is positive infinity or negative infinity, a domain error  occurs,
27       and a NaN is returned in *sin and *cos.
28

RETURN VALUE

30       These functions return void.
31

ERRORS

33       See  math_error(7) for information on how to determine whether an error
34       has occurred when calling these functions.
35
36       The following errors can occur:
37
38       Domain error: x is an infinity
39              errno is set to EDOM (but see BUGS).  An invalid  floating-point
40              exception (FE_INVALID) is raised.
41

VERSIONS

43       These functions first appeared in glibc in version 2.1.
44

ATTRIBUTES

46       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
47       tributes(7).
48
49       ┌───────────────────────────────┬───────────────┬─────────┐
50Interface                      Attribute     Value   
51       ├───────────────────────────────┼───────────────┼─────────┤
52sincos(), sincosf(), sincosl() │ Thread safety │ MT-Safe │
53       └───────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

55       These functions are GNU extensions.
56

NOTES

58       To see the performance advantage of sincos(), it may  be  necessary  to
59       disable gcc(1) built-in optimizations, using flags such as:
60
61           cc -O -lm -fno-builtin prog.c
62

BUGS

64       Before version 2.22, the glibc implementation did not set errno to EDOM
65       when a domain error occurred.
66

SEE ALSO

68       cos(3), sin(3), tan(3)
69

COLOPHON

71       This page is part of release 5.10 of the Linux  man-pages  project.   A
72       description  of  the project, information about reporting bugs, and the
73       latest    version    of    this    page,    can     be     found     at
74       https://www.kernel.org/doc/man-pages/.
75
76
77
78GNU                               2020-06-09                         SINCOS(3)
Impressum