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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       atan2, atan2f, atan2l - arc tangent functions
13

SYNOPSIS

15       #include <math.h>
16
17       double atan2(double y, double x);
18       float atan2f(float y, float x);
19       long double atan2l(long double y, long double x);
20
21

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

83       None.
84

APPLICATION USAGE

86       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
87       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
88       at least one of them must be non-zero.
89

RATIONALE

91       None.
92

FUTURE DIRECTIONS

94       None.
95

SEE ALSO

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