1atan2(3)                   Library Functions Manual                   atan2(3)
2
3
4

NAME

6       atan2, atan2f, atan2l - arc tangent function of two variables
7

LIBRARY

9       Math library (libm, -lm)
10

SYNOPSIS

12       #include <math.h>
13
14       double atan2(double y, double x);
15       float atan2f(float y, float x);
16       long double atan2l(long double y, long double x);
17
18   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20       atan2f(), atan2l():
21           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24

DESCRIPTION

26       These  functions  calculate  the  principal value of the arc tangent of
27       y/x, using the signs of the two arguments to determine the quadrant  of
28       the result.
29

RETURN VALUE

31       On  success, these functions return the principal value of the arc tan‐
32       gent of y/x in radians; the return value is in the range [-pi, pi].
33
34       If y is +0 (-0) and x is less than 0, +pi (-pi) is returned.
35
36       If y is +0 (-0) and x is greater than 0, +0 (-0) is returned.
37
38       If y is less than 0 and x is +0 or -0, -pi/2 is returned.
39
40       If y is greater than 0 and x is +0 or -0, pi/2 is returned.
41
42       If either x or y is NaN, a NaN is returned.
43
44       If y is +0 (-0) and x is -0, +pi (-pi) is returned.
45
46       If y is +0 (-0) and x is +0, +0 (-0) is returned.
47
48       If y is a finite value greater (less) than 0, and x is negative  infin‐
49       ity, +pi (-pi) is returned.
50
51       If  y is a finite value greater (less) than 0, and x is positive infin‐
52       ity, +0 (-0) is returned.
53
54       If y is positive infinity (negative infinity), and x  is  finite,  pi/2
55       (-pi/2) is returned.
56
57       If  y is positive infinity (negative infinity) and x is negative infin‐
58       ity, +3*pi/4 (-3*pi/4) is returned.
59
60       If y is positive infinity (negative infinity) and x is positive  infin‐
61       ity, +pi/4 (-pi/4) is returned.
62

ERRORS

64       No errors occur.
65

ATTRIBUTES

67       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
68       tributes(7).
69
70       ┌────────────────────────────────────────────┬───────────────┬─────────┐
71Interface                                   Attribute     Value   
72       ├────────────────────────────────────────────┼───────────────┼─────────┤
73atan2(), atan2f(), atan2l()                 │ Thread safety │ MT-Safe │
74       └────────────────────────────────────────────┴───────────────┴─────────┘
75

STANDARDS

77       C11, POSIX.1-2008.
78

HISTORY

80       C99, POSIX.1-2001.
81
82       The variant returning double also conforms to SVr4, 4.3BSD, C89.
83

SEE ALSO

85       acos(3), asin(3), atan(3), carg(3), cos(3), sin(3), tan(3)
86
87
88
89Linux man-pages 6.04              2023-03-30                          atan2(3)
Impressum