| Overflow: UB | ||||||||||||||
| Unsigned binary: | ||||||||||||||
| Add 2 non-negative numbers: result is greater than or equal to each number | ||||||||||||||
| x + y >= x | ||||||||||||||
| x + y >= y | ||||||||||||||
| Overflow occurs when result is larger than maximum number (2k - 1 for k bits) | ||||||||||||||
| Can detect overflow just by checking if carry out from most significant bit is 1 | ||||||||||||||
| Ripple-carry circuit with overflow detection: | ||||||||||||||
|
||||||||||||||
| "V" is used to denote overflow bit ("O" is too close to "0") | ||||||||||||||