Function div_euclid

Source
pub fn div_euclid(x: f64, rhs: f64) -> f64
🔬This is a nightly-only experimental API. (core_float_math)
Expand description

Experimental version of div_euclid in core. See f64::div_euclid for details.

§Examples

#![feature(core_float_math)]

use core::f64;

let a: f64 = 7.0;
let b = 4.0;
assert_eq!(f64::div_euclid(a, b), 1.0); // 7.0 > 4.0 * 1.0
assert_eq!(f64::div_euclid(-a, b), -2.0); // -7.0 >= 4.0 * -2.0
assert_eq!(f64::div_euclid(a, -b), -1.0); // 7.0 >= -4.0 * -1.0
assert_eq!(f64::div_euclid(-a, -b), 2.0); // -7.0 >= -4.0 * 2.0

This standalone function is for testing only. It will be stabilized as an inherent method.