Skip to main content

micro_float

Function micro_float 

Source
pub(crate) fn micro_float(
    code: u32,
    exp_bits: u32,
    man_bits: u32,
    bias: i32,
    has_inf: bool,
    nan_at_max: bool,
) -> f64
Expand description

Decodes an OCP micro-float code (sign|exponent|mantissa, LSB→MSB) to f64.

has_inf: all-ones exponent is infinity (mantissa 0) or NaN (e5m2). nan_at_max: all-ones exponent AND mantissa is NaN but other max-exponent patterns are normal (e4m3). When neither is set (e2m1, float6) the max exponent is an ordinary normal value.