Implementing the NearlyEq traits, Can asserts that the two expressions are nearly(approximately) equal to each other.
See the crate documentation for more details.
assert_nearly_eq!(1f64, 1.5f64, 0.6f64); // does not panic
assert_nearly_eq!(0f64, 1e-12f64); // does not panicassert_nearly_eq!(1f64, 2f64); // panics
-
complex- ImplementNearlyEqtraits fornum_complex::Complex. This adds a dependency on thenum-complexcrate. -
rational- ImplementNearlyEqtraits fornum_rational::Ratio. This adds a dependency on thenum-rationalcrate. -
ndarray- ImplementNearlyEqtraits forndarray::ArrayBase. This adds a dependency on thendarraycrate. -
use_fpa- ImplementNearlyEqtraits for fixed-point types offpacrate. -
i128- ImplementNearlyEqtraits fori128andu128. Available only on Rust nightly channel.