Crate float_bits

Crate float_bits 

Source
Expand description

Floats stored as raw bits, making them hashable and totally ordered.

The types in this crate represent IEEE 754 binary floating point numbers, using unsigned integers to store the raw bits of the floats. Some of these types represent float formats not supported by Rust, or only if specific Rust features are available and enabled. A limited suite of operations are available that operate directly on the raw bit representation, bypassing the need for Rust support.

§Example


let x: f64 = 0.1;
let y: F64 = x.into();
let z: f64 = y.into();
assert_eq!(x, z);
assert_eq!(0x3fb999999999999a, y.to_bits());

Structs§

BF16
A newtype containing the raw bits of a Google BFloat16 floating point number.
F16
A newtype containing the raw bits of an IEEE 754 binary16 floating point number.
F32
A newtype containing the raw bits of an IEEE 754 binary32 floating point number.
F64
A newtype containing the raw bits of an IEEE 754 binary64 floating point number.
F128
A newtype containing the raw bits of an IEEE 754 binary128 floating point number.