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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
20 || _ISOC99_SOURCE; or cc -std=c99
21
23 The atan2() function calculates the principal value of the arc tangent
24 of y/x, using the signs of the two arguments to determine the quadrant
25 of the result.
26
28 On success, these functions return the principal value of the arc tan‐
29 gent of y/x in radians; the return value is in the range [-pi, pi].
30
31 If y is +0 (-0) and x is less than 0, +pi (-pi) is returned.
32
33 If y is +0 (-0) and x is greater than 0, +0 (-0) is returned.
34
35 If y is less than 0 and x is +0 or -0, -pi/2 is returned.
36
37 If y is greater than 0 and x is +0 or -0, pi/2 is returned.
38
39 If either x or y is NaN, a NaN is returned.
40
41 If y is +0 (-0) and x is -0, +pi (-pi) is returned.
42
43 If y is +0 (-0) and x is +0, +0 (-0) is returned.
44
45 If y is a finite value greater (less) than 0, and x is negative infin‐
46 ity, +pi (-pi) is returned.
47
48 If y is a finite value greater (less) than 0, and x is positive infin‐
49 ity, +0 (-0) is returned.
50
51 If y is positive infinity (negative infinity), and x is finite, pi/2
52 (-pi/2) is returned.
53
54 If y is positive infinity (negative infinity) and x is negative infin‐
55 ity, +3*pi/4 (-3*pi/4) is returned.
56
57 If y is positive infinity (negative infinity) and x is positive infin‐
58 ity, +pi/4 (-pi/4) is returned.
59
61 No errors occur.
62
64 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
65 4.3BSD, C89.
66
68 acos(3), asin(3), atan(3), carg(3), cos(3), sin(3), tan(3)
69
71 This page is part of release 3.22 of the Linux man-pages project. A
72 description of the project, and information about reporting bugs, can
73 be found at http://www.kernel.org/doc/man-pages/.
74
75
76
77 2008-11-20 ATAN2(3)