9 releases

Uses old Rust 2015

0.2.4 Mar 28, 2018
0.2.3 Oct 18, 2017
0.1.3 Oct 11, 2017

#2485 in Rust patterns

Download history 198/week @ 2024-07-24 181/week @ 2024-07-31 176/week @ 2024-08-07 157/week @ 2024-08-14 189/week @ 2024-08-21 177/week @ 2024-08-28 198/week @ 2024-09-04 166/week @ 2024-09-11 186/week @ 2024-09-18 189/week @ 2024-09-25 160/week @ 2024-10-02 164/week @ 2024-10-09 207/week @ 2024-10-16 239/week @ 2024-10-23 193/week @ 2024-10-30 127/week @ 2024-11-06

802 downloads per month
Used in 17 crates (9 directly)

MPL-2.0 license

21KB
390 lines

rust-nearly-eq

crates.io badge Build Status docs.rs Coverage Status

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 - Implement NearlyEq traits for num_complex::Complex. This adds a dependency on the num-complex crate.

  • rational - Implement NearlyEq traits for num_rational::Ratio. This adds a dependency on the num-rational crate.

  • ndarray - Implement NearlyEq traits for ndarray::ArrayBase. This adds a dependency on the ndarray crate.

  • use_fpa - Implement NearlyEq traits for fixed-point types of fpa crate.

  • i128 - Implement NearlyEq traits for i128 and u128. Available only on Rust nightly channel.

Dependencies

~0–630KB
~13K SLoC