1ATAN2(P)                   POSIX Programmer's Manual                  ATAN2(P)
2
3
4

NAME

6       atan2, atan2f, atan2l - arc tangent functions
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

DESCRIPTION

17       These functions shall compute the principal value of the arc tangent of
18       y/ x, using the signs of both arguments to determine  the  quadrant  of
19       the return value.
20
21       An  application  wishing to check for error situations should set errno
22       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
23       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
24       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
25       occurred.
26

RETURN VALUE

28       Upon  successful  completion, these functions shall return the arc tan‐
29       gent of y/ x in the range [-pi,pi] radians.
30
31       If y is ±0 and x is < 0, ±pi shall be returned.
32
33       If y is ±0 and x is > 0, ±0 shall be returned.
34
35       If y is < 0 and x is ±0, -pi/2 shall be returned.
36
37       If y is > 0 and x is ±0, pi/2 shall be returned.
38
39       If x is 0, a pole error shall not occur.
40
41       If either x or y is NaN, a NaN shall be returned.
42
43       If the result underflows, a range error may occur and y/  x  should  be
44       returned.
45
46       If y is ±0 and x is -0, ±pi shall be returned.
47
48       If y is ±0 and x is +0, ±0 shall be returned.
49
50       For finite values of ± y > 0, if x is -Inf, ±pi shall be returned.
51
52       For finite values of ± y > 0, if x is +Inf, ±0 shall be returned.
53
54       For finite values of x, if y is ±Inf, ±pi/2 shall be returned.
55
56       If y is ±Inf and x is -Inf, ±3pi/4 shall be returned.
57
58       If y is ±Inf and x is +Inf, ±pi/4 shall be returned.
59
60       If both arguments are 0, a domain error shall not occur.
61

ERRORS

63       These functions may fail if:
64
65       Range Error
66              The result underflows.
67
68       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
69       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
70       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero, then the underflow
71       floating-point exception shall be raised.
72
73
74       The following sections are informative.
75

EXAMPLES

77       None.
78

APPLICATION USAGE

80       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
81       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
82       at least one of them must be non-zero.
83

RATIONALE

85       None.
86

FUTURE DIRECTIONS

88       None.
89

SEE ALSO

91       atan() , feclearexcept() , fetestexcept() , isnan() , tan() , the  Base
92       Definitions  volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of
93       Error Conditions for Mathematical Functions, <math.h>
94
96       Portions of this text are reprinted and reproduced in  electronic  form
97       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
98       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
99       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
100       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
101       event of any discrepancy between this version and the original IEEE and
102       The Open Group Standard, the original IEEE and The Open Group  Standard
103       is  the  referee document. The original Standard can be obtained online
104       at http://www.opengroup.org/unix/online.html .
105
106
107
108IEEE/The Open Group                  2003                             ATAN2(P)
Impressum