Trait ntest::MaxDifference

source ·
pub trait MaxDifference {
    // Required method
    fn max_diff(self, other: Self) -> f64;
}
Expand description

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§

source

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MaxDifference for f32

source§

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

source§

impl MaxDifference for f64

source§

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

source§

impl MaxDifference for Vec<f32>

source§

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

source§

impl MaxDifference for Vec<f64>

source§

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

source§

impl MaxDifference for [f32; 0]

source§

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

source§

impl MaxDifference for [f32; 1]

source§

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

source§

impl MaxDifference for [f32; 2]

source§

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

source§

impl MaxDifference for [f32; 3]

source§

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

source§

impl MaxDifference for [f32; 4]

source§

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

source§

impl MaxDifference for [f32; 5]

source§

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

source§

impl MaxDifference for [f32; 6]

source§

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

source§

impl MaxDifference for [f32; 7]

source§

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

source§

impl MaxDifference for [f32; 8]

source§

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

source§

impl MaxDifference for [f32; 9]

source§

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

source§

impl MaxDifference for [f32; 10]

source§

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

source§

impl MaxDifference for [f32; 11]

source§

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

source§

impl MaxDifference for [f32; 12]

source§

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

source§

impl MaxDifference for [f32; 13]

source§

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

source§

impl MaxDifference for [f32; 14]

source§

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

source§

impl MaxDifference for [f32; 15]

source§

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

source§

impl MaxDifference for [f32; 16]

source§

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

source§

impl MaxDifference for [f32; 17]

source§

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

source§

impl MaxDifference for [f32; 18]

source§

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

source§

impl MaxDifference for [f32; 19]

source§

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

source§

impl MaxDifference for [f32; 20]

source§

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

source§

impl MaxDifference for [f32; 21]

source§

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

source§

impl MaxDifference for [f32; 22]

source§

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

source§

impl MaxDifference for [f32; 23]

source§

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

source§

impl MaxDifference for [f32; 24]

source§

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

source§

impl MaxDifference for [f32; 25]

source§

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

source§

impl MaxDifference for [f32; 26]

source§

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

source§

impl MaxDifference for [f32; 27]

source§

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

source§

impl MaxDifference for [f32; 28]

source§

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

source§

impl MaxDifference for [f32; 29]

source§

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

source§

impl MaxDifference for [f32; 30]

source§

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

source§

impl MaxDifference for [f32; 31]

source§

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

source§

impl MaxDifference for [f32; 32]

source§

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

source§

impl MaxDifference for [f64; 0]

source§

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

source§

impl MaxDifference for [f64; 1]

source§

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

source§

impl MaxDifference for [f64; 2]

source§

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

source§

impl MaxDifference for [f64; 3]

source§

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

source§

impl MaxDifference for [f64; 4]

source§

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

source§

impl MaxDifference for [f64; 5]

source§

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

source§

impl MaxDifference for [f64; 6]

source§

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

source§

impl MaxDifference for [f64; 7]

source§

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

source§

impl MaxDifference for [f64; 8]

source§

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

source§

impl MaxDifference for [f64; 9]

source§

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

source§

impl MaxDifference for [f64; 10]

source§

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

source§

impl MaxDifference for [f64; 11]

source§

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

source§

impl MaxDifference for [f64; 12]

source§

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

source§

impl MaxDifference for [f64; 13]

source§

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

source§

impl MaxDifference for [f64; 14]

source§

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

source§

impl MaxDifference for [f64; 15]

source§

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

source§

impl MaxDifference for [f64; 16]

source§

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

source§

impl MaxDifference for [f64; 17]

source§

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

source§

impl MaxDifference for [f64; 18]

source§

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

source§

impl MaxDifference for [f64; 19]

source§

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

source§

impl MaxDifference for [f64; 20]

source§

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

source§

impl MaxDifference for [f64; 21]

source§

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

source§

impl MaxDifference for [f64; 22]

source§

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

source§

impl MaxDifference for [f64; 23]

source§

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

source§

impl MaxDifference for [f64; 24]

source§

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

source§

impl MaxDifference for [f64; 25]

source§

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

source§

impl MaxDifference for [f64; 26]

source§

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

source§

impl MaxDifference for [f64; 27]

source§

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

source§

impl MaxDifference for [f64; 28]

source§

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

source§

impl MaxDifference for [f64; 29]

source§

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

source§

impl MaxDifference for [f64; 30]

source§

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

source§

impl MaxDifference for [f64; 31]

source§

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

source§

impl MaxDifference for [f64; 32]

source§

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

Implementors§