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              An invalid floating-point exception (FE_INVALID) is raised.
40
41       These functions do not set errno.
42

VERSIONS

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

ATTRIBUTES

47       For  an  explanation  of  the  terms  used   in   this   section,   see
48       attributes(7).
49
50       ┌───────────────────────────────┬───────────────┬─────────┐
51Interface                      Attribute     Value   
52       ├───────────────────────────────┼───────────────┼─────────┤
53sincos(), sincosf(), sincosl() │ Thread safety │ MT-Safe │
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

SEE ALSO

65       cos(3), sin(3), tan(3)
66

COLOPHON

68       This page is part of release 5.02 of the Linux  man-pages  project.   A
69       description  of  the project, information about reporting bugs, and the
70       latest    version    of    this    page,    can     be     found     at
71       https://www.kernel.org/doc/man-pages/.
72
73
74
75GNU                               2017-09-15                         SINCOS(3)
Impressum