assert_be_close

Function assert_be_close 

Source
pub fn assert_be_close<T: Float + Display>(left: T, right: T, precision: i32)
Expand description

Asserts that two decimals are equal with the specified precision. On panic, the function will print the value of the decimal with their debug representations. 2つの小数が指定した精度で等しいことを保証する。 パニックになると、この関数は小数の値をデバッグ表現とともに出力する。

§Panics

Panic if the value is not equivalent to the specified precision. 値が指定した精度で等価でなければパニックする。

§Examples

use assert_be_close::assert_be_close;

assert_be_close(1.0, 1.0001, 3);
assert_be_close(1.0, 1.0001, 4); // panic