9 releases
Uses old Rust 2015
0.2.4 | Mar 28, 2018 |
---|---|
0.2.3 | Oct 18, 2017 |
0.1.3 | Oct 11, 2017 |
#2590 in Rust patterns
1,018 downloads per month
Used in 17 crates
(9 directly)
21KB
390 lines
rust-nearly-eq
Implementing the NearlyEq
traits, Can asserts that the two expressions are nearly(approximately) equal to each other.
How-to Use
See the crate documentation for more details.
Examples
assert_nearly_eq!(1f64, 1.5f64, 0.6f64); // does not panic
assert_nearly_eq!(0f64, 1e-12f64); // does not panic
assert_nearly_eq!(1f64, 2f64); // panics
Optional Features
-
complex
- ImplementNearlyEq
traits fornum_complex::Complex
. This adds a dependency on thenum-complex
crate. -
rational
- ImplementNearlyEq
traits fornum_rational::Ratio
. This adds a dependency on thenum-rational
crate. -
ndarray
- ImplementNearlyEq
traits forndarray::ArrayBase
. This adds a dependency on thendarray
crate. -
use_fpa
- ImplementNearlyEq
traits for fixed-point types offpa
crate. -
i128
- ImplementNearlyEq
traits fori128
andu128
. Available only on Rust nightly channel.
Dependencies
~0–445KB