Skip to main content

FloatBits

Trait FloatBits 

Source
pub trait FloatBits:
    Copy
    + PartialEq
    + Debug
    + Display {
    type Bits: Copy + Eq + Hash;

    // Required methods
    fn to_bits(self) -> Self::Bits;
    fn is_finite(self) -> bool;
    fn zero() -> Self;
}
Expand description

A float type whose bit representation can stand in for PartialEq/Eq/Hash.

Implemented for the IEEE-754 types that need to be used as comptime kernel parameters: two values are equal iff their bit patterns are equal, so -0.0 is normalized to 0.0 since they are numerically equal.

Required Associated Types§

Source

type Bits: Copy + Eq + Hash

The unsigned integer type with the same width as Self.

Required Methods§

Source

fn to_bits(self) -> Self::Bits

The bit pattern of this value.

Source

fn is_finite(self) -> bool

Whether this value is neither infinite nor NaN.

Source

fn zero() -> Self

Positive zero, used to normalize away the sign of zero.

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 FloatBits for bf16

Source§

type Bits = u16

Source§

fn to_bits(self) -> u16

Source§

fn is_finite(self) -> bool

Source§

fn zero() -> Self

Source§

impl FloatBits for f16

Source§

type Bits = u16

Source§

fn to_bits(self) -> u16

Source§

fn is_finite(self) -> bool

Source§

fn zero() -> Self

Source§

impl FloatBits for f32

Source§

type Bits = u32

Source§

fn to_bits(self) -> u32

Source§

fn is_finite(self) -> bool

Source§

fn zero() -> Self

Source§

impl FloatBits for f64

Source§

type Bits = u64

Source§

fn to_bits(self) -> u64

Source§

fn is_finite(self) -> bool

Source§

fn zero() -> Self

Implementors§