W3cubDocs

/GNU Fortran 14

8.26 ATAN2D — Arctangent function, degrees

Description:

ATAN2D(Y, X) computes the principal value of the argument function of the complex number X + i Y in degrees. This function can be used to transform from Cartesian into polar coordinates and allows to determine the angle in the correct quadrant.

Standard:

Fortran 2023

Class:

Elemental function

Syntax:

RESULT = ATAN2D(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 principal value of the complex number X + i Y. If X is nonzero, then it lies in the range -180 \le \atan (x) \leq 180. The sign is positive if Y is positive. If Y is zero, then the return value is zero if X is strictly positive, 180 if X is negative and Y is positive zero (or the processor does not handle signed zeros), and -180 if X is negative and Y is negative zero. Finally, if X is zero, then the magnitude of the result is 90.

Example:
program test_atan2d
  real(4) :: x = 1.e0_4, y = 0.5e0_4
  x = atan2d(y,x)
end program test_atan2d
Specific names:
Name Argument Return type Standard
ATAN2D(X, Y) REAL(4) X, Y REAL(4) Fortran 2023
DATAN2D(X, Y) REAL(8) X, Y REAL(8) GNU extension
See also:

Alias: ATAND — Arctangent function, degrees Radians function: ATAN2 — Arctangent function

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gfortran/ATAN2D.html