Function ludomath::num::modulo
[−]
[src]
pub fn modulo(num: f32, denom: f32) -> f32
Calculates num
modulo denom
.
Equivalent to num % denom, except that the result
is corrected to never be negative. No guarantees made
about the result if denom <= 0
, however.
This gives the property that (discounting rounding errors)
modulo(n, d) == modulo(n + d, d)
for all n
and positive d
.
Returns NaN if denom
is zero.