8.9 ACOSPI — Circular arc cosine function

Description:

ACOSPI(X) computes \acos(x) / \pi, which is a measure of an angle in half-revolutions.

Standard:

Fortran 2023

Class:

Elemental function

Syntax:

RESULT = ACOSPI(X)

Arguments:
XThe type shall be REAL with -1 \leq x \leq 1.
Return value:

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

Example:
program test_acospi
  implicit none
  real, parameter :: x = 0.123, y(3) = [0.123, 0.45, 0.8]
  real, parameter :: a = acospi(x), b(3) = acospi(y)
  call foo(x, y)
contains
  subroutine foo(u, v)
    real, intent(in) :: u, v(:)
    real :: f, g(size(v))
    f = acospi(u)
    g = acospi(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_acospi
See also:

ASINPI — Circular arc sine function
ATAN2PI — Circular arc tangent function
ATANPI — Circular arc tangent function