[][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);

Compare two arrays. Trait implemented for arrays of length 0-32:

assert!(0.1f64 - [42.0, 42.0f32, 1.001f32].max_diff([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]

impl MaxDifference for [f64; 0][src]

impl MaxDifference for [f32; 0][src]

impl MaxDifference for [f64; 1][src]

impl MaxDifference for [f32; 1][src]

impl MaxDifference for [f64; 2][src]

impl MaxDifference for [f32; 2][src]

impl MaxDifference for [f64; 3][src]

impl MaxDifference for [f32; 3][src]

impl MaxDifference for [f64; 4][src]

impl MaxDifference for [f32; 4][src]

impl MaxDifference for [f64; 5][src]

impl MaxDifference for [f32; 5][src]

impl MaxDifference for [f64; 6][src]

impl MaxDifference for [f32; 6][src]

impl MaxDifference for [f64; 7][src]

impl MaxDifference for [f32; 7][src]

impl MaxDifference for [f64; 8][src]

impl MaxDifference for [f32; 8][src]

impl MaxDifference for [f64; 9][src]

impl MaxDifference for [f32; 9][src]

impl MaxDifference for [f64; 10][src]

impl MaxDifference for [f32; 10][src]

impl MaxDifference for [f64; 11][src]

impl MaxDifference for [f32; 11][src]

impl MaxDifference for [f64; 12][src]

impl MaxDifference for [f32; 12][src]

impl MaxDifference for [f64; 13][src]

impl MaxDifference for [f32; 13][src]

impl MaxDifference for [f64; 14][src]

impl MaxDifference for [f32; 14][src]

impl MaxDifference for [f64; 15][src]

impl MaxDifference for [f32; 15][src]

impl MaxDifference for [f64; 16][src]

impl MaxDifference for [f32; 16][src]

impl MaxDifference for [f64; 17][src]

impl MaxDifference for [f32; 17][src]

impl MaxDifference for [f64; 18][src]

impl MaxDifference for [f32; 18][src]

impl MaxDifference for [f64; 19][src]

impl MaxDifference for [f32; 19][src]

impl MaxDifference for [f64; 20][src]

impl MaxDifference for [f32; 20][src]

impl MaxDifference for [f64; 21][src]

impl MaxDifference for [f32; 21][src]

impl MaxDifference for [f64; 22][src]

impl MaxDifference for [f32; 22][src]

impl MaxDifference for [f64; 23][src]

impl MaxDifference for [f32; 23][src]

impl MaxDifference for [f64; 24][src]

impl MaxDifference for [f32; 24][src]

impl MaxDifference for [f64; 25][src]

impl MaxDifference for [f32; 25][src]

impl MaxDifference for [f64; 26][src]

impl MaxDifference for [f32; 26][src]

impl MaxDifference for [f64; 27][src]

impl MaxDifference for [f32; 27][src]

impl MaxDifference for [f64; 28][src]

impl MaxDifference for [f32; 28][src]

impl MaxDifference for [f64; 29][src]

impl MaxDifference for [f32; 29][src]

impl MaxDifference for [f64; 30][src]

impl MaxDifference for [f32; 30][src]

impl MaxDifference for [f64; 31][src]

impl MaxDifference for [f32; 31][src]

impl MaxDifference for [f64; 32][src]

impl MaxDifference for [f32; 32][src]

Loading content...

Implementors

Loading content...