Content deleted Content added
m linebreaks! |
|||
Line 1:
In [[computer programming]], an '''integer overflow''' occurs when an [[arithmetic]] operation attempts to create a numeric value that is larger than can be represented within the available storage space. For instance, adding 1 to the largest value that can be represented constitutes an integer overflow. The most common result in these cases is for the least significant representable bits of the result to be stored (the result is said to ''wrap''). On some processors like [[Graphics processing unit|GPU]]s and [[Digital signal processor|DSP]]s, the result [[saturation arithmetic|saturates]], that is once the maximum value is reached attempts to make it larger simply return the maximum result.
==Origin==
Line 14 ⟶ 13:
<!-- Diagram that illustrates wrapping behavior of integer representation. -->
In [[computer graphics]] or [[signal processing]], it is typical to work on data that ranges from 0 to 1 or from -1 to 1. An example of this is a [[grayscale]] image where 0 represents black, 1 represents white, and values in-between represent varying shades of gray. One operation that one may want to support is brightening the image by multiplying every pixel by a constant. [[Saturated arithmetic]] allows one to just blindly multiply every [[pixel]] by that constant without worrying about overflow by just sticking to a reasonable outcome that all these pixels larger than 1 (i.e. [[high dynamic range imaging|"brighter than white"]]) just become white and all values "darker than black" just become black.
|