DEV Community

Cover image for When Floating-Point Failed Catastrophically
Cfir Aguston
Cfir Aguston

Posted on

When Floating-Point Failed Catastrophically

IEEE-754 gave us a common way to handle decimals on computers. But even with a standard, tiny numeric mistakes can grow into big failures. Here are four famous ones.

1) The Patriot Missile Failure (1991)
A U.S. Patriot missile system failed to intercept an Iraqi Scud missile, killing 28 soldiers. The software tracked time in tenths of a second but stored it as an integer.
To convert it into seconds, the code used a floating-point calculation that wasn’t exact. Over 100 hours of operation, the tiny rounding error accumulated into a 0.34-second drift, enough for the missile to miss its target.

2) The Pentium FDIV Bug (1994)
Intel’s Pentium had a flaw in its floating-point division hardware. A few entries in a lookup table were missing, so certain divisions returned slightly wrong answers (often far out in the decimal places). For most users it was rare, but for scientists and finance it had influence. After public pressure, Intel replaced affected chips and took a huge loss.

3) Ariane 5 Flight 501 (1996)
Ariane 5 reused code from Ariane 4. During flight, a 64-bit floating value (horizontal velocity) was converted to a 16-bit integer and overflowed. The guidance system crashed, the backup did the same, and the rocket self-destructed 37 seconds after launch.

4) Vancouver Stock Exchange Index (1980s)
The index was updated after each trade, but the value was truncated to three decimals every time. Tiny losses stacked up. Over many updates, the index drifted down—far from reality. When they fixed the math and recalculated with more precision, the index jumped back to where it should have been.

What engineers should remember:

  • Precision, rounding and overflow are design choices, not footnotes.
  • Long-running systems amplify tiny numeric errors.
  • Reused code must be re-validated for new data ranges.
  • In safety-critical and financial systems, prove the math, don’t assume it.

You can read the full story, including technical details and lessons, here:
When Floating-Point Failed Catastrophically

Top comments (0)