Crate appro_eq0.1.0 [] [src]

Trait for approximately equality comparisons.

Overview

Implementing the ApproEq traits, Can asserts that the two expressions are 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_appro_eq!(1f64, 1.5f64, 0.6f64); // does not panic
assert_appro_eq!(0f64, 1e-12f64); // does not panic
assert_appro_eq!(vec![0f64, 1.0, 0.0], vec![1e-12f64, 1.0, -1e-13f64]); // does not panic
assert_appro_eq!(1f64, 2f64); // panics

Macros

assert_appro_eq

Asserts that two expressions are approximately equal to each other.

assert_appro_eq_abs

Asserts that the absolute error of the two expressions is small enough.

assert_appro_eq_rel

Asserts that the relative error of the two expressions is small enough.

debug_assert_appro_eq

Asserts that two expressions are approximately equal to each other.

debug_assert_appro_eq_abs

Asserts that the absolute error of the two expressions is small enough.

debug_assert_appro_eq_rel

Asserts that the relative error of the two expressions is small enough.

Enums

ApproEqError

Traits

AbsApproEq

Trait for approximately equality comparisons.

AbsApproEqWithTol

Trait for approximately equality comparisons.

AbsError
RelApproEq

Trait for approximately equality comparisons.

RelApproEqWithTol

Trait for approximately equality comparisons.

RelError
Tolerance