Thursday, March 7, 2013

What a Bug!

The programmer made a common error: converting a floating point “double” to a 16 bit signed integer (a “short”). 

For my non-programmer readers, this is a little like trying to use a quart jar to store water, then transferring it to a drinking glass.  It works fine if your quart jar only has a little water in it, but if the quart jar has more water in it, that water won't all fit in the drinking glass.  In this case, it's the numeric value that won't fit.  For example, if that double had the value 200,000 in it, the short would end up with something very different – the biggest number it can hold is 32,767 (don't ask why unless you really want to get into the weeds!).

So the programmer made this noobie error.  Most of the time, the consequence of this sort of error is just a “Aw, crap!”, and the programmer fixes it.  This time the consequence was the loss of $500 million dollars – because it blew up an Ariane 5 and its cargo.

Major bummer...

No comments:

Post a Comment