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.
-
assert_approx_eq!(a, b)≈ a is approximately equal to b -
assert_approx_ne!(a, b)≈ a is approximately not equal to b
§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_ ne - Assert a number is approximately not equal to another.