Difficulty: Easy
Correct Answer: they have the same sign
Explanation:
Introduction / Context:
Detecting overflow in signed two's-complement addition is essential for reliable arithmetic units and software that checks bounds. Overflow indicates the true mathematical result is out of range for the chosen word width and cannot be represented exactly.
Given Data / Assumptions:
Concept / Approach:
In two's-complement, overflow occurs if and only if adding two positives yields a negative, or adding two negatives yields a positive. This requires that the addends have the same sign, and the sign of the result differs from that sign. If the addends have opposite signs, the result moves toward zero and cannot overflow the representable range.
Step-by-Step Solution:
Verification / Alternative check:
Hardware rule: overflow flag V = Cout(msb) XOR CarryInto(msb). This condition triggers only when same-sign addition produces a sign flip in the result, confirming the conceptual rule.
Why Other Options Are Wrong:
Opposite signs cannot overflow in two's-complement; “both” and “none” contradict the established overflow criterion.
Common Pitfalls:
Confusing carry out of the MSB with signed overflow; relying solely on the carry flag instead of the dedicated signed overflow indicator.
Final Answer:
they have the same sign
Discussion & Comments