Tech●●●●●Difficulty 3 of 5

How did a number too big for its box blow up a rocket?

In 1996 Europe's new rocket destroyed itself because one number didn't fit in 16 bits.

▶ Start the story

Every number in a computer lives in a box of a fixed size, and a type system is the set of rules about what goes in which box. It associates a data type, such as , or string, with each value in a program, and its main purpose is to reduce bugs caused by mismatches in how values are interpreted in different parts of a program. On 4 June 1996 the first flight of Europe's Ariane 5 rocket showed what happens when a number does not fit its box. About 30 seconds after lift-off, the rocket lost its guidance information completely and was destroyed.

You already know the problem from an odometer. A car's counter with six digits shows 999999, and one more kilometer makes the result invalid, because there is nowhere to put the seventh digit. Programmers call this an : an arithmetic operation tries to create a value outside the range that fits in the space allocated for it.

On Ariane 5, the guidance software converted a 64-bit number into a 16-bit signed . The number was greater than a 16-bit signed integer can represent, and the conversion failed. The software had been reused from Ariane 4, but Ariane 5 builds up horizontal velocity five times more rapidly, so values appeared that Ariane 4 never produced. Worse, the specification said that any should shut down the guidance computer, and that shutdown proved fatal: the same software ran in both units, so both stopped. The failure became known as one of the most infamous and expensive software bugs in history, with a loss of more than US$370 million.

US$370M+

lost when Ariane 5 Flight 501 failed

The lesson is that a type tells you the shape of the box, not whether tomorrow's values will fit. The inquiry's analysis said the ranges of variables should have been spelled out, but a 16-bit range was simply assumed.

Quiz me

0/3

  1. 1.What is the main purpose of a type system?
  2. 2.Why did software that worked on Ariane 4 fail on Ariane 5?
  3. 3.Why did one overflow end up disabling the whole guidance system?

Recap

A type describes the shape of a value's box, so always ask whether tomorrow's values will still fit.

💡 A trick to remember it · Types label the boxes, but a rocket can still stuff a bigger number into a smaller box.

Surprising fact · Ariane 5's failure came from converting a 64-bit floating point number into a 16-bit integer.

Sources (6)

No source, no claim. Every fact in this lesson (17 claims) cites at least one of these.

  1. [1]Type system · Wikipedia
  2. [2]Integer overflow · Wikipedia
  3. [3]Ariane flight V88 · Wikipedia
  4. [4]ARIANE 5 Flight 501 Failure Report by the Inquiry Board · Inquiry Board chaired by Prof. J. L. Lions (hosted by University of Minnesota)
  5. [5]Ariane 501 - Presentation of Inquiry Board report · European Space Agency
  6. [6]Mars Climate Orbiter · Wikipedia
More lessons in 💻 Tech (3) See all tech lessons →

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson ↗