pub fn approx_equal_with(a: f64, b: f64, relative: f64, absolute: f64) -> boolExpand description
Checks whether two floating-point numbers agree to the given tolerances.
Equal to within absolute, or within relative scaled by the larger
magnitude. Infinities of the same sign compare equal; any NaN does not.
ยงExample
use nautilus_indicators::testing::approx_equal_with;
assert!(approx_equal_with(100.0, 100.000_001, 1e-7, 0.0));
assert!(!approx_equal_with(100.0, 100.000_1, 1e-7, 0.0));