Skip to main content

steel_math/
float_consts.rs

1//! IEEE 754 binary32 layout constants
2
3/// Total bit width of an `f32`
4pub const SIZE: i32 = u32::BITS as i32;
5/// Significand width including the implicit bit
6pub const SIGNIFICAND_WIDTH: i32 = f32::MANTISSA_DIGITS as i32;
7/// Bias applied to the stored exponent
8pub const EXP_BIAS: i32 = f32::MAX_EXP - 1;
9/// Mask for the stored exponent bits
10pub const EXP_BIT_MASK: i32 = ((1 << (SIZE - SIGNIFICAND_WIDTH)) - 1) << (SIGNIFICAND_WIDTH - 1);
11/// Mask for the fraction bits, excluding the implicit bit
12pub const SIGNIF_BIT_MASK: i32 = (1 << (SIGNIFICAND_WIDTH - 1)) - 1;