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.

About 3 min6 interactive slides · 5 questionsLesson 11 · Zone 2

Play this lesson

Free to play in your browser or on iPhone

More in this zone

  1. 10ProbabilityThe Monty Hall TrapSwitching doors doubles your chance of winning the car
  2. 12Digital PrivacyYour Photos Know Where You LiveMany phone photos carry hidden GPS coordinates
  3. 13Digital MediaMovies Don't MoveFilms are still pictures shown fast enough to fool you
  4. 14Social EngineeringThe Phishing HookThe most dangerous hack attacks your judgment, not your computer
  5. 15CombinatoricsYour Shuffle Has Never Happened BeforeA well-shuffled deck is almost certainly a first in history
  6. 16Artificial IntelligenceConfidently WrongAI can sound certain while inventing an answer
  7. 17Color PerceptionThe DressYour brain guesses the lighting before deciding what color it sees
  8. 18Software HistoryGangnam Style Broke YouTube's CounterA video got more views than the counter could count