Electronic calculators are precise and never, ever, make mistakes. This at least is what we would like to think. But, in fact, such errors occur all the time. It is just that we hardly ever notice. Take a pocket calculator, for example, which has buttons for “square” and “square root,” and follow this procedure: Press the number 10, then the square root button, and then the square button. As expected, the number 10 appears on the display screen, since the square number of the square root of 10 is, of course, 10. So far so good. Now try this: Press the number 10, then press the square root button 25 times, and follow up by pressing the square button 25 times. The result, one would expect, should again be 10, but the display shows something like the number 9.9923974. Ordinarily not much thought is given to this rather minor divergence of 0.07 percent. It is an error one can usually live with. But now repeat the experiment by pressing the square root button and the square button 33 times. The resulting number, 5.5732436 or something similar, no longer bears any resemblance to the real answer, which, of course, is 10.
The reason for this phenomenon, which occurs without fail in one way or another with each and every digital calculator, is the fact that a number can have an infinite number of decimals. An example is the fraction 1/3. Expressing it in decimals results is an infinite number of threes after the decimal point. But—and it is a very big “but”—calculators can only store a finite amount of numbers. As a general rule, numerical values are truncated after 15 digits by computers. Thus very small errors exist between the true numbers and the stored or displayed values.
In general, we just put up with these inaccuracies since it is not difficult to manage daily life with only two or
three digits after the decimal point. There are times, though, when rounding errors can lead to catastrophes. On February 25, 1991, during the Persian Gulf War, an American Patriot missile battery in Dharan, Saudi Arabia, failed to intercept an incoming Iraqi Scud missile. The Scud struck an American army barracks and killed 28 soldiers. The cause for this tragic mishap was an inaccurate conversion of time, measured in tenths of seconds, to the binary values as they are stored in the computer. Specifically, elapsed time was measured by the system’s internal clock in tenths of a second and stored in binary numbers. Then the result needed to be multiplied by 10 to produce the time in seconds. This calculation was performed using 24 bits. Hence the value 1/10, which has a nonterminating binary expansion, was truncated after 24 bits, resulting in a minute error.1 This truncation error, when multiplied by the large number giving the time in tenths of a second, led to what was to be a fatal mistake.
On the evening of the election day of April 5, 1992, the Green Party in Germany’s state of Schleswig-Holstein was elated. By a hair's breadth, the party had mastered the 5 percent threshold required for entry into the state parliament. The rude awakening came shortly after midnight. The true election results were published, and the Greens discovered to their dismay that they had actually only received 4.97 percent of the vote. The program that calculated the election results throughout the day had only listed one place after the decimal, and the count had been rounded to 5.0 percent. This particular piece of software had been used for years, but nobody had thought of turning off the rounding feature—if not to say bug—at this crucial moment. The long and the short if it was that the Greens were unable to occupy any seat in parliament.
On June 4, 1996, an unmanned Ariane 5 rocket was launched off the island of Courou in French New Guinea, but it exploded just 40 seconds after liftoff. The rocket
had veered off its flight path and had to be destroyed by ground control. Due to a software error, the guidance system had misinterpreted a rounded figure.
In 1982 the stock market in Vancouver introduced a new index and set the initial value at 1,000 points. After less than two years the index was down by nearly half, even though the average value of the stocks had increased by some 10 percent. The discrepancy was, again, due to rounding errors. While calculating the index, the weighted averages of the stock prices were truncated after too few decimal places.
In one particular instance, however, rounding errors led to a significant discovery. One day in the 1960s, Edward Lorenz, a meteorologist at the Massachusetts Institute of Technology, was busy observing weather simulations on his computer. After a while he felt that he needed a break. Lorenz stopped running the program and jotted down the intermediate results. After finishing his cup of coffee, Lorenz returned to his desk, fed the intermediate results back into the computer, and let the simulation run its course. To his surprise, the weather on his computer took a completely different turn to what he expected based on the previous simulations.
After brooding for a while over this puzzle, Lorenz realized what had happened. Before leaving for the coffee shop, he had copied down the numbers he saw on his computer screen. These numbers were displayed to three places behind the decimal point. But inside the computer, numbers were stored to eight decimal places. Lorenz realized that his computer program had been working with values that had been rounded. Since the weather simulation involved several nonlinear operations, it was not surprising that divergences cropped up rather quickly. Nonlinear expressions—that is, expressions like squaring or taking the square root—have the annoying characteristic of amplifying even minute mistakes very quickly.2
Edward Lorenz’s discovery set the foundation for so-called chaos theory, which today is a well-known concept. One of the consequences of this theory is the notorious butterfly effect. Basically it says that the movement of a butterfly’s wings may unleash a hurricane at the other end of the world. Tiny vortices in the air, caused by a butterfly’s flapping wings may represent no more than a change in the 30th digit behind a decimal point. However, nonlinearities in the weather could augment the tiny air movements a billionfold and thus escalate into a hurricane.
But there is another, less sinister, way of looking at things. By flapping its dainty wings, a butterfly could, by the same token, prevent a hurricane from arising. Mathematical models that make use of the reverse butterfly effect have found applications in, for example, cardiology. Minute electrical shocks, released at precisely the right moment, may correct a chaotic heartbeat and prevent a heart attack.