macro_rules! assert_equal_to_decimal {
($a:expr, $b:expr, $decimal:expr) => { ... };
}
Expand description
Asserts equality of two floating-point numbers to within a specified decimal precision.
§Arguments
a
- The first floating-point number to compare.b
- The second floating-point number to compare against.decimal
- Decimal precision to use for comparison.
§Panics
If the two floating-point numbers are not equal to within the specified decimal precision.
§Note
See Compare::is_equal_to_decimal
for details on how equality to within a specified decimal
precision is defined.
§Examples
use numtest::*;
assert_equal_to_decimal!(2.0, 2.012, 2)
ⓘ
use numtest::*;
assert_equal_to_decimal!(2.0, 2.012, 4)