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
You've identified the number of bits for each portion of the representation, so you're already halfway there. There are:
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)