Integer Overflow

What Does Integer Overflow Mean?

Integer overflow is the result of an attempt by a CPU to arithmetically generate a number larger than what can fit in the devoted memory storage space. Arithmetic operations always have the potential of returning unexpected values, which may cause an error that forces the whole program to shut down. For this reason, most programmers prefer to perform mathematical operations inside an exception frame, which returns an exception in the case of integer overflow instead.


Integer overflow is also known as arithmetic overflow.

Techopedia Explains Integer Overflow

One example of integer overflow could occur when a program developer does not allow for the occurrence of a negative number. In this case, if a variable performs an operation resulting in a negative number, an overflow occurs and the variable is returned as a positive integer. Another example of integer overflow would be dividing a number by zero, which mathematically yields a large number with an infinite value.

A processor's behavior in the event of an integer overflow differs from one processor to another. Graphics processing units and digital signal processors are engineered to deal with many arithmetic conditions, including integer overflow. In an instance of integer overflow, these processors typically return the maximum number allowed.


Related Terms

Latest Computer Science Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…