9 releases

Uses old Rust 2015

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

#2458 in Rust patterns

Download history 183/week @ 2024-11-14 230/week @ 2024-11-21 280/week @ 2024-11-28 347/week @ 2024-12-05 328/week @ 2024-12-12 178/week @ 2024-12-19 112/week @ 2024-12-26 170/week @ 2025-01-02 181/week @ 2025-01-09 194/week @ 2025-01-16 237/week @ 2025-01-23 204/week @ 2025-01-30 288/week @ 2025-02-06 237/week @ 2025-02-13 363/week @ 2025-02-20 151/week @ 2025-02-27

1,073 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–690KB
~14K SLoC