assert_far_from

Function assert_far_from 

Source
pub fn assert_far_from<T: Float + Display + Copy, U: Display + Into<T> + Copy>(
    left: T,
    right: U,
    precision: i32,
)
Expand description

Ensures that two decimals are not equal with the specified precision. In case of panic, the function outputs the value of the decimal along with a debugging expression.

2つの小数が指定した精度で等しくないことを保証する。 パニックになると、この関数は小数の値をデバッグ表現とともに出力する。

§Examples

use close_to::assert_far_from;

assert_far_from(1.0, 1.0001, 4);
use close_to::assert_far_from;

assert_far_from(1.0, 1.0001, 3); // panic with the following message

// assertion 'left != right` failed
// left:  1
// right: 1.0001
// received_diff: 0.00009999999999998899
// expected_diff: 0.0005