In the book by William Stallings the overflow rule overflow rule for 2's complement addition is stated as follows:
Overflow rule: If two numbers are added, and they are both positive or both negative, then overflow occurs if and only if the result has the opposite sign.
Then the book gives the following examples:
Doubts:
- If two numbers with the same sign are added, shouldn't the result have the same sign? How can the result have an opposite sign (e.g., $+1+2=+3$ and $-1-2=-3$)?
- Point 1 is reflected in the examples (d), (e) and (f). An overflow seem to occur in all of them (though the word "Overflow" is not printed in example (d)), but the sign of the result is the same as that of operands.
