8.31 ATANPI — Circular arc tangent function

Description:

ATANPI(X) computes \atan(x) / \pi. ATANPI(Y, X) computes {\rm atan2}(y, x) / \pi. These provide a measure of an angle in half-revolutions.

Standard:

Fortran 2023

Class:

Elemental function

Syntax:
RESULT = ATANPI(X)
RESULT = ATANPI(Y, X)
Arguments:
YThe type shall be REAL.
XIf Y appears, X shall have the same type and kind as Y. If Y is zero, then X shall not be zero. If Y does not appear in a function reference, then X shall be REAL.
Return value:

The return value has the same type and kind as X. It is expressed in half-revolutions and satisfies -0.5 \leq \atanpi (x) \leq 0.5.

Example:
program test_atanpi
  implicit none
  real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8]
  real, parameter :: a = atanpi(x), b(3) = atanpi(y)
  call foo(x, y)
contains
  subroutine foo(u, v)
    real, intent(in) :: u, v(:)
    real :: f, g(size(v))
    f = atanpi(u)
    g = atanpi(v)
    if (abs(a - f) > 8 * epsilon(f)) stop 1
    if (any(abs(g - b) > 8 * epsilon(f))) stop 2
  end subroutine foo
end program test_atanpi
See also:

ACOSPI — Circular arc cosine function
ASINPI — Circular arc sine function
ATAN2PI — Circular arc tangent function