Two's Complement Overflow Rules

The rules for detecting overflow in a two's complement sum are simple:
- If the sum of two positive numbers yields a negative result, the sum has overflowed.
- If the sum of two negative numbers yields a positive result, the sum has overflowed.
- Otherwise, the sum has not overflowed.

The reason for the rules is that overflow in two's complement occurs, not when a bit is carried out out of the left column, but when one is carried into it. That is, when there is a carry into the sign. The rules detect this error by examining the sign of the result. A negative and positive added together cannot overflow, because the sum is between the addends. Since both of the addends fit within the allowable range of numbers, and their sum is between them, it must fit as well.