1ATAN2(3)                   Linux Programmer's Manual                  ATAN2(3)
2
3
4

NAME

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

SYNOPSIS

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           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22               || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23

DESCRIPTION

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

RETURN VALUE

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

ERRORS

63       No errors occur.
64

ATTRIBUTES

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

CONFORMING TO

76       C99, POSIX.1-2001, POSIX.1-2008.
77
78       The variant returning double also conforms to SVr4, 4.3BSD, C89.
79

SEE ALSO

81       acos(3), asin(3), atan(3), carg(3), cos(3), sin(3), tan(3)
82

COLOPHON

84       This page is part of release 5.13 of the Linux  man-pages  project.   A
85       description  of  the project, information about reporting bugs, and the
86       latest    version    of    this    page,    can     be     found     at
87       https://www.kernel.org/doc/man-pages/.
88
89
90
91                                  2021-03-22                          ATAN2(3)
Impressum