[][src]Macro fuzzycomp::assert_approx_eq

macro_rules! assert_approx_eq {
    ($a:expr, $b:expr) => { ... };
    ($a:expr, $b:expr, $eps:expr) => { ... };
}

Reexporting assert_approx_eq macro from assert_approx_eq Asserts that two expressions are approximately (~1.0e-6) equal to each other.

On panic, this macro will print the values of the expressions with their debug representations. You can optionally add an optional diff value. If you don't supply a diff value as an argument, 1.0e-6 is the default used.

Examples

use assert_approx_eq::assert_approx_eq;

let a = 3f64;
let b = 4f64;

assert_approx_eq!(a, b); //panics
assert_approx_eq!(a, b, 2f64); //does not panic
assert_approx_eq!(a, b, 1e-3f64); // panics