Skip to main content

UlpFloat

Trait UlpFloat 

Source
pub trait UlpFloat: Copy {
    const MAX_ULP: u64;
    const SIGN_MASK: u64;

    // Required methods
    fn ulp_bits(self) -> u64;
    fn ulp_is_nan(self) -> bool;

    // Provided methods
    fn ulp_magnitude_bits(self) -> u64 { ... }
    fn ulp_is_sign_negative(self) -> bool { ... }
}
Expand description

Floating point types for which an integer ULP distance is defined.

Required Associated Constants§

Source

const MAX_ULP: u64

Largest distance representable for this type. Also the distance reported between a NaN and a non-NaN value.

Source

const SIGN_MASK: u64

Bit pattern of the sign bit, widened to u64.

Required Methods§

Source

fn ulp_bits(self) -> u64

Raw bit pattern, widened to u64.

Within a single sign, the bit patterns of finite floats are monotonic in magnitude, which is what makes the subtraction below meaningful.

Source

fn ulp_is_nan(self) -> bool

Provided Methods§

Source

fn ulp_magnitude_bits(self) -> u64

Bit pattern with the sign bit cleared, i.e. the bits of |self|.

Source

fn ulp_is_sign_negative(self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UlpFloat for f32

Source§

impl UlpFloat for f64

Implementors§