Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You've identified the number of bits for each portion of the representation, so you're already halfway there. There are:</p> <ul> <li>2^1 = 2 possibilities for the sign</li> <li>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</li> <li>2^23 = 8388608 possibilities for the mantissa (note that 'significand' is generally the preferred term).</li> </ul> <p>Multiplying, that gives <code>2 * 2^23 * (2^8 - 2)</code>, or equivalently <code>2^32 - 2^25</code>, possibilities altogether. So there are <code>2^32 - 2^25 = 4261412864</code> 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 <code>2^32 - 2^25 + 2</code> instead.</p> <p>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.</p> <hr> <p>Just for fun, here's a complete breakdown:</p> <ul> <li><p>2 zeros (sign 0 or 1, exponent and significand fields zero)</p></li> <li><p>2^24 - 2 subnormal numbers (sign 0 or 1, exponent field zero, significand field nonzero)</p></li> <li><p>2^32 - 2^25 normal numbers (as above)</p></li> <li><p>2 infinities (sign 0 or 1, exponent field all ones, significand field zero)</p></li> <li><p>2^23 - 2 signaling NaNs (sign 0 or 1, exponent field all ones, significand field nonzero but with zero first bit)</p></li> <li><p>2^23 quiet NaNs (sign 0 or 1, exponent field all ones, significand field has 1 as first bit)</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload