]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man3/sincos.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / sincos.3
... / ...
CommitLineData
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>
4.\"
5.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6.\" Distributed under GPL
7.\" %%%LICENSE_END
8.\"
9.TH SINCOS 3 2017-09-15 "GNU" "Linux Programmer's Manual"
10.SH NAME
11sincos, sincosf, sincosl \- calculate sin and cos simultaneously
12.SH SYNOPSIS
13.nf
14.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
15.B #include <math.h>
16.PP
17.BI "void sincos(double " x ", double *" sin ", double *" cos );
18.BI "void sincosf(float " x ", float *" sin ", float *" cos );
19.BI "void sincosl(long double " x ", long double *" sin ", long double *" cos );
20.fi
21.PP
22Link with \fI\-lm\fP.
23.SH DESCRIPTION
24Several applications need sine and cosine of the same angle
25.IR x .
26These functions compute both at the same time, and store the results in
27.I *sin
28and
29.IR *cos .
30Using this function can be more efficient than two separate calls to
31.BR sin (3)
32and
33.BR cos (3).
34.PP
35If
36.I x
37is a NaN,
38a NaN is returned in
39.I *sin
40and
41.IR *cos .
42.PP
43If
44.I x
45is positive infinity or negative infinity,
46a domain error occurs, and
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
64is set to
65.BR EDOM
66(but see BUGS).
67An invalid floating-point exception
68.RB ( FE_INVALID )
69is raised.
70.SH VERSIONS
71These functions first appeared in glibc in version 2.1.
72.SH ATTRIBUTES
73For an explanation of the terms used in this section, see
74.BR attributes (7).
75.TS
76allbox;
77lbw30 lb lb
78l l l.
79Interface Attribute Value
80T{
81.BR sincos (),
82.BR sincosf (),
83.BR sincosl ()
84T} Thread safety MT-Safe
85.TE
86.SH CONFORMING TO
87These functions are GNU extensions.
88.SH NOTES
89To see the performance advantage of
90.BR sincos (),
91it may be necessary to disable
92.BR gcc (1)
93built-in optimizations, using flags such as:
94.PP
95.in +4n
96.EX
97cc -O \-lm \-fno\-builtin prog.c
98.EE
99.in
100.SH BUGS
101Before version 2.22, the glibc implementation did not set
102.\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467
103.I errno
104to
105.B EDOM
106when a domain error occurred.
107.SH SEE ALSO
108.BR cos (3),
109.BR sin (3),
110.BR tan (3)