pub fn ni_asin(tilt: f32) -> f32
Expand description
Computes the arcsine(tilt to angle) of a value with clamping to [-1, 1]
.
- Special cases:
value >= 1.0
-> returnsπ/2
value <= -1.0
-> returns-π/2
§Unspecified precision
Note that the precision for -1.0..1.0 depends on the Rust version and OS, due to the use of f32::asin
.
§Examples
use core::f32::consts::FRAC_PI_2;
assert_eq!(ni_asin(FRAC_PI_2.sin()), FRAC_PI_2);
assert_eq!(ni_asin(1.0), FRAC_PI_2); // overflow -> `π/2`
assert_eq!(ni_asin(-1.1), -FRAC_PI_2); // underflow -> `-π/2`