Take the 2-minute tour ×

Based on the IEEE-754 Single Precision standard, how can I know how many normalized numbers can be represented if I know the following:

1 bit for the Sign

8 bits for the exponent

23 bits for the mantissa

Is there a rule that can be applied to any other system of floating-point?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You've identified the number of bits for each portion of the representation, so you're already halfway there. There are:

  • 2^1 = 2 possibilities for the sign
  • 2^8 = 256 possibilities for the exponent bits, of which two are reserved for non-normals: an exponent field of all zeros is used for floating-point zeros and subnormals, while an exponent field of all ones is used for infinities and nans
  • 2^23 = 8388608 possibilities for the mantissa (note that 'significand' is generally the preferred term).

Multiplying, that gives 2 * 2^23 * (2^8 - 2), or equivalently 2^32 - 2^25, possibilities altogether. So there are 2^32 - 2^25 = 4261412864 distinct normal numbers in the IEEE 754 binary32 format. The two zeros are not, technically, normal numbers, but if you wanted to include them in the count you'd get 2^32 - 2^25 + 2 instead.

And yes, this generalises directly to all the other IEEE 754 binary interchange formats. I'll leave it to you to find the numbers for double precision, half precision, quadruple precision etc.

Just for fun, here's a complete breakdown:

  • 2 zeros (sign 0 or 1, exponent and significand fields zero)

  • 2^24 - 2 subnormal numbers (sign 0 or 1, exponent field zero, significand field nonzero)

  • 2^32 - 2^25 normal numbers (as above)

  • 2 infinities (sign 0 or 1, exponent field all ones, significand field zero)

  • 2^23 - 2 signaling NaNs (sign 0 or 1, exponent field all ones, significand field nonzero but with zero first bit)

  • 2^23 quiet NaNs (sign 0 or 1, exponent field all ones, significand field has 1 as first bit)

share|improve this answer

Your Answer


