pub trait ApproxEqUlps {
type Flt: Ulps;
// Required method
fn approx_eq_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool;
// Provided method
fn approx_ne_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool { ... }
}Expand description
ApproxEqUlps is a trait for approximate equality comparisons. The associated type Flt is a floating point type which implements Ulps, and is required so that this trait can be implemented for compound types (e.g. vectors), not just for the floats themselves.
Required Associated Types§
Required Methods§
Sourcefn approx_eq_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool
fn approx_eq_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool
This method tests for self and other values to be approximately equal
within ULPs (Units of Least Precision) floating point representations.
Differing signs are always unequal with this method, and zeroes are only
equal to zeroes. Use approx_eq() from the ApproxEq trait if that is more
appropriate.
Provided Methods§
Sourcefn approx_ne_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool
fn approx_ne_ulps(&self, other: &Self, ulps: <Self::Flt as Ulps>::U) -> bool
This method tests for self and other values to be not approximately
equal within ULPs (Units of Least Precision) floating point representations.
Differing signs are always unequal with this method, and zeroes are only
equal to zeroes. Use approx_eq() from the ApproxEq trait if that is more
appropriate.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ApproxEqUlps for f32
impl ApproxEqUlps for f32
Source§impl ApproxEqUlps for f64
impl ApproxEqUlps for f64
Implementors§
Source§impl ApproxEqUlps for FiniteF64
Available on crate feature approx-eq only.
impl ApproxEqUlps for FiniteF64
approx-eq only.Source§impl ApproxEqUlps for NonZeroPositiveF32
impl ApproxEqUlps for NonZeroPositiveF32
Source§impl ApproxEqUlps for NonZeroPositiveF64
Available on crate feature approx-eq only.
impl ApproxEqUlps for NonZeroPositiveF64
approx-eq only.Source§impl ApproxEqUlps for NormalizedF32
impl ApproxEqUlps for NormalizedF32
Source§impl ApproxEqUlps for NormalizedF64
Available on crate feature approx-eq only.
impl ApproxEqUlps for NormalizedF64
approx-eq only.Source§impl ApproxEqUlps for PositiveF32
impl ApproxEqUlps for PositiveF32
Source§impl ApproxEqUlps for PositiveF64
Available on crate feature approx-eq only.
impl ApproxEqUlps for PositiveF64
approx-eq only.