pub fn primitive_float_rem_rational<T>(x: T, y: &Rational) -> TExpand description
Computes the remainder of a primitive float by a Rational, with the quotient rounded toward
zero, correctly rounding the result to the nearest value.
The Rational modulus is used exactly. A remainder is unusually sensitive to its modulus —
perturbing it by $\varepsilon$ moves the result by up to the quotient times $\varepsilon$ — so
no primitive-float approximation of the modulus could produce these values. NaN or infinite x,
or zero y, gives NaN.
§Worst-case complexity
$T(n) = O(n \log n \log\log n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is y.significant_bits().
§Examples
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::rem::primitive_float_rem_rational;
use malachite_q::Rational;
// 10 mod 22/7 = 4/7
assert_eq!(
NiceFloat(primitive_float_rem_rational(
10.0,
&Rational::from_signeds(22, 7)
)),
NiceFloat(0.5714285714285714)
);