]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/atan2.3
8ecd5f656e08cd4d393445691e39475c1296acdf
[thirdparty/man-pages.git] / man3 / atan2.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" References consulted:
28 .\" Linux libc source code
29 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
30 .\" 386BSD man pages
31 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
32 .\" Modified 2002-07-27 by Walter Harms
33 .\" (walter.harms@informatik.uni-oldenburg.de)
34 .\"
35 .TH ATAN2 3 2015-03-02 "" "Linux Programmer's Manual"
36 .SH NAME
37 atan2, atan2f, atan2l \- arc tangent function of two variables
38 .SH SYNOPSIS
39 .nf
40 .B #include <math.h>
41
42 .BI "double atan2(double " y ", double " x );
43 .BI "float atan2f(float " y ", float " x );
44 .BI "long double atan2l(long double " y ", long double " x );
45
46 .fi
47 Link with \fI\-lm\fP.
48 .sp
49 .in -4n
50 Feature Test Macro Requirements for glibc (see
51 .BR feature_test_macros (7)):
52 .in
53 .sp
54 .ad l
55 .BR atan2f (),
56 .BR atan2l ():
57 .RS
58 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
59 _POSIX_C_SOURCE\ >=\ 200112L;
60 .br
61 or
62 .I cc\ -std=c99
63 .RE
64 .ad b
65 .SH DESCRIPTION
66 These functions calculate the principal value of the arc tangent of
67 .IR y/x ,
68 using the signs of the two arguments to determine
69 the quadrant of the result.
70 .SH RETURN VALUE
71 On success, these functions return the principal value of the arc tangent of
72 .IR y/x
73 in radians; the return value is in the range [\-pi,\ pi].
74
75 If
76 .I y
77 is +0 (\-0) and
78 .I x
79 is less than 0, +pi (\-pi) is returned.
80
81 If
82 .I y
83 is +0 (\-0) and
84 .I x
85 is greater than 0, +0 (\-0) is returned.
86
87 If
88 .I y
89 is less than 0 and
90 .I x
91 is +0 or \-0, \-pi/2 is returned.
92
93 If
94 .I y
95 is greater than 0 and
96 .I x
97 is +0 or \-0, pi/2 is returned.
98
99 .\" POSIX.1 says:
100 .\" If
101 .\" .I x
102 .\" is 0, a pole error shall not occur.
103 .\"
104 If either
105 .I x
106 or
107 .I y
108 is NaN, a NaN is returned.
109
110 .\" POSIX.1 says:
111 .\" If the result underflows, a range error may occur and
112 .\" .I y/x
113 .\" should be returned.
114 .\"
115 If
116 .I y
117 is +0 (\-0) and
118 .I x
119 is \-0, +pi (\-pi) is returned.
120
121 If
122 .I y
123 is +0 (\-0) and
124 .I x
125 is +0, +0 (\-0) is returned.
126
127 If
128 .I y
129 is a finite value greater (less) than 0, and
130 .I x
131 is negative infinity, +pi (\-pi) is returned.
132
133 If
134 .I y
135 is a finite value greater (less) than 0, and
136 .I x
137 is positive infinity, +0 (\-0) is returned.
138
139 If
140 .I y
141 is positive infinity (negative infinity), and
142 .I x
143 is finite,
144 pi/2 (\-pi/2) is returned.
145
146 If
147 .I y
148 is positive infinity (negative infinity) and
149 .I x
150 is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
151
152 If
153 .I y
154 is positive infinity (negative infinity) and
155 .I x
156 is positive infinity, +pi/4 (\-pi/4) is returned.
157 .\"
158 .\" POSIX.1 says:
159 .\" If both arguments are 0, a domain error shall not occur.
160 .SH ERRORS
161 No errors occur.
162 .\" POSIX.1 documents an optional underflow error
163 .\" glibc 2.8 does not do this.
164 .SH ATTRIBUTES
165 For an explanation of the terms used in this section, see
166 .BR attributes (7).
167 .TS
168 allbox;
169 lbw28 lb lb
170 l l l.
171 Interface Attribute Value
172 T{
173 .BR atan2 (),
174 .BR atan2f (),
175 .BR atan2l ()
176 T} Thread safety MT-Safe
177 .TE
178 .SH CONFORMING TO
179 C99, POSIX.1-2001, POSIX.1-2008.
180
181 The variant returning
182 .I double
183 also conforms to
184 SVr4, 4.3BSD, C89.
185 .SH SEE ALSO
186 .BR acos (3),
187 .BR asin (3),
188 .BR atan (3),
189 .BR carg (3),
190 .BR cos (3),
191 .BR sin (3),
192 .BR tan (3)