Skip to main content

fp64_unpack

Function fp64_unpack 

Source
pub fn fp64_unpack(b: &CircuitBuilder, x: Wire) -> Fp64Parts
Expand description

Unpack and classify a binary64 word.

Input:

  • x: 64-bit IEEE-754 encoding

Output:

  • Fp64Parts with fields:
    • sign: MSB-bool of sign bit (i.e., x & (1<<63), either 0 or 0x8000..)
    • exp = (x >> 52) & 0x7FF
    • frac = x & ((1<<52)-1)
    • is_nan: exp==0x7FF && frac!=0
    • is_inf: exp==0x7FF && frac==0
    • is_zero: exp==0 && frac==0
    • is_sub: exp==0 && frac!=0
    • is_norm: exp!=0 && exp!=0x7FF

All booleans are in MSB-bool format.