]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) |
66ace94e MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
2297bf0e | 4 | .\" |
95fb8859 | 5 | .\" SPDX-License-Identifier: GPL-1.0-or-later |
fea681da | 6 | .\" |
ab47278f | 7 | .TH SINCOS 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
8 | .SH NAME |
9 | sincos, sincosf, sincosl \- calculate sin and cos simultaneously | |
e7c16cba AC |
10 | .SH LIBRARY |
11 | Math library | |
8fc3b2cf | 12 | .RI ( libm ", " \-lm ) |
fea681da MK |
13 | .SH SYNOPSIS |
14 | .nf | |
b80f966b | 15 | .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
fea681da | 16 | .B #include <math.h> |
68e4db0a | 17 | .PP |
fea681da | 18 | .BI "void sincos(double " x ", double *" sin ", double *" cos ); |
fea681da | 19 | .BI "void sincosf(float " x ", float *" sin ", float *" cos ); |
fea681da MK |
20 | .BI "void sincosl(long double " x ", long double *" sin ", long double *" cos ); |
21 | .fi | |
fea681da MK |
22 | .SH DESCRIPTION |
23 | Several applications need sine and cosine of the same angle | |
24 | .IR x . | |
674546ef | 25 | These functions compute both at the same time, and store the results in |
48dabc90 MK |
26 | .I *sin |
27 | and | |
28 | .IR *cos . | |
268bac1f MK |
29 | Using this function can be more efficient than two separate calls to |
30 | .BR sin (3) | |
31 | and | |
32 | .BR cos (3). | |
847e0d88 | 33 | .PP |
48dabc90 MK |
34 | If |
35 | .I x | |
36 | is a NaN, | |
37 | a NaN is returned in | |
38 | .I *sin | |
39 | and | |
40 | .IR *cos . | |
847e0d88 | 41 | .PP |
48dabc90 MK |
42 | If |
43 | .I x | |
44 | is positive infinity or negative infinity, | |
efe294cb | 45 | a domain error occurs, and |
48dabc90 MK |
46 | a NaN is returned in |
47 | .I *sin | |
48 | and | |
49 | .IR *cos . | |
50 | .SH RETURN VALUE | |
51 | These functions return | |
52 | .IR void . | |
53 | .SH ERRORS | |
54 | See | |
55 | .BR math_error (7) | |
56 | for information on how to determine whether an error has occurred | |
57 | when calling these functions. | |
58 | .PP | |
59 | The following errors can occur: | |
60 | .TP | |
61 | Domain error: \fIx\fP is an infinity | |
053d061a MK |
62 | .I errno |
63 | is set to | |
1ae6b2c7 | 64 | .B EDOM |
053d061a | 65 | (but see BUGS). |
48dabc90 MK |
66 | An invalid floating-point exception |
67 | .RB ( FE_INVALID ) | |
68 | is raised. | |
f0d7ce1d MK |
69 | .SH VERSIONS |
70 | These functions first appeared in glibc in version 2.1. | |
4d468698 | 71 | .SH ATTRIBUTES |
d7ffc1d2 PH |
72 | For an explanation of the terms used in this section, see |
73 | .BR attributes (7). | |
c466875e MK |
74 | .ad l |
75 | .nh | |
d7ffc1d2 PH |
76 | .TS |
77 | allbox; | |
c466875e | 78 | lbx lb lb |
d7ffc1d2 PH |
79 | l l l. |
80 | Interface Attribute Value | |
81 | T{ | |
4d468698 PH |
82 | .BR sincos (), |
83 | .BR sincosf (), | |
4d468698 | 84 | .BR sincosl () |
d7ffc1d2 PH |
85 | T} Thread safety MT-Safe |
86 | .TE | |
c466875e MK |
87 | .hy |
88 | .ad | |
89 | .sp 1 | |
3113c7f3 | 90 | .SH STANDARDS |
674546ef | 91 | These functions are GNU extensions. |
268bac1f MK |
92 | .SH NOTES |
93 | To see the performance advantage of | |
94 | .BR sincos (), | |
95 | it may be necessary to disable | |
96 | .BR gcc (1) | |
ebd10b39 | 97 | built-in optimizations, using flags such as: |
268bac1f MK |
98 | .PP |
99 | .in +4n | |
100 | .EX | |
86d93b3e | 101 | cc \-O \-lm \-fno\-builtin prog.c |
268bac1f MK |
102 | .EE |
103 | .in | |
053d061a MK |
104 | .SH BUGS |
105 | Before version 2.22, the glibc implementation did not set | |
106 | .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467 | |
107 | .I errno | |
108 | to | |
109 | .B EDOM | |
110 | when a domain error occurred. | |
47297adb | 111 | .SH SEE ALSO |
fea681da MK |
112 | .BR cos (3), |
113 | .BR sin (3), | |
0a4f8b7b | 114 | .BR tan (3) |