The Hidden Bit Trick

The hidden bit trick, also called the implicit bit trick, is a clever optimization used in the IEEE 754 standard for representing numbers in binary. It reduces memory usage by omitting the leading bit of the significand (also called the mantissa) when it is guaranteed to be 1. This trick gives us one extra bit of precision for free.

Recall from the introduction to floating point numbers that an IEEE 754 double-precision floating point number is represented as:

That leading is always there, so instead of wasting a bit to store it, we simply assume it is there and only store the bits after the decimal point. This trick effectively gives us an extra bit of precision for free!

Subnormal numbers

The special case where the exponent is all zeros after biasing is used to represent subnormal numbers which are very close to zero. In this case, the number is interpreted as

Notice that we use the smallest possible exponent, which is actually and not , since we need to be able to smoothly "float" to successive intervals that are not subnormal. Also notice that the leading digit of the fraction is and not , to avoid a sudden jump to zero in representable numbers.

Was this page helpful?