Function spinoso_math::acos

source ·
pub fn acos(value: f64) -> Result<f64, DomainError>
Expand description

Computes the arccosine of the given value. Returns results in the range (0..=PI).

Domain: [-1, 1]

Codomain: [0, PI]


use spinoso_math as math;
assert_eq!(math::acos(0.0), Ok(PI / 2.0));

assert!(matches!(math::acos(f64::NAN), Ok(result) if result.is_nan()));


If the result of computing the arccosine is NAN, a domain error is returned.