]>
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 | .\" |
93015253 | 5 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 14 | .\" |
fea681da MK |
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. | |
c13182ef | 22 | .\" |
fea681da MK |
23 | .\" Formatted or processed versions of this manual, if unaccompanied by |
24 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 25 | .\" %%%LICENSE_END |
fea681da MK |
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 | .\" | |
4b8c67d9 | 35 | .TH ATAN2 3 2017-09-15 "" "Linux Programmer's Manual" |
fea681da MK |
36 | .SH NAME |
37 | atan2, atan2f, atan2l \- arc tangent function of two variables | |
38 | .SH SYNOPSIS | |
39 | .nf | |
40 | .B #include <math.h> | |
dbfe9c70 | 41 | .PP |
fea681da | 42 | .BI "double atan2(double " y ", double " x ); |
fea681da | 43 | .BI "float atan2f(float " y ", float " x ); |
fea681da | 44 | .BI "long double atan2l(long double " y ", long double " x ); |
fea681da | 45 | .fi |
dbfe9c70 | 46 | .PP |
20c58d70 | 47 | Link with \fI\-lm\fP. |
68e4db0a | 48 | .PP |
f71288ac MK |
49 | .in -4n |
50 | Feature Test Macro Requirements for glibc (see | |
51 | .BR feature_test_macros (7)): | |
52 | .in | |
68e4db0a | 53 | .PP |
f71288ac MK |
54 | .ad l |
55 | .BR atan2f (), | |
56 | .BR atan2l (): | |
fd39aa34 | 57 | .RS |
e9d91bcf MK |
58 | _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L |
59 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE | |
60 | || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
fd39aa34 | 61 | .RE |
f71288ac | 62 | .ad b |
fea681da | 63 | .SH DESCRIPTION |
5600f73a | 64 | These functions calculate the principal value of the arc tangent of |
f71288ac MK |
65 | .IR y/x , |
66 | using the signs of the two arguments to determine | |
67 | the quadrant of the result. | |
47297adb | 68 | .SH RETURN VALUE |
f71288ac MK |
69 | On success, these functions return the principal value of the arc tangent of |
70 | .IR y/x | |
d62d92dc | 71 | in radians; the return value is in the range [\-pi,\ pi]. |
847e0d88 | 72 | .PP |
f71288ac MK |
73 | If |
74 | .I y | |
75 | is +0 (\-0) and | |
76 | .I x | |
77 | is less than 0, +pi (\-pi) is returned. | |
847e0d88 | 78 | .PP |
f71288ac MK |
79 | If |
80 | .I y | |
81 | is +0 (\-0) and | |
82 | .I x | |
83 | is greater than 0, +0 (\-0) is returned. | |
847e0d88 | 84 | .PP |
f71288ac MK |
85 | If |
86 | .I y | |
87 | is less than 0 and | |
88 | .I x | |
89 | is +0 or \-0, \-pi/2 is returned. | |
847e0d88 | 90 | .PP |
f71288ac MK |
91 | If |
92 | .I y | |
93 | is greater than 0 and | |
94 | .I x | |
95 | is +0 or \-0, pi/2 is returned. | |
847e0d88 | 96 | .PP |
f71288ac MK |
97 | .\" POSIX.1 says: |
98 | .\" If | |
99 | .\" .I x | |
100 | .\" is 0, a pole error shall not occur. | |
101 | .\" | |
102 | If either | |
103 | .I x | |
104 | or | |
105 | .I y | |
106 | is NaN, a NaN is returned. | |
847e0d88 | 107 | .PP |
f71288ac | 108 | .\" POSIX.1 says: |
4e836144 | 109 | .\" If the result underflows, a range error may occur and |
f71288ac MK |
110 | .\" .I y/x |
111 | .\" should be returned. | |
112 | .\" | |
113 | If | |
114 | .I y | |
115 | is +0 (\-0) and | |
116 | .I x | |
117 | is \-0, +pi (\-pi) is returned. | |
847e0d88 | 118 | .PP |
f71288ac MK |
119 | If |
120 | .I y | |
121 | is +0 (\-0) and | |
122 | .I x | |
123 | is +0, +0 (\-0) is returned. | |
847e0d88 | 124 | .PP |
f71288ac MK |
125 | If |
126 | .I y | |
127 | is a finite value greater (less) than 0, and | |
128 | .I x | |
129 | is negative infinity, +pi (\-pi) is returned. | |
847e0d88 | 130 | .PP |
f71288ac MK |
131 | If |
132 | .I y | |
133 | is a finite value greater (less) than 0, and | |
134 | .I x | |
135 | is positive infinity, +0 (\-0) is returned. | |
847e0d88 | 136 | .PP |
f71288ac MK |
137 | If |
138 | .I y | |
139 | is positive infinity (negative infinity), and | |
140 | .I x | |
141 | is finite, | |
142 | pi/2 (\-pi/2) is returned. | |
847e0d88 | 143 | .PP |
f71288ac MK |
144 | If |
145 | .I y | |
146 | is positive infinity (negative infinity) and | |
147 | .I x | |
c3074d70 | 148 | is negative infinity, +3*pi/4 (\-3*pi/4) is returned. |
847e0d88 | 149 | .PP |
f71288ac MK |
150 | If |
151 | .I y | |
152 | is positive infinity (negative infinity) and | |
153 | .I x | |
c3074d70 | 154 | is positive infinity, +pi/4 (\-pi/4) is returned. |
f71288ac MK |
155 | .\" |
156 | .\" POSIX.1 says: | |
157 | .\" If both arguments are 0, a domain error shall not occur. | |
158 | .SH ERRORS | |
159 | No errors occur. | |
160 | .\" POSIX.1 documents an optional underflow error | |
161 | .\" glibc 2.8 does not do this. | |
54e5aeaa MS |
162 | .SH ATTRIBUTES |
163 | For an explanation of the terms used in this section, see | |
164 | .BR attributes (7). | |
165 | .TS | |
166 | allbox; | |
167 | lbw28 lb lb | |
168 | l l l. | |
169 | Interface Attribute Value | |
170 | T{ | |
171 | .BR atan2 (), | |
172 | .BR atan2f (), | |
173 | .BR atan2l () | |
174 | T} Thread safety MT-Safe | |
175 | .TE | |
47297adb | 176 | .SH CONFORMING TO |
9a74e018 | 177 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 178 | .PP |
f71288ac MK |
179 | The variant returning |
180 | .I double | |
181 | also conforms to | |
f71288ac | 182 | SVr4, 4.3BSD, C89. |
47297adb | 183 | .SH SEE ALSO |
fea681da MK |
184 | .BR acos (3), |
185 | .BR asin (3), | |
186 | .BR atan (3), | |
a1759255 | 187 | .BR carg (3), |
fea681da MK |
188 | .BR cos (3), |
189 | .BR sin (3), | |
190 | .BR tan (3) |