ARCTAN2 Function

── ARCTAN2 ── ( ──<arithmetic expression>── , ─────────────────────────►
►─<arithmetic expression>── ) ─────────────────────────────────────────┤

The ARCTAN2 function returns, as a real value, the arctangent (in radians) of the following:

first <arithmetic expression> / second <arithmetic expression>

The returned value is adjusted according to the following formulas so that the value falls in the range (–pi to +pi).

In the following equations, let X be the value of the first arithmetic expression, and let Y be the value of the second arithmetic expression. If Y is greater than 0, then

ARCTAN2(X,Y) = ARCTAN(X/Y)

If Y equals 0, then

ARCTAN2(X,Y) = SIGN(X) * pi / 2 

If Y is less than 0, then

ARCTAN2(X,Y) = ARCTAN(X/Y) + SIGN(X) * pi