IEEE-754 Floating Point (32-Bit)
Sign (1)0
Exponent (8)01111011
Mantissa (23)10011001100110011001101
Exact Stored Float320.100000001
32-Bit Hex0x3DCCCCCD
Quick Float Examples
Rounding Error1.49e-9
Parameters
IEEE-754 Floating Point (32-Bit)
FLOAT32Computers store decimal numbers like 0.1 or โ12.5 in scientific binary notation: 1 Sign bit, 8 Exponent bits, and 23 Mantissa bits. That is why 0.1 + 0.2 !== 0.3 in almost every programming language!
Whiteboard Solver Steps
Step 1
1. IEEE-754 32-Bit Float Layout
1 Sign bit + 8 Exponent bits (bias 127) + 23 Mantissa fraction bits store huge & tiny numbers in 4 bytes.
Step 2
2. Why Floating-Point Rounding Happens
Numbers like `0.1` repeat infinitely in base-2 binary, so 23 mantissa bits round to the nearest representable float!