]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sincos.3
Many pages: LIBRARY: srcfix
[thirdparty/man-pages.git] / man3 / sincos.3
CommitLineData
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.\"
1d767b55 7.TH SINCOS 3 2021-03-22 "GNU" "Linux Programmer's Manual"
fea681da
MK
8.SH NAME
9sincos, sincosf, sincosl \- calculate sin and cos simultaneously
e7c16cba
AC
10.SH LIBRARY
11Math 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
23Several applications need sine and cosine of the same angle
24.IR x .
674546ef 25These functions compute both at the same time, and store the results in
48dabc90
MK
26.I *sin
27and
28.IR *cos .
268bac1f
MK
29Using this function can be more efficient than two separate calls to
30.BR sin (3)
31and
32.BR cos (3).
847e0d88 33.PP
48dabc90
MK
34If
35.I x
36is a NaN,
37a NaN is returned in
38.I *sin
39and
40.IR *cos .
847e0d88 41.PP
48dabc90
MK
42If
43.I x
44is positive infinity or negative infinity,
efe294cb 45a domain error occurs, and
48dabc90
MK
46a NaN is returned in
47.I *sin
48and
49.IR *cos .
50.SH RETURN VALUE
51These functions return
52.IR void .
53.SH ERRORS
54See
55.BR math_error (7)
56for information on how to determine whether an error has occurred
57when calling these functions.
58.PP
59The following errors can occur:
60.TP
61Domain error: \fIx\fP is an infinity
053d061a
MK
62.I errno
63is set to
64.BR EDOM
65(but see BUGS).
48dabc90
MK
66An invalid floating-point exception
67.RB ( FE_INVALID )
68is raised.
f0d7ce1d
MK
69.SH VERSIONS
70These functions first appeared in glibc in version 2.1.
4d468698 71.SH ATTRIBUTES
d7ffc1d2
PH
72For 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
77allbox;
c466875e 78lbx lb lb
d7ffc1d2
PH
79l l l.
80Interface Attribute Value
81T{
4d468698
PH
82.BR sincos (),
83.BR sincosf (),
4d468698 84.BR sincosl ()
d7ffc1d2
PH
85T} Thread safety MT-Safe
86.TE
c466875e
MK
87.hy
88.ad
89.sp 1
47297adb 90.SH CONFORMING TO
674546ef 91These functions are GNU extensions.
268bac1f
MK
92.SH NOTES
93To see the performance advantage of
94.BR sincos (),
95it may be necessary to disable
96.BR gcc (1)
ebd10b39 97built-in optimizations, using flags such as:
268bac1f
MK
98.PP
99.in +4n
100.EX
86d93b3e 101cc \-O \-lm \-fno\-builtin prog.c
268bac1f
MK
102.EE
103.in
053d061a
MK
104.SH BUGS
105Before version 2.22, the glibc implementation did not set
106.\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467
107.I errno
108to
109.B EDOM
110when a domain error occurred.
47297adb 111.SH SEE ALSO
fea681da
MK
112.BR cos (3),
113.BR sin (3),
0a4f8b7b 114.BR tan (3)