macro_rules! assert_approx_eq {
($left:expr, $right:expr, $max_rel_diff:expr $(,)?) => { ... };
($left:expr, $right:expr, $max_rel_diff:expr, $($args:tt)+) => { ... };
}
Expand description
Asserts that two expressions are approximately equal to each other.
The max_rel_diff
argument defines the maximum relative difference
of the left
and right
values.
On panic, this macro will print the values of the arguments and the actual relative difference.
Like assert_eq!
, this macro has a second form, where a custom
panic message can be provided.