
Overflow Error
An overflow error occurs when a number becomes larger than the storage space reserved for it can hold. The result isn't just imprecise, but often completely wrong – for instance, when a very large positive number suddenly becomes negative.
A computer stores every number in a slot of fixed size. How many digits fit is determined in advance and doesn’t change later. If the result of a calculation grows larger than this slot, it no longer fits. This is exactly what’s called an overflow error. The computer usually doesn’t report an error but simply cuts off the excess digits. What remains is a number that looks like a normal result but is wrong.
When two billion minus two billion becomes something else
The insidious thing about overflow is that it happens silently. A program doesn’t crash and shows no warning. It simply keeps calculating with the wrong value. That’s why such errors are often only noticed once visible damage has already occurred.
A famous example is the European rocket Ariane 5. During its first flight in 1996, the control software converted a large measured value into a smaller numeric field. The value didn’t fit, the control system reported an error, and the rocket destroyed itself after 37 seconds. The damage amounted to several hundred million euros – because of a single number that was too large.
This is also relevant in business. Trading systems, accounting software, and databases calculate with monetary amounts and quantities. An overflow there can turn a credit balance into a debt. And in IT security, a related form, the buffer overflow, has been one of the most common entry points for attackers for decades.
Why the counter starts again at zero
Numbers are stored in a computer as a sequence of zeros and ones, so-called bits. A field of 8 bits can represent 256 different states, i.e. the values 0 to 255. If you count one further from 255, there would arithmetically be a ninth digit. No space is reserved for that, so it’s dropped. 256 becomes 0 – the counter jumps back to the beginning, like an odometer that switches from 999999 back to 000000.
With signed numbers, it gets even more confusing. There, the topmost bit marks whether the number is positive or negative. If this bit flips due to an overflow, the largest positive number abruptly becomes the smallest negative one. A value that was just two billion suddenly stands at minus two billion.
An overflow is therefore something different from a rounding error. With rounding, the result is slightly imprecise but in the correct order of magnitude. With overflow, the order of magnitude is no longer correct, often not even the sign. The counterpart, by the way, is called underflow: here a number is too small to still be representable and is silently turned into zero.
From YouTube clicks to AI models
A well-known case involved YouTube. The counter for video views was designed for a good two billion clicks. When the music video for “Gangnam Style” exceeded this limit, the platform had to switch to a larger number format. Gamers know something similar from old video games, where scores or level displays suddenly go haywire past a certain value.
In AI development, this topic comes up regularly. Modern models, for cost reasons, calculate with particularly sparing number formats, such as 16 or even 8 bits per value. The smaller the format, the narrower the representable range. During training, intermediate values can then overflow and turn into “NaN”, meaning “not a number”. A training run costing millions is then rendered useless.
Another date that keeps popping up in tech news is January 19, 2038. Many older systems count time in seconds since 1970 in a 32-bit field. On this day, this field overflows. Programmers guard against such problems with larger number formats, checks before every calculation, and programming languages that report an overflow on their own.