Reputation: 35453
I'm trying to figure out some specifics of using a normalized representation for floating-point values.
As I understand, the IEEE-754 representation works like:
1.{significand} * 2^{exponent}
For single precision, the significand being 24 bits, the exponent being 8 bits.
What I'm trying to break this down to is essentially the number of "slots" available in each range of numbers supported by the exponent, such as:
[Exponent=0] 0.0 - 1.0 : 2^23 values
[Exponent=1] 1.0 - 2.0 : 2^23 values
[Exponent=2] 2.0 - 4.0 : 2^23 values
[Exponent=3] 4.0 - 8.0 : 2^23 values
I'm trying to demonstrate that in using quantisation if the range I'm interested in is limited to 0.0 - 1.0, I can use 2^24 bits to represent this number and there will be no loss of precision in removing the exponent and this can be easily converted to a full floating-point representation. Also, to clearly illustrate the greater precision closer to zero than further away when using floating-point, as it feels like this may be quite intuitive to understand.
One area in particular that I'm not quite clear on is where the supported exponent is -127 to 126, how does the negative portion work? 1.5 * 2^-1 clearly overlaps with the 0.0 - 1.0 range.
Finally, I know that one of the bits in the significand is used for the sign, however what does the hidden bit represent, does this affect the number of "slots" that are available in each range?
Upvotes: 3
Views: 1475
Reputation: 17114
Your table is wrong, I think. It should be:
.... [Exponent=-3] 0.125 - 0.25 : 223 values [Exponent=-2] 0.25 - 0.5 : 223 values [Exponent=-1] 0.5 - 1.0 : 223 values [Exponent=0] 1.0 - 2.0 : 223 values [Exponent=1] 2.0 - 4.0 : 223 values [Exponent=2] 4.0 - 8.0 : 223 values ....
Or more precisely:
.... [Exponent=-3] 0.125 ≤ x < 0.25 : 223 values [Exponent=-2] 0.25 ≤ x < 0.5 : 223 values [Exponent=-1] 0.5 ≤ x < 1.0 : 223 values [Exponent=0] 1.0 ≤ x < 2.0 : 223 values [Exponent=1] 2.0 ≤ x < 4.0 : 223 values [Exponent=2] 4.0 ≤ x < 8.0 : 223 values ....
Upvotes: 3