ATAN2

Elemental Intrinsic Function (Generic): Produces an arctangent. The result is the principal value of the argument of the nonzero complex number (x, y).

Syntax

result = ATAN2 (y, x)

y
(Input) Must be of type real.

x
(Input) Must have the same type and kind parameters as y. If y has the value zero, x cannot have the value zero.

Results:

The result type is the same as x and is expressed in radians. The value lies in the range -pi < ATAN2 (y, x) <= pi. If x /= zero, the result is approximately equal to the value of arctan (y/x).

If y > zero, the result is positive.

If y < zero, the result is negative.

If y = zero, the result is zero (if x > zero) or pi (if x < zero).

If x = zero, the absolute value of the result is pi/2.

Specific Name Argument Type Result Type
ATAN2REAL(4) REAL(4)
DATAN2 REAL(8) REAL(8)
QATAN2 1 REAL(16) REAL(16)
1 VMS and U*X

Examples

ATAN2 (2.679676, 1.0) has the value 1.213623.

If Y has the value

  [  1   1 ]
  [ -1  -1 ]
and X has the value
  [ -1  1 ]
  [ -1  1 ],
then ATAN2 (Y, X) is