Labs / Computer Science
Floating-Point Bits
Every number in a computer is just a pattern of bits. Click the boxes to flip the sign, exponent, and mantissa, or type a target and let it snap to the nearest float it can actually store. Watch where the value lands on the number line — the representable points bunch up near zero and spread apart as they grow.
value 0.5gap —error —
What to try
- Snap to 0.1 in half precision. Why is the stored value not exactly 0.1, and what does the error readout say?
- Flip a single exponent bit versus a single mantissa bit. Which one changes the value more, and by how much?
- Drag the value out to 8, then back to near zero. What happens to the gap between neighbouring floats?
- Switch from half to single precision on the same target. How much smaller does the rounding error get, and why?
- Set every exponent bit to 1. Can you make the value show ∞, and then nudge it into NaN?