pub fn primitive_float_sin_pi_rational<T>(x: &Rational) -> Twhere
Float: PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\sin(\pi x)$, the sine of a Rational measured in half-turns, returning the result
as a primitive float.
This is primitive_float_sin_with_period_rational with a period of 2: see
primitive_float_sin_with_period_rational for the error bound, the special cases, and the
complexity, with $u = 2$.
§Worst-case complexity
$T(m) = O(m (\log m)^2 \log\log m)$
$M(m) = O(m \log m)$
where $T$ is time, $M$ is additional memory, and $m$ is x.significant_bits().
§Examples
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::sin::primitive_float_sin_pi_rational;
use malachite_q::Rational;
// a sixth of a half-turn is exactly 1/2
assert_eq!(
NiceFloat(primitive_float_sin_pi_rational::<f64>(
&Rational::from_unsigneds(1u8, 6)
)),
NiceFloat(0.5)
);
assert_eq!(
NiceFloat(primitive_float_sin_pi_rational::<f64>(
&Rational::from_unsigneds(1u8, 7)
)),
NiceFloat(0.4338837391175581)
);