Unit conversion mistakes that cost real money
Five failure modes, two of them famous, and the check that catches each one.
Unit errors are unusually dangerous because they rarely look like errors. A misplaced decimal produces an absurd number that someone notices. A unit mismatch produces a plausible number in the wrong system, and plausible numbers pass review. Every case below shares that shape: the arithmetic was right, the quantity was wrong, and nothing in the pipeline was carrying units alongside the values.
Mars Climate Orbiter: pound-force seconds against newton-seconds
A $125 million spacecraft
In 1999 NASA lost the Mars Climate Orbiter during orbital insertion. The ground software supplied by the contractor reported thruster impulse in pound-force seconds; the navigation software at JPL consumed those numbers as newton-seconds. One pound-force second is about 4.45 newton-seconds, so every trajectory correction was under-counted by a factor of four and a half. The accumulated error put the spacecraft roughly 170 km lower than intended at arrival, inside the atmosphere rather than above it. The failure review's finding was not that someone did bad arithmetic; it was that neither interface declared its units.
The Gimli Glider: pounds loaded instead of kilograms
A 767 out of fuel at 41,000 feet
Air Canada Flight 143, a Boeing 767, ran out of fuel mid-flight over Manitoba in 1983. Canada was mid-way through metrication and the aircraft was one of the airline's first to use kilograms; the fuelling calculation used the pounds-per-litre figure the crew and ground staff were used to. A pound is 0.454 kg, so the aircraft was loaded with well under half the fuel it needed. Both engines flamed out and the crew glided it to a former air force runway at Gimli. Nobody was killed, which is the only reason it is remembered as a piece of airmanship rather than a disaster.
Treating a temperature difference like a temperature
Silent, constant, everywhere
°F = °C × 9/5 + 32 converts a temperature. It does not convert a temperature *change*. If a process warms by 10 °C, that is a change of 18 °F, not 50 °F. The offset belongs to the zero point of the scale, and a difference has no zero point. This one produces no crash and no obviously silly number, just a plausible-looking value that is simply wrong, which is exactly why it survives code review. Kelvin and Celsius share a degree size, so ΔK and Δ°C are interchangeable; Fahrenheit and Rankine likewise.
Scaling area and volume with a length factor
Ordering a quarter of the material you need
There are 2.54 cm in an inch, but there are 2.54² = 6.4516 cm² in a square inch and 2.54³ = 16.387 cm³ in a cubic inch. Doubling every linear dimension of a room quadruples its floor area and octuples its volume. This shows up whenever someone converts a length factor and then applies it to paint coverage, soil, concrete, or freight volume. The check is dimensional: if the unit has an exponent, the conversion factor carries the same exponent.
Miles per gallon, without saying which gallon
A 20% error in every figure
An imperial gallon is 4.546 L and a US gallon is 3.785 L, so 30 mpg quoted in the UK is about 36 mpg quoted in the US for the same car, or rather the same car achieves a different number depending on which gallon you divide by. Fuel economy comparisons between US and UK sources are meaningless without qualification. Litres per 100 km avoids the problem entirely, and also has the useful property of being linear in fuel consumed, which mpg is not.
How to not do this
- Put the unit in the variable name.
massKgcannot be assigned a value in pounds without someone seeing it. - Declare units at every interface boundary, not just in the docs.
- Check dimensions, not just magnitudes: an area factor must be a length factor squared.
- Distinguish absolute values from differences wherever a scale has an offset.
- Say which gallon, which ton, and which foot.
Convert with the units spelled out
Free, runs entirely in your browser, no signup.
Related: metric vs imperial covers the name collisions behind several of these, and precision and rounding covers the quieter kind of error.