Integer overflow: Difference between revisions

Content deleted Content added
No edit summary
Line 3:
[[Image:Odometer rollover.jpg|thumb|250px|[[Odometer]] rollover, a mechanical form of integer overflow. All digits are set to the maximum 9 and the next increment of the white digit causes a cascade of carry-over additions setting all digits to 0, but there is no higher digit to change to a 1, so the counter resets to zero. This is ''wrapping'' in contrast to ''saturating''.]]
 
In [[computer programming]], an '''integer overflow''' occurs when an [[arithmetic]] operation attempts to create a numeric value that is outside of the range tothat can be represented within the available storage space - either larger than the maximum representable value, or lower than the minimum representable value.
 
The most common result of an overflow is that the least significant representable bits of the result are stored; the result is said to ''wrap''. On some processors like [[graphics processing unit]]s (GPUs) and [[digital signal processor]]s (DSPs), the result [[saturation arithmetic|saturates]]; that is, once the maximum value is reached, any attempt to increase it always returns the maximum integer value.