1ATAN2(3) Linux Programmer's Manual ATAN2(3)
2
3
4
6 atan2, atan2f, atan2l - arc tangent function of two variables
7
9 #include <math.h>
10
11 double atan2(double y, double x);
12 float atan2f(float y, float x);
13 long double atan2l(long double y, long double x);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 atan2f(), atan2l():
20 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22 or cc -std=c99
23
25 The atan2() function calculates the principal value of the arc tangent
26 of y/x, using the signs of the two arguments to determine the quadrant
27 of the result.
28
30 On success, these functions return the principal value of the arc tan‐
31 gent of y/x in radians; the return value is in the range [-pi, pi].
32
33 If y is +0 (-0) and x is less than 0, +pi (-pi) is returned.
34
35 If y is +0 (-0) and x is greater than 0, +0 (-0) is returned.
36
37 If y is less than 0 and x is +0 or -0, -pi/2 is returned.
38
39 If y is greater than 0 and x is +0 or -0, pi/2 is returned.
40
41 If either x or y is NaN, a NaN is returned.
42
43 If y is +0 (-0) and x is -0, +pi (-pi) is returned.
44
45 If y is +0 (-0) and x is +0, +0 (-0) is returned.
46
47 If y is a finite value greater (less) than 0, and x is negative infin‐
48 ity, +pi (-pi) is returned.
49
50 If y is a finite value greater (less) than 0, and x is positive infin‐
51 ity, +0 (-0) is returned.
52
53 If y is positive infinity (negative infinity), and x is finite, pi/2
54 (-pi/2) is returned.
55
56 If y is positive infinity (negative infinity) and x is negative infin‐
57 ity, +3*pi/4 (-3*pi/4) is returned.
58
59 If y is positive infinity (negative infinity) and x is positive infin‐
60 ity, +pi/4 (-pi/4) is returned.
61
63 No errors occur.
64
66 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
67 4.3BSD, C89.
68
70 acos(3), asin(3), atan(3), carg(3), cos(3), sin(3), tan(3)
71
73 This page is part of release 3.53 of the Linux man-pages project. A
74 description of the project, and information about reporting bugs, can
75 be found at http://www.kernel.org/doc/man-pages/.
76
77
78
79 2010-09-20 ATAN2(3)