#assert #array

nearly_eq

Nearly(Approximately) equal traits and assertion

9 releases

Uses old Rust 2015

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

#52 in #assert

Download history 351/week @ 2022-08-11 777/week @ 2022-08-18 514/week @ 2022-08-25 348/week @ 2022-09-01 536/week @ 2022-09-08 660/week @ 2022-09-15 262/week @ 2022-09-22 401/week @ 2022-09-29 527/week @ 2022-10-06 599/week @ 2022-10-13 375/week @ 2022-10-20 481/week @ 2022-10-27 506/week @ 2022-11-03 401/week @ 2022-11-10 459/week @ 2022-11-17 229/week @ 2022-11-24

1,695 downloads per month
Used in fewer than 9 crates

MPL-2.0 license

20KB
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–395KB