Macro float_eq::assert_float_ne
source · [−]macro_rules! assert_float_ne {
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr, $eq2:ident <= $tol_2:expr, $eq3:ident <= $tol_3:expr) => { ... };
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr, $eq2:ident <= $tol_2:expr) => { ... };
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr) => { ... };
($left:expr, $right:expr, $($eq:ident <= $tol:expr,)+) => { ... };
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr, $eq2:ident <= $tol_2:expr, $eq3:ident <= $tol_3:expr, $($arg:tt)+) => { ... };
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr, $eq2:ident <= $tol_2:expr, $($arg:tt)+) => { ... };
($left:expr, $right:expr, $eq1:ident <= $tol_1:expr, $($arg:tt)+) => { ... };
}
Expand description
Asserts that two floating point expressions are not equal to each other.
See the top level documentation for a list of available comparison algorithms.
On panic, this macro will print the values of the expressions with their debug
representations, with additional information from the comparison operations.
Like assert!
, this macro has a second form, where a custom panic message can
be provided.
Examples
let a: f32 = 4.0;
let b: f32 = 4.1;
assert_float_ne!(a, b, ulps <= 10);
assert_float_ne!(a, b, rmax <= 2.0 * f32::EPSILON);
assert_float_ne!(a - b, 0.0, abs <= 0.000_01, "Checking that {} != {}", a, b);