spinoso_math

Function 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]

§Examples

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

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

§Errors

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