Function rv::misc::mod_euc[][src]

pub fn mod_euc(lhs: f64, rhs: f64) -> f64

Euclidean modulo

Example

Taken from the rust documentation

let a: f64 = 7.0;
let b = 4.0;
assert_eq!(mod_euc(a, b), 3.0);
assert_eq!(mod_euc(-a, b), 1.0);
assert_eq!(mod_euc(a, -b), 3.0);
assert_eq!(mod_euc(-a, -b), 1.0);
// limitation due to round-off error
assert!(mod_euc(-std::f64::EPSILON, 3.0) != 0.0);