[][src]Trait ntest::MaxDifference

pub trait MaxDifference {
    fn max_diff(self, other: Self) -> f64;
}

Helper trait for assert_about_equal macro. Returns the max difference between two vectors of floats. Can also be used for single floats.

Examples

Compare two floating numbers:

assert!((0.1f64 - 42.1f32.max_diff(42.0f32)) < 1.0e-4f64);

Compare two vectors. Returns the maximum difference in the vectors. In this case ~0.1.:

assert!(0.1f64 - vec![42.0, 42.0f32, 1.001f32].max_diff(vec![42.0, 42.1f32, 1.0f32]) < 1.0e-4f64);

Required methods

fn max_diff(self, other: Self) -> f64

Loading content...

Implementations on Foreign Types

impl MaxDifference for f32[src]

impl MaxDifference for f64[src]

impl MaxDifference for Vec<f32>[src]

impl MaxDifference for Vec<f64>[src]

Loading content...

Implementors

Loading content...