RTUEE / EC / EEEYr 2024 · Sem 52024

Q8Computer Architecture

Question

2 marks

Q.8. How overflow occurs in subtraction?

Answer

Overflow in subtraction occurs when the result of subtracting two signed numbers exceeds the representable range, typically detected when the carry into the sign bit differs from the carry out of the sign bit.

In signed binary subtraction (performed via addition of the 2's complement), overflow occurs when the mathematical result falls outside the range representable in the fixed number of bits used — for example, subtracting a large negative number from a large positive number can produce a result exceeding the maximum positive value. It is detected in hardware when the carry-in to the most significant (sign) bit differs from the carry-out of that bit (C(in) ≠ C(out)), or equivalently, when the sign of the result is inconsistent with the signs of the operands (e.g., subtracting a negative from a positive yields an apparently negative result), signaling that the true result cannot be correctly represented.

Back to Paper