Fact Checked

What is an Arithmetic Overflow?

Daniel Liden
Daniel Liden

An arithmetic overflow is a condition that occurs in computers, especially in the area of computer programming, when a calculation or operation yields a result that is too large for the storage system or register to handle. Overflow can also refer to the amount by with the given result exceeds the memory designated for storage. In some cases, the overflow of data may be stored at another data storage location; in others, it can cause a program to crash, run slowly, or yield inaccurate results. Arithmetic overflow isn't restricted to full personal or business computers, as simple handheld calculators and communication devices also have limits to the magnitude of the values they can handle.

Programmers tend to learn methods of dealing with arithmetic overflow errors early in their educations, as they tend to be very common programming errors to receive. There are many different methods for handing arithmetic overflow. The design of the program plays a very important part; a well-designed program that uses consistent and correct data types and lengths should not experience such errors. If great care is put into checking the order of operations and keeping everything consistent, overflow errors can be avoided entirely.

Scientist with beakers
Scientist with beakers

Another way to deal with arithmetic overflow errors is to break operations down into smaller steps. It is often easier for a system to handle simple, small operations than complex operations involving large numbers and excessive calculations. When it is not extremely important that the number returned is completely accurate, it will sometimes suffice to write the program in such a way that it notifies the user of the overflow error but returns a value anyway. The most common way to handle an arithmetic overflow error is to ignore it completely. While this is usually harmless, it can give incorrect results and can compromise the usefulness and efficiency of the program.

Ariane 5 flight 501 clearly illustrates the dangers of arithmetic overflow errors. The flight was the first test run of the European Ariane 5 expendable launch system, which reused much of the code from the old Ariane 4 system. The acceleration of the Ariane 5 was, however, significantly greater than that of the Ariane 4, and the programming was not adequate to handle the greater values needed. As such, the rocket left its intended flight path 37 seconds after launch and had to be destroyed. This simple programming error cost hundreds of millions of US Dollars.

You might also Like

Discuss this Article

Post your comments
Forgot password?
    • Scientist with beakers
      Scientist with beakers