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       └────────────────────────────────────────────┴───────────────┴─────────┘
54

CONFORMING TO

56       These functions are GNU extensions.
57

NOTES

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

BUGS

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

SEE ALSO

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

COLOPHON

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