Trait float_cmp::ApproxEq[][src]

pub trait ApproxEq: Sized {
    type Margin: Copy + Default;
    fn approx_eq<M: Into<Self::Margin>>(self, other: Self, margin: M) -> bool;

    fn approx_ne<M: Into<Self::Margin>>(self, other: Self, margin: M) -> bool { ... }
}
Expand description

A trait for approximate equality comparisons.

Associated Types

This type type defines a margin within which two values are to be considered approximately equal. It must implement Default so that approx_eq() can be called on unknown types.

Required methods

This method tests that the self and other values are equal within margin of each other.

Provided methods

This method tests that the self and other values are not within margin of each other.

Implementors