Elemental Intrinsic Function (Generic): Produces an arctangent. The result is the principal value of the argument of the nonzero complex number (x, y).
Syntax
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 |
---|---|---|
ATAN2 | REAL(4) | REAL(4) |
DATAN2 | REAL(8) | REAL(8) |
QATAN2 | REAL(16) | REAL(16) |
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