The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


atan2 - arc tangent function


#include <math.h>

double atan2(double y, double x);


The atan2() function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.

An application wishing to check for error situations should set errno to 0 before calling atan2(). If errno is non-zero on return, or the return value is NaN, an error has occurred.


Upon successful completion, atan2() returns the arc tangent of y/x in the range [-, ] radians. If both arguments are 0.0, an implementation-dependent value is returned and errno may be set to [EDOM].

If x or y is NaN, NaN is returned and errno may be set to [EDOM].

If the result underflows, 0.0 is returned and errno may be set to [ERANGE].


The atan2() function may fail if:
Both arguments are 0.0  or one or more of the arguments is NaN.
The result underflows.

No other errors will occur.








atan(), isnan(), tan(), <math.h>.


Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]