How One Line of Code Caused the Most Expensive Software Bug in History

2026-04-02T04:10:50.804Z·4 min read
2. Lack of testing: - The overflow condition was never tested (it doesn't occur on Ariane 4) - No simulation tested velocities above 32,767 - The specific code path that failed was considered "unli...

How One Line of Code Caused the Most Expensive Software Bug in History

On June 4, 1996, the European Space Agency's Ariane 5 rocket exploded 37 seconds after launch due to a single line of code that attempted to convert a 64-bit floating-point number to a 16-bit signed integer. The cost: $500 million. The rocket, its payload of 4 scientific satellites, and years of development were destroyed in a fireball over French Guiana because of a data type conversion error that could have been fixed with one additional line of code.

The Bug

What happened:

The one line of code:

// Ariane 5 tried to do this:
int16_t velocity = (int16_t)horizontal_velocity_64bit;
// horizontal_velocity_64bit = 37250 (exceeds int16 max of 32767)
// Result: velocity = -28286 (overflow)
// Navigation computer: negative velocity = failure = SHUTDOWN

The fix (never implemented):

// What they should have done:
if (horizontal_velocity_64bit > 32767) {
    // Handle the overflow case
} else {
    int16_t velocity = (int16_t)horizontal_velocity_64bit;
}

Why It Happened

1. Code reuse without analysis:

2. Lack of testing:

3. Overconfidence in reused code:

4. Documentation failure:

The Aftermath

Financial impact:

Industry impact:

Lessons learned:

Other Expensive Single-Line Bugs

Therac-25 (1985-1987):

Knight Capital (2012):

Heartbleed (2014):

Cloudbleed (2017):

The Takeaway

One line of code destroyed a $500 million rocket. Not because the line was complex — it was a simple type conversion — but because no one questioned whether code written for one system (Ariane 4) was appropriate for another (Ariane 5). The Ariane 5 disaster teaches the most important lesson in software engineering: code reuse saves time but creates invisible assumptions. Every line of reused code carries the assumptions of its original context, and those assumptions become landmines when the context changes. The $500 million bug wasn't a failure of coding — it was a failure of questioning.

← Previous: Why Lightning Kills More People in Africa Than Any Other ContinentNext: Why the Dead Sea Is Dying and What Happens When It Disappears →
Comments0