ATAN2 — Arctangent function#
-
ATAN2(Y, X)#
ATAN2(Y, X)computes the principal value of the argument function of the complex number X + i Y. This function can be used to transform from Cartesian into polar coordinates and allows to determine the angle in the correct quadrant.- Parameters:
Y – The type shall be
REAL.X – The type and kind type parameter shall be the same as
Y. IfYis zero, thenXmust be nonzero.
- Returns:
The return value has the same type and kind type parameter as
Y. It is the principal value of the complex number X + i Y. IfXis nonzero, then it lies in the range -pi le atan (x) leq pi. The sign is positive ifYis positive. IfYis zero, then the return value is zero ifXis strictly positive, pi ifXis negative andYis positive zero (or the processor does not handle signed zeros), and -pi ifXis negative andYis negative zero. Finally, ifXis zero, then the magnitude of the result is pi/2.
- Standard:
Fortran 77 and later
- Class:
Elemental function
- Syntax:
RESULT = ATAN2(Y, X)
- 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
Standard
ATAN2(X, Y)REAL(4) X, YREAL(4)Fortran 77 and later
DATAN2(X, Y)REAL(8) X, YREAL(8)Fortran 77 and later
- See also: