[prev] 68 [next]

Floating Point Numbers (cont)

Example (single-precision):

150.75 = 10010110.11
         // normalise fraction, compute exponent
       = 1.001011011 × 27
         // determine sign bit,
         // map fraction to 24 bits,
         // map exponent relative to baseline
       = 0100000110001011011000000000000000

where red is sign bit, green is exponent, blue is fraction

Note: B=127, e=27, so exponent = 127+7 = 134 = 10000110