9 releases

Uses old Rust 2015

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

#2768 in Rust patterns

Download history 201/week @ 2023-11-18 228/week @ 2023-11-25 153/week @ 2023-12-02 161/week @ 2023-12-09 183/week @ 2023-12-16 141/week @ 2023-12-23 129/week @ 2023-12-30 145/week @ 2024-01-06 173/week @ 2024-01-13 119/week @ 2024-01-20 110/week @ 2024-01-27 130/week @ 2024-02-03 154/week @ 2024-02-10 174/week @ 2024-02-17 162/week @ 2024-02-24 235/week @ 2024-03-02

751 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–405KB