atan2 (Math)

Calculates 2-argument arctangent.

Arguments

y
and
x
are real numbers to calculate arctangent for.

Return values

The resulting

angle
in radians as a real number in [-pi, pi] interval. It is calculated as arc tangent of
y/x
, taking signs of both arguments into account to determine the quadrant.

Example

5.0 2.0 atan2 print LF print -5.0 2.0 atan2 print LF print 5.0 -2.0 atan2 print LF print -5.0 -2.0 atan2 print
Output:
1.190290 -1.190290 1.951303 -1.951303