float_cmp

Trait ApproxEqRatio

Source
pub trait ApproxEqRatio:
    Div<Output = Self>
    + Sub<Output = Self>
    + Neg<Output = Self>
    + PartialOrd
    + Zero
    + Sized
    + Copy {
    // Provided methods
    fn approx_eq_ratio(&self, other: &Self, ratio: Self) -> bool { ... }
    fn approx_ne_ratio(&self, other: &Self, ratio: Self) -> bool { ... }
}
Expand description

ApproxEqRatio is a trait for approximate equality comparisons bounding the ratio of the difference to the larger.

Provided Methods§

Source

fn approx_eq_ratio(&self, other: &Self, ratio: Self) -> bool

This method tests if self and other are nearly equal by bounding the difference between them to some number much less than the larger of the two. This bound is set as the ratio of the difference to the larger.

Source

fn approx_ne_ratio(&self, other: &Self, ratio: Self) -> bool

This method tests if self and other are not nearly equal by bounding the difference between them to some number much less than the larger of the two. This bound is set as the ratio of the difference to the larger.

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 ApproxEqRatio for f32

Source§

impl ApproxEqRatio for f64

Implementors§