Debian Codegraph @

upstream/debian-trixie/man3/sincos.3

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