Search code examples
floating-pointstandards

Why do we use 2 bits at the start of a floating point number?


So normalized floating point numbers are always stored with the leading digits as 10 or 01, why do we store this with 2 separate digits if it will only ever take one of two states which could be represented with one bit?


Solution

  • Regarding both the Single-precision (32-bit) or the Double-precision (64-bit) that are the most common standards, none of them uses those two first bits always in the exact combination you mentioned. It depends on the number.

    In both the first bit stores the sign of the number which can have both 0 and 1 values, while the next bit is the most significant bit of the exponent which can also have 0 or 1 value depending on the exact number.

    To illustrate the usage of those bits here are the patterns of the floating point numbers structure:

    - Single-precision:

    Single-precision structure

    - Double-precision:

    Double-precision structure

    Check out some info about floating point numbers: Single-precision and Double-precision