Purpose
Arctangent (inverse tangent) function.
The result is the principal value of the nonzero complex number (X,
Y) formed by the real arguments Y and X.
Argument type and attributes
- Y
- An INTENT(IN) REAL
- X
- An INTENT(IN) argument of the same type and kind type parameter
as Y. If Y has the value zero, X must not have the value zero.
Result type and attributes
Same as X.
Result value
- It is expressed in radians and has a value equal to the principal
value of the argument of the complex number (X, Y).
- It is in the range -PI < ATAN2(Y, X) ≤ PI.
- If X ≠ 0, the result approximates
arctan(Y/X).
- If Y > 0, the result is positive.
- If Y < 0, the result is negative.
- If X = 0, the absolute value of the result is PI/2.
The -qxlf2003=signdzerointr option
controls whether you get Fortran 2003 behavior. See qxlf2003
- If Y = 0 and X < 0, the result is PI.
- If Y = 0 and X > 0, the result is zero.
- If Y = 0 and X < 0, the result is PI if Y is positive real zero and -PI if Y is
negative real zero.
- If Y = 0 and X > 0, the result is Y.
Examples
ATAN2 (1.5574077,
1.0) has the value 1.0.
Given that:
Y = | 1 1 | X = | -1 1 |
| -1 -1 | | -1 1 |
the value of ATAN2(Y,X)
is approximately:
ATAN2 (Y, X) = | 3PI/4 PI/4 |
| -3PI/4 -PI/4 |
Specific Name |
Argument Type |
Result Type |
Pass As Arg? |
ATAN2 |
default real |
default real |
yes |
DATAN2 |
double precision real |
double precision real |
yes |
QATAN2 1 |
REAL(16) |
REAL(16) |
yes |