Skip to main content

Module assert_approx

Module assert_approx 

Source
Expand description

Assert for approximations.

These macros compare numbers, such as two floating point numbers, where one number may be very close to another number but not quite equal.

§Example

use assertables::*;

let a: f32 = 1.0000001;
let b: f32 = 1.0000011;
assert_approx_eq!(a, b);

Modules§

assert_approx_eq
Assert a number is approximately equal to another.
assert_approx_eq_with_absolute_error
Assert a number is approximately equal to another by using absolute error a.k.a. delta.
assert_approx_eq_with_relative_error
Assert a number is approximately equal to another by using relative error a.k.a. epsilon.
assert_approx_ne
Assert a number is approximately not equal to another.
assert_approx_ne_with_absolute_error
Assert a number is approximately not equal to another by using absolute error a.k.a. delta.
assert_approx_ne_with_relative_error
Assert a number is approximately not equal to another by using relative error a.k.a. epsilon.