[][src]Trait float_cmp::ApproxEq

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 { ... }
}

A trait for approximate equality comparisons.

Associated Types

type Margin: Copy + Default

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.

Loading content...

Required methods

fn approx_eq<M: Into<Self::Margin>>(self, other: Self, margin: M) -> bool

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

Loading content...

Provided methods

fn approx_ne<M: Into<Self::Margin>>(self, other: Self, margin: M) -> bool

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

Loading content...

Implementations on Foreign Types

impl ApproxEq for f32[src]

type Margin = F32Margin

impl ApproxEq for f64[src]

type Margin = F64Margin

Loading content...

Implementors

Loading content...