-1

I'm trying to understand what a subnormal number is and I'm guessing the exponent is fixed at -127 and to make the number smaller the implicit 1 is replaced with an implicit 0. Does this sound right?

1 Answers1

1

In the IEEE-754 basic 32-bit binary format, the exponent for a subnormal number is −126, not −127. The leading bit of the significand is indeed zero.

For any of the IEEE-754 binary formats, let:

  • p be the number of bits in the full significand (“p” for precision, 24 for the 32-bit format), bias be the bias used for encoding the exponent (127 for the 32-bit format), and
  • S be the bit in the sign field, E be the bits in the exponent field, and T be the bits in the trailing significand field.

If E is not all zeros or all ones, the value represented is a normal number. Its value is (−1)S•2Ebias•(1+21−p•T). That term 1+21−p•T may be pictured as a one bit followed by a radix point followed by the bits of T: “1.T”.

If E is all zeros, the value represented is zero (if T is zero) or a subnormal number. Its value is (−1)S•21−bias•(0+21−p•T). Note two changes from the normal value: The exponent is 1−bias instead of Ebias, and the leading bit is 0 instead of 1.

Note the smallest normal values and the subnormal values have an exponent of 1-bias, which is 1−127 = −126 for the 32-bit format. When transitioning from normal values to subnormal values, we do not change both the exponent and the leading bit, because that would cause a jump in the representable values. So the subnormal values have the same exponent as the smallest normal values; just the leading bit changes.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312