Crate nearly_eq0.1.0 [] [src]

Trait for nearly equality comparisons.

Overview

Implementing the NearlyEq traits, Can asserts that the two expressions are nearly(approximately) equal to each other.

Licensing

This Source Code is subject to the terms of the Mozilla Public License version 2.0 (the "License"). You can obtain a copy of the License at http://mozilla.org/MPL/2.0/.

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

Macros

assert_nearly_eq

Asserts that two expressions are nearly(approximately) equal to each other.

debug_assert_nearly_eq

Asserts that two expressions are nearly(approximately) equal to each other.

Traits

NearlyEq

Trait for nearly(approximately) equality comparisons.