Inside the ComputerComputer Arithmetic
0.1 + 0.2 ≠ 0.3
Computers get simple decimal sums slightly wrong
Ask most programming languages to add 0.1 and 0.2, and the answer isn't exactly 0.3. Nothing's broken. So what's going on?
You'll find out
- Why a computer can't write 0.1
- Where the tiny error sneaks in
- How careful code dodges the trap
Why it matters
It lurks in most software doing decimal math, from games to spreadsheets, and it's why money is often kept in cents.
Play this lesson
Free to play in your browser or on iPhone