float_cmp

Trait Ulps

Source
pub trait Ulps {
    type U: Copy;

    // Required methods
    fn ulps(&self, other: &Self) -> <Self as Ulps>::U;
    fn next(&self) -> Self;
    fn prev(&self) -> Self;
}

Required Associated Types§

Required Methods§

Source

fn ulps(&self, other: &Self) -> <Self as Ulps>::U

The number of representable values or ULPs (Units of Least Precision) that separate self and other. The result U is an integral value, and will be zero if self and other are exactly equal.

Source

fn next(&self) -> Self

The next representable number above this one

Source

fn prev(&self) -> Self

The previous representable number below this one

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

Source§

type U = i32

Source§

fn ulps(&self, other: &f32) -> i32

Source§

fn next(&self) -> Self

Source§

fn prev(&self) -> Self

Source§

impl Ulps for f64

Source§

type U = i64

Source§

fn ulps(&self, other: &f64) -> i64

Source§

fn next(&self) -> Self

Source§

fn prev(&self) -> Self

Implementors§