1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .TH SINCOS 3 2021-03-22 "GNU" "Linux Programmer's Manual"
9 sincos, sincosf, sincosl \- calculate sin and cos simultaneously
12 .RI ( libm ", " \-lm )
15 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
18 .BI "void sincos(double " x ", double *" sin ", double *" cos );
19 .BI "void sincosf(float " x ", float *" sin ", float *" cos );
20 .BI "void sincosl(long double " x ", long double *" sin ", long double *" cos );
23 Several applications need sine and cosine of the same angle
25 These functions compute both at the same time, and store the results in
29 Using this function can be more efficient than two separate calls to
44 is positive infinity or negative infinity,
45 a domain error occurs, and
51 These functions return
56 for information on how to determine whether an error has occurred
57 when calling these functions.
59 The following errors can occur:
61 Domain error: \fIx\fP is an infinity
66 An invalid floating-point exception
70 These functions first appeared in glibc in version 2.1.
72 For an explanation of the terms used in this section, see
80 Interface Attribute Value
85 T} Thread safety MT-Safe
91 These functions are GNU extensions.
93 To see the performance advantage of
95 it may be necessary to disable
97 built-in optimizations, using flags such as:
101 cc \-O \-lm \-fno\-builtin prog.c
105 Before version 2.22, the glibc implementation did not set
106 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467
110 when a domain error occurred.