Lab · c06.s01.L1

Float bit inspector

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?

Float bit inspectorA 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.Float bit inspectorIEEE 754 binary32: 1 sign bit, 8 exponent bits, 23 fraction bits, bias 127value = (-1)^sign * (1 + fraction_integer / 2^23) * 2^(exponent_field - 127)SignExponent - 8 bitsFraction - 23 bits313029282726252423222120191817161514131211109876543210bit 31 leftmost, bit 0 rightmost00111101110011001100110011001101TYPED DECIMAL0.1STORED VALUE 0x3DCCCCCD0.10000000149011612nearest patternabsolute gap 1.4901161193847657e-09relative gap 1.4901161193847656e-08spacing to next float 7.450580596923828e-09DECODESign 0 -> positiveExponent 01111011 = 123123 - 127 = -4, so the scale is 2^-4Fraction 10011001100110011001101hidden 1 -> 1.10011001100110011001101= 1.600000023841858 x 0.0625exact expansion 0.100000001490116119384765625Not exact: the decimal needs more than 24 significant bits, so the format stores the nearestpattern; compare it with the number you typed.
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.
Lab controls
0.1

Arrow keys step through the 16 samples one notch at a time; Home and End pick the first (-2.5) and the last (1e38).

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.

Return to the section that hosts this lab

Caption status: re-simulated. Every lab declares one of published, re-simulated, schematic, synthetic or interpolated.