Integer Overflow

Why Trust Techopedia

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.

Advertisements

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.

Advertisements

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret é uma premiada redatora e professora conhecida por sua habilidade de explicar assuntos técnicos complexos para um público empresarial não técnico. Nos últimos vinte anos, suas definições de TI foram publicadas pela Que em uma enciclopédia de termos tecnológicos e citadas em artigos do New York Times, Time Magazine, USA Today, ZDNet, PC Magazine e Discovery Magazine. Ela ingressou na Techopedia em 2011. A ideia de Margaret de um dia divertido é ajudar os profissionais de TI e de negócios a aprenderem a falar os idiomas altamente especializados uns dos outros.