pub enum Format {
Half,
BFloat16,
Single,
Double,
X87Extended,
Quad,
}Expand description
A binary floating point format.
Variants§
Half
IEEE binary16, which C spells _Float16.
BFloat16
The brain float, an IEEE binary32 with the low sixteen bits of its significand cut off,
which C spells __bf16. It has the range of a float and less than half its precision.
Single
IEEE binary32, which C spells float.
Double
IEEE binary64, which C spells double.
X87Extended
The x87 eighty bit format, which is long double on x86. It is the one format here that
stores the leading significand bit rather than leaving it implied.
Quad
IEEE binary128, which C spells _Float128, and which is long double on AArch64 Linux
and on RISC-V.
Implementations§
Source§impl Format
impl Format
Sourcepub const fn precision(self) -> u32
pub const fn precision(self) -> u32
The number of significand bits, counting the leading one whether it is stored or not.
Sourcepub const fn max_exponent(self) -> i32
pub const fn max_exponent(self) -> i32
The exponent of the largest finite number, which is also the exponent bias.
Sourcepub const fn min_exponent(self) -> i32
pub const fn min_exponent(self) -> i32
The exponent of the smallest normal number.
Sourcepub const fn width(self) -> u32
pub const fn width(self) -> u32
The width of the encoding in bits, which for x87 is the eighty bits that matter and not the ninety six or hundred and twenty eight an ABI pads them out to.
Sourcepub const fn has_explicit_integer_bit(self) -> bool
pub const fn has_explicit_integer_bit(self) -> bool
Whether the leading significand bit is stored rather than implied.