9 releases

Uses old Rust 2015

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

#2815 in Rust patterns

Download history 141/week @ 2024-01-05 172/week @ 2024-01-12 124/week @ 2024-01-19 123/week @ 2024-01-26 118/week @ 2024-02-02 162/week @ 2024-02-09 160/week @ 2024-02-16 165/week @ 2024-02-23 241/week @ 2024-03-01 226/week @ 2024-03-08 180/week @ 2024-03-15 187/week @ 2024-03-22 214/week @ 2024-03-29 172/week @ 2024-04-05 190/week @ 2024-04-12 237/week @ 2024-04-19

846 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