Search code examples
floating-pointdoubleieee-754

Why is the exponent part of floating number so complicated?


I'm studying now how floating number is implemented in modern computers. https://en.wikipedia.org/wiki/Single-precision_floating-point_format

I understand that a floating number is represented via three components: sign, exponent, and fraction.

The sign part is super easy since that represents whether the number is positive or negative using one bit. If 8 bits are assigned to the exponent part, why the interpretation would be 2^{x - 127} rather than simple 2^{x}?


Solution

  • It's the fastest way to compare both positive and negative exponents.

    You have more information here.