GATE 2019 CS – Question 18
Consider $Z=X-Y$, where $X$, $Y$ and $Z$ are all in sign-magnitude form. $X$ and $Y$ are each represented in $n$ bits. To avoid overflow, the representation of $Z$ would require a minimum of:
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) $n+1$ bits
Explanation
The magnitudes of $X$ and $Y$ fit in $n-1$ bits, so $|X-Y|$ can be up to twice as large, which needs one more magnitude bit. With the sign bit this gives $n+1$ bits in total.