close-to-rs
Provides a function, Tolerate, to verify the equivalence of floating-point numbers at arbitrary precision.
任意の精度で浮動小数点数の等価性を検証するための関数、トレイトを提供します。
An alias also exists for compatibility with assert-be-close, so changing the crate does not require changing the code.
assert-be-closeとの互換性を保つためのエイリアスも存在するため、クレートを変更してもコードを変更する必要がありません。
使い方(Usage)
Compare values with arbitrary precision.
任意の精度で数値を比較する。
use ;
Different types can be compared if the first argument T is a floating-point number and the second argument U
implements Into<T>.
異なる型同士でも、第1引数Tが浮動小数点数かつ、第2引数UがInto<T>を実装していれば比較できます。
use ;
There is also a function that panics if the result of the comparison is false, along with a debug expression.
また、比較した結果がfalseである場合、デバック表現とともにpanicする関数もあります。
use ;
Traits are also provided to implement these functions.
By default, they are implemented for f32 and f64.
T.close_to(U, precision) and close_to(T, U, precision) have the same behavior.
これらの機能を実装するためのトレイトも提供しています。
デフォルトでは、f32とf64に対して実装されています。
T.close_to(U, precision)とclose_to(T, U, precision)は同じ挙動をします。
use ;
ライセンス(License)
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.