pub fn rem_euclid(x: f64, rhs: f64) -> f64
🔬This is a nightly-only experimental API. (
core_float_math
#137578)Expand description
Experimental version of rem_euclid
in core
. See f64::rem_euclid
for details.
§Examples
#![feature(core_float_math)]
use core::f64;
let a: f64 = 7.0;
let b = 4.0;
assert_eq!(f64::math::rem_euclid(a, b), 3.0);
assert_eq!(f64::math::rem_euclid(-a, b), 1.0);
assert_eq!(f64::math::rem_euclid(a, -b), 3.0);
assert_eq!(f64::math::rem_euclid(-a, -b), 1.0);
// limitation due to round-off error
assert!(f64::math::rem_euclid(-f64::EPSILON, 3.0) != 0.0);
This standalone function is for testing only. It will be stabilized as an inherent method.