]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sincos.3
fuse.4: ffix
[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.\"
38f20bb9
MK
5.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6.\" Distributed under GPL
7.\" %%%LICENSE_END
fea681da 8.\"
4b8c67d9 9.TH SINCOS 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da
MK
10.SH NAME
11sincos, sincosf, sincosl \- calculate sin and cos simultaneously
12.SH SYNOPSIS
13.nf
b80f966b 14.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da 15.B #include <math.h>
68e4db0a 16.PP
fea681da 17.BI "void sincos(double " x ", double *" sin ", double *" cos );
fea681da 18.BI "void sincosf(float " x ", float *" sin ", float *" cos );
fea681da
MK
19.BI "void sincosl(long double " x ", long double *" sin ", long double *" cos );
20.fi
68e4db0a 21.PP
20c58d70 22Link with \fI\-lm\fP.
fea681da
MK
23.SH DESCRIPTION
24Several applications need sine and cosine of the same angle
25.IR x .
674546ef 26These functions compute both at the same time, and store the results in
48dabc90
MK
27.I *sin
28and
29.IR *cos .
268bac1f
MK
30Using this function can be more efficient than two separate calls to
31.BR sin (3)
32and
33.BR cos (3).
847e0d88 34.PP
48dabc90
MK
35If
36.I x
37is a NaN,
38a NaN is returned in
39.I *sin
40and
41.IR *cos .
847e0d88 42.PP
48dabc90
MK
43If
44.I x
45is positive infinity or negative infinity,
efe294cb 46a domain error occurs, and
48dabc90
MK
47a NaN is returned in
48.I *sin
49and
50.IR *cos .
51.SH RETURN VALUE
52These functions return
53.IR void .
54.SH ERRORS
55See
56.BR math_error (7)
57for information on how to determine whether an error has occurred
58when calling these functions.
59.PP
60The following errors can occur:
61.TP
62Domain error: \fIx\fP is an infinity
63.\" .I errno
64.\" is set to
65.\" .BR EDOM .
66An invalid floating-point exception
67.RB ( FE_INVALID )
68is raised.
69.PP
70These functions do not set
71.IR errno .
72.\" FIXME . Is it intentional that these functions do not set errno?
73.\" sin() and cos() also don't set errno; bugs have been raised for
74.\" those functions.
a699d2f2 75.\" See https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467
f0d7ce1d
MK
76.SH VERSIONS
77These functions first appeared in glibc in version 2.1.
4d468698 78.SH ATTRIBUTES
d7ffc1d2
PH
79For an explanation of the terms used in this section, see
80.BR attributes (7).
81.TS
82allbox;
83lbw30 lb lb
84l l l.
85Interface Attribute Value
86T{
4d468698
PH
87.BR sincos (),
88.BR sincosf (),
4d468698 89.BR sincosl ()
d7ffc1d2
PH
90T} Thread safety MT-Safe
91.TE
47297adb 92.SH CONFORMING TO
674546ef 93These functions are GNU extensions.
268bac1f
MK
94.SH NOTES
95To see the performance advantage of
96.BR sincos (),
97it may be necessary to disable
98.BR gcc (1)
ebd10b39 99built-in optimizations, using flags such as:
268bac1f
MK
100.PP
101.in +4n
102.EX
103cc -O \-lm \-fno\-builtin prog.c
104.EE
105.in
47297adb 106.SH SEE ALSO
fea681da
MK
107.BR cos (3),
108.BR sin (3),
0a4f8b7b 109.BR tan (3)