pub fn primitive_float_rem_unsigned<T>(x: T, y: u64) -> TExpand description
Computes the remainder of a primitive float by a u64, with the quotient rounded toward zero,
correctly rounding the result to the nearest value.
The modulus is used exactly, even when it is not representable in the primitive float type (any
u64 above $2^{T::MANTISSA\_WIDTH+1}$ has neighbors that round to the same float). A zero
modulus gives NaN, matching mpfr_fmod_ui.
§Worst-case complexity
Constant time and additional memory.
§Examples
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::rem::primitive_float_rem_unsigned;
assert_eq!(
NiceFloat(primitive_float_rem_unsigned(10.5, 3)),
NiceFloat(1.5)
);
// u64::MAX is not exactly representable as an f64, but the remainder is taken exactly
assert_eq!(
NiceFloat(primitive_float_rem_unsigned(1.0e30, u64::MAX)),
NiceFloat(5.076964209140211e18)
);