ArcCos v0.1.0

Source
Returns the inverse cosine, in radians.

Package: Math

Signature

func ArcCos(x: float64) -> float64;
func ArcCos(x: float32) -> float32;

Parameters

NameTypeDescription
xfloat64 / float32A value in [-1, 1].

Returns

The angle in [0, Pi] whose cosine is x. ArcCos(1.0) is 0.0 and ArcCos(-1.0) is Pi. For |x| > 1.0 the result is a NaN, since no real angle has that cosine; a NaN argument also propagates.

Example

import Math::ArcCos;

func Main() -> int {
    let a = ArcCos(1.0);  // 0.0
    let b = ArcCos(-1.0); // 3.141592653589793 (Pi)
    return 0;
}

See also

  • Math — the package overview
  • Cos — the function ArcCos inverts
  • ArcSin / ArcTan — the other inverse trigonometric functions