pub fn primitive_float_sin_pi<T>(x: T) -> Twhere
Float: From<T> + PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\sin(\pi x)$, the sine of a primitive float measured in half-turns.
This is primitive_float_sin_with_period with a period of 2: see
primitive_float_sin_with_period for the error bound and the special cases, with $u = 2$.
Half-integers give exactly $\pm1$ and integers exactly $\pm0.0$ with the sign of the input.
§Worst-case complexity
Constant time and additional memory.
§Examples
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::sin::primitive_float_sin_pi;
assert!(primitive_float_sin_pi(f32::NAN).is_nan());
assert_eq!(NiceFloat(primitive_float_sin_pi(0.5f32)), NiceFloat(1.0));
assert_eq!(NiceFloat(primitive_float_sin_pi(1.0f64)), NiceFloat(0.0));
assert_eq!(
NiceFloat(primitive_float_sin_pi(0.1f32)),
NiceFloat(0.309017)
);
assert_eq!(
NiceFloat(primitive_float_sin_pi(0.1f64)),
NiceFloat(0.30901699437494745)
);