atan2()
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
Syntax
Numeric atan2(Numeric x)
- x - the abscissa coordinate
Usage
This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi.
Special cases:
- If either value is NaN, then the result is NaN.
- If the value is positive zero and the argument is positive, or the value is positive and finite and the argument is positive infinity, then the result is positive zero.
- If the value is negative zero and the argument is positive, or the value is negative and finite and the argument is positive infinity, then the result is negative zero.
- If the value is positive zero and the argument is negative, or the value is positive and finite and the argument is negative infinity, then the result is the double value closest to pi.
- If the value is negative zero and the argument is negative, or the value is negative and finite and the argument is negative infinity, then the result is the double value closest to -pi.
- If the value is positive and the argument is positive zero or negative zero, or the value is positive infinity and the argument is finite, then the result is the double value closest to pi/2.
- If the value is negative and the argument is positive zero or negative zero, or the value is negative infinity and the argument is finite, then the result is the double value closest to -pi/2.
- If both value and argument are positive infinity, then the result is the double value closest to pi/4.
- If the value is positive infinity and the argument is negative infinity, then the result is the double value closest to 3*pi/4.
- If the value is negative infinity and the argument is positive infinity, then the result is the double value closest to -pi/4.
- If both value and argument are negative infinity, then the result is the double value closest to -3*pi/4.
The computed result must be within 2 ulps of the exact result. Results must be semi-monotonic.