IEEE 754 for floating point numbers

Commonly used format for floating point numbers

signexponent (binary - excess-127)fraction
32 bits0=+ve 1=-ve832
64 bits0=+ve 1=-ve1152

Example

  1. 39.625 (decimal)
  2. -100111.101 (binary)
  3. -1.0011101 x 2^5 (normalized binary)
    • sign bit = 1
    • exponent bit = 5 + 127 = 132 = 1000 0100
    • fraction bit = 0011 1101 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

Here we use excess-127 because we want to support negative exponents.

Using 127 allows us to do a comparison on them by natural ordering.