Content deleted Content added
m linebreaks! |
|||
Line 11:
Since an arithmetic operation may produce a result larger than the maximum representable value, a potential error condition may result. In the [[C (programming language)|C programming language]], signed integer overflow causes [[undefined behavior]], while unsigned integer overflow causes the number to be reduced [[modular arithmetic|modulo a power of two]], meaning that unsigned integers "wrap around" on overflow.
A "wrap around" corresponds to the fact, that e.g. if the addition two positive integers produces an overflow, it may result in a negative number. In counting, one just starts over again from the bottom.
Example: 8 bit signed integer: 3000 + 3000 = -5536.
<!-- Diagram that illustrates wrapping behavior of integer representation. -->
|