Next: , Previous: ATAN, Up: Intrinsic Procedures


8.18 ATAN2 — Arctangent function

Description:
ATAN2(Y,X) computes the arctangent of the complex number X + i Y.
Option:
f95, gnu
Class:
elemental function
Syntax:
X = ATAN2(Y,X)
Arguments:

Y The type shall be REAL(*).
X The type and kind type parameter shall be the same as Y. If Y is zero, then X must be nonzero.

Return value:
The return value has the same type and kind type parameter as Y. It is the principle value of the complex number X + i Y. If X is nonzero, then it lies in the range -\pi \le \arccos (x) \leq \pi. The sign is positive if Y is positive. If Y is zero, then the return value is zero if X is positive and \pi if X is negative. Finally, if X is zero, then the magnitude of the result is \pi/2.
Example:
          program test_atan2
            real(4) :: x = 1.e0_4, y = 0.5e0_4
            x = atan2(y,x)
          end program test_atan2
     

Specific names:

Name Argument Return type Option
DATAN2(X) REAL(8) X REAL(8) f95, gnu