The 32 bits are the number: one sign bit, eight exponent bits stored against the bias 127, and twenty-three fraction bits under a hidden leading 1.
Question: How is a decimal number stored in 32 bits?
Re-simulated Re-simulated: every bit pattern is computed by data/scripts/c06.s01.L1.py with IEEE 754 binary32; the values are exact encodings, not measurements. Sixteen frames draw the 32 cells for one decimal sample each, from -2.5 to 1e38, with the sign, the biased exponent and the fraction decoded, the stored value beside the typed one, and the gap and the spacing to the next float.
Frame 1 of 1: 0.1: field 123 gives 2^-4The exponent field 01111011 is 123, so 123 - 127 = -4 and the scale is 2^-4. The fraction 10011001100110011001101 holds 13421773, that is 1 + 5033165/2^23 = 1.600000023841858, and the stored value is 0.10000000149011612, not 0.1. The gap is 1.4901161193847657e-09, which is 0.25 of the unit roundoff u, and the next float up is 0.10000000894069672.
0.1: field 123 gives 2^-4. The exponent field 01111011 is 123, so 123 - 127 = -4 and the scale is 2^-4. The fraction 10011001100110011001101 holds 13421773, that is 1 + 5033165/2^23 = 1.600000023841858, and the stored value is 0.10000000149011612, not 0.1. The gap is 1.4901161193847657e-09, which is 0.25 of the unit roundoff u, and the next float up is 0.10000000894069672.
Keyboard: Space plays or pauses, Left and Right step, Home goes to the first frame, End goes to the last frame.
Text description of this lab
A strip of 32 bit cells splits into one navy sign cell, eight russet exponent cells and twenty-three gold fraction cells; each cell shows its bit and its index. A panel decodes the selected number: the exponent field minus 127 gives the power of two, and the fraction under a hidden 1 gives the significand. At 0.1 the strip reads 00111101110011001100110011001101 and stores 0.10000000149011612, while 16777216.0 and 16777217.0 share one word.