|
|
|
|
|
by dikkechill
3011 days ago
|
|
The mentioned 1991 issues with the Patriot Missile were due to an issue converting integers to floats. The [system's] prediction of where the Scud will next appear is a function of the Scud's known velocity and the time of the last radar detection.
Velocity is a real number that can be expressed as a whole number and a decimal (e.g., 3750.2563 . . . miles per hour).
Time is kept continuously by the system's internal clock in tenths of seconds but is expressed as an integer or whole number (e.g., 32, 33, 34 . . .).
The longer the system has been running, the larger the number representing time.
To predict where the Scud will next appear, both time and velocity must be expressed as real numbers.
Because of the way the Patriot computer performs its calculations and the fact that its registers are only 24 bits long, the conversion of time from an integer to a real number cannot be any more precise than 24 bits.
This conversion results in a loss of precision causing a less accurate time calculation.
The effect of this inaccuracy on the [system's] calculation is directly proportional to the target's velocity and the length that the system has been running.
Consequently, performing the conversion after the Patriot computer system has been running continuously for extended periods causes the [system's estimated Scud position] to shift away from the center of the target, making it less likely that the target will be successfully intercepted.
See also http://cs.furman.edu/digitaldomain/themes/risks/risks_numeri... |
|
Incidentally, although this is often described as a "floating point bug", the actual arithmetic was 24-bit fixed point. In order to convert from tenths of seconds to seconds they multiplied by 1/10 = 0.00011001100110011001100. If they had used a floating point format with a 24-bit mantissa, they could have multiplied by 2^-3 * 0.110011001100110011001100, giving 4 more bits of precision, which would probably have been enough to intercept the missile! :)
Also perhaps interestingly, the problem only arose because a software upgrade had introduced a new function to do the conversion more accurately, but didn't call it everywhere. If they had used the old inaccurate conversion throughout, the errors would mostly have cancelled out.
See http://www-users.math.umn.edu/~arnold/disasters/patriot.html