]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
f71288ac MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
6 | .\" |
7 | .\" References consulted: | |
8 | .\" Linux libc source code | |
9 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
10 | .\" 386BSD man pages | |
11 | .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu) | |
12 | .\" Modified 2002-07-27 by Walter Harms | |
13 | .\" (walter.harms@informatik.uni-oldenburg.de) | |
14 | .\" | |
1ae6b2c7 | 15 | .TH ATAN2 3 2021-03-22 GNU "Linux Programmer's Manual" |
fea681da MK |
16 | .SH NAME |
17 | atan2, atan2f, atan2l \- arc tangent function of two variables | |
2af19291 AC |
18 | .SH LIBRARY |
19 | Math library | |
8fc3b2cf | 20 | .RI ( libm ", " \-lm ) |
fea681da MK |
21 | .SH SYNOPSIS |
22 | .nf | |
23 | .B #include <math.h> | |
dbfe9c70 | 24 | .PP |
fea681da | 25 | .BI "double atan2(double " y ", double " x ); |
fea681da | 26 | .BI "float atan2f(float " y ", float " x ); |
fea681da | 27 | .BI "long double atan2l(long double " y ", long double " x ); |
fea681da | 28 | .fi |
dbfe9c70 | 29 | .PP |
d39ad78f | 30 | .RS -4 |
f71288ac MK |
31 | Feature Test Macro Requirements for glibc (see |
32 | .BR feature_test_macros (7)): | |
d39ad78f | 33 | .RE |
68e4db0a | 34 | .PP |
f71288ac MK |
35 | .BR atan2f (), |
36 | .BR atan2l (): | |
9d2adbae | 37 | .nf |
5c10d2c5 | 38 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
39 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
40 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
41 | .fi | |
fea681da | 42 | .SH DESCRIPTION |
5600f73a | 43 | These functions calculate the principal value of the arc tangent of |
f71288ac MK |
44 | .IR y/x , |
45 | using the signs of the two arguments to determine | |
46 | the quadrant of the result. | |
47297adb | 47 | .SH RETURN VALUE |
f71288ac | 48 | On success, these functions return the principal value of the arc tangent of |
1ae6b2c7 | 49 | .I y/x |
d62d92dc | 50 | in radians; the return value is in the range [\-pi,\ pi]. |
847e0d88 | 51 | .PP |
f71288ac MK |
52 | If |
53 | .I y | |
54 | is +0 (\-0) and | |
55 | .I x | |
56 | is less than 0, +pi (\-pi) is returned. | |
847e0d88 | 57 | .PP |
f71288ac MK |
58 | If |
59 | .I y | |
60 | is +0 (\-0) and | |
61 | .I x | |
62 | is greater than 0, +0 (\-0) is returned. | |
847e0d88 | 63 | .PP |
f71288ac MK |
64 | If |
65 | .I y | |
66 | is less than 0 and | |
67 | .I x | |
68 | is +0 or \-0, \-pi/2 is returned. | |
847e0d88 | 69 | .PP |
f71288ac MK |
70 | If |
71 | .I y | |
72 | is greater than 0 and | |
73 | .I x | |
74 | is +0 or \-0, pi/2 is returned. | |
847e0d88 | 75 | .PP |
f71288ac MK |
76 | .\" POSIX.1 says: |
77 | .\" If | |
78 | .\" .I x | |
79 | .\" is 0, a pole error shall not occur. | |
80 | .\" | |
81 | If either | |
82 | .I x | |
83 | or | |
84 | .I y | |
85 | is NaN, a NaN is returned. | |
847e0d88 | 86 | .PP |
f71288ac | 87 | .\" POSIX.1 says: |
4e836144 | 88 | .\" If the result underflows, a range error may occur and |
f71288ac MK |
89 | .\" .I y/x |
90 | .\" should be returned. | |
91 | .\" | |
92 | If | |
93 | .I y | |
94 | is +0 (\-0) and | |
95 | .I x | |
96 | is \-0, +pi (\-pi) is returned. | |
847e0d88 | 97 | .PP |
f71288ac MK |
98 | If |
99 | .I y | |
100 | is +0 (\-0) and | |
101 | .I x | |
102 | is +0, +0 (\-0) is returned. | |
847e0d88 | 103 | .PP |
f71288ac MK |
104 | If |
105 | .I y | |
106 | is a finite value greater (less) than 0, and | |
107 | .I x | |
108 | is negative infinity, +pi (\-pi) is returned. | |
847e0d88 | 109 | .PP |
f71288ac MK |
110 | If |
111 | .I y | |
112 | is a finite value greater (less) than 0, and | |
113 | .I x | |
114 | is positive infinity, +0 (\-0) is returned. | |
847e0d88 | 115 | .PP |
f71288ac MK |
116 | If |
117 | .I y | |
118 | is positive infinity (negative infinity), and | |
119 | .I x | |
120 | is finite, | |
121 | pi/2 (\-pi/2) is returned. | |
847e0d88 | 122 | .PP |
f71288ac MK |
123 | If |
124 | .I y | |
125 | is positive infinity (negative infinity) and | |
126 | .I x | |
c3074d70 | 127 | is negative infinity, +3*pi/4 (\-3*pi/4) is returned. |
847e0d88 | 128 | .PP |
f71288ac MK |
129 | If |
130 | .I y | |
131 | is positive infinity (negative infinity) and | |
132 | .I x | |
c3074d70 | 133 | is positive infinity, +pi/4 (\-pi/4) is returned. |
f71288ac MK |
134 | .\" |
135 | .\" POSIX.1 says: | |
136 | .\" If both arguments are 0, a domain error shall not occur. | |
137 | .SH ERRORS | |
138 | No errors occur. | |
139 | .\" POSIX.1 documents an optional underflow error | |
140 | .\" glibc 2.8 does not do this. | |
54e5aeaa MS |
141 | .SH ATTRIBUTES |
142 | For an explanation of the terms used in this section, see | |
143 | .BR attributes (7). | |
c466875e MK |
144 | .ad l |
145 | .nh | |
54e5aeaa MS |
146 | .TS |
147 | allbox; | |
c466875e | 148 | lbx lb lb |
54e5aeaa MS |
149 | l l l. |
150 | Interface Attribute Value | |
151 | T{ | |
152 | .BR atan2 (), | |
153 | .BR atan2f (), | |
154 | .BR atan2l () | |
155 | T} Thread safety MT-Safe | |
156 | .TE | |
c466875e MK |
157 | .hy |
158 | .ad | |
159 | .sp 1 | |
47297adb | 160 | .SH CONFORMING TO |
9a74e018 | 161 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 162 | .PP |
f71288ac MK |
163 | The variant returning |
164 | .I double | |
165 | also conforms to | |
f71288ac | 166 | SVr4, 4.3BSD, C89. |
47297adb | 167 | .SH SEE ALSO |
fea681da MK |
168 | .BR acos (3), |
169 | .BR asin (3), | |
170 | .BR atan (3), | |
a1759255 | 171 | .BR carg (3), |
fea681da MK |
172 | .BR cos (3), |
173 | .BR sin (3), | |
174 | .BR tan (3) |