CRE Programmer's Guide

Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
7-6
Arctan2
Return Value
The Arctan functions return the angle, expressed in radians, whose tangent is tan.
The value returned is in the range:
-pi/2 less than or equal to arctan(
tan ) less than or equal to pi/2
Arctan2
The Arctan2 functions return the arctangent of the quotient of their parameters.
y
is the ordinate of the ordered pair (y, x) that determines an angle whose tangent is
y / x.
x
is the abscissa of the ordered pair (y, x) that determines an angle whose tangent is
y / x.
Return Value
The Arctan2 functions return the angle, expressed in radians, whose tangent is y / x.
The value returned is in the range:
-pi < arctan2( y, x ) less than or equal to pi
The quadrant of the angle, A, returned by the Arctan2 functions is determined by the
signs of
y and x:
if
y < 0 then A < 0
if x < 0 then absolute_value( A ) > pi/2
if x = 0 then absolute_value( A ) = pi/2
Considerations
An arithmetic fault occurs if both y and x are equal to zero.
REAL(32) PROC { CRE_Arctan2_Real32_ } ( y, x );
{ RTL_Arctan2_Real32_ }
REAL(32) y, x; ! in TNS only
REAL(64) PROC { CRE_Arctan2_Real64_ } ( y, x );
{ RTL_Arctan2_Real64_ }
REAL(64) y, x; ! in TNS only