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

Download history 176/week @ 2024-03-14 181/week @ 2024-03-21 213/week @ 2024-03-28 177/week @ 2024-04-04 189/week @ 2024-04-11 278/week @ 2024-04-18 177/week @ 2024-04-25 197/week @ 2024-05-02 185/week @ 2024-05-09 174/week @ 2024-05-16 166/week @ 2024-05-23 218/week @ 2024-05-30 227/week @ 2024-06-06 234/week @ 2024-06-13 307/week @ 2024-06-20 206/week @ 2024-06-27

1,018 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–445KB