0.1.0[][src]Macro appro_eq::debug_assert_appro_eq_abs

macro_rules! debug_assert_appro_eq_abs {
    ($($arg:tt)*) => { ... };
}

Asserts that the absolute error of the two expressions is small enough.

You can optionally add an optional diff value. If you don't supply a diff value as an argument, Tolerance::tolerance() is the default used.

Unlike assert_appro_eq_abs!, debug_assert_appro_eq_abs! statements are only enabled in non optimized builds by default. An optimized build will omit all debug_assert_appro_eq_abs! statements unless -C debug-assertions is passed to the compiler.

Examples

debug_assert_appro_eq_abs!(1f64, 1.5f64, 0.6f64); // does not panic
debug_assert_appro_eq_abs!(0f64, 1e-12f64); // does not panic
debug_assert_appro_eq_abs!(vec![0f64, 1.0, 0.0], vec![1e-12f64, 1.0, -1e-13f64]); // does not panic
This example panics
debug_assert_appro_eq_abs!(1f64, 2f64); // panics