Trait approx::ApproxEq [] [src]

pub trait ApproxEq: Sized {
    type Epsilon;
    fn default_epsilon() -> Self::Epsilon;
    fn default_max_relative() -> Self::Epsilon;
    fn default_max_ulps() -> u32;
    fn relative_eq(
        &self,
        other: &Self,
        epsilon: Self::Epsilon,
        max_relative: Self::Epsilon
    ) -> bool; fn ulps_eq(
        &self,
        other: &Self,
        epsilon: Self::Epsilon,
        max_ulps: u32
    ) -> bool; fn relative_ne(
        &self,
        other: &Self,
        epsilon: Self::Epsilon,
        max_relative: Self::Epsilon
    ) -> bool { ... } fn ulps_ne(
        &self,
        other: &Self,
        epsilon: Self::Epsilon,
        max_ulps: u32
    ) -> bool { ... } }

Equality comparisons based on floating point tolerances.

Associated Types

Used for specifying relative comparisons.

Required Methods

The default tolerance to use when testing values that are close together.

This is used when no epsilon value is supplied to the relative_eq or ulps_eq macros.

The default relative tolerance for testing values that are far-apart.

This is used when no max_relative value is supplied to the relative_eq macro.

The default ULPs to tolerate when testing values that are far-apart.

This is used when no max_relative value is supplied to the relative_eq macro.

A test for equality that uses a relative comparison if the values are far apart.

A test for equality that uses units in the last place (ULP) if the values are far apart.

Provided Methods

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

Implementors