macro_rules! assert_float_relative_ne {
($a:expr, $b:expr, $epsilon:expr) => { ... };
($a:expr, $b:expr) => { ... };
}Expand description
Assert the relative error between two values is greater than epsilon.
Panics if |(a - b) / a| <= epsilon. If a.is_infinite(), then this
will always panic. If a.is_nan(), then this will never panic.
a- First float.b- Second float.epsilon- Relative error tolerance between floats (defaults to1.0e-6).
ยงExamples
assert_float_relative_ne!(4.0, 3.0, 0.25 - 1.0e-7);
assert_float_relative_ne!(1.0, 0.5 + 0.5 + 1e-5);