264 views
5 5 votes

Suppose we have two $16$-bit $2$’s complement numbers:

$$101xx101101xxxxx$$

$$1101101xx11xxxxx$$

Here, each $x$ is an independent unknown bit and can be either $0$ or $1$.

Could the sum of these two numbers possibly result in an overflow? If yes, write $1$ in the answer. If no, write $0$ in the answer.

2 Answers

1 1 vote

In $16$-bit $2$’s complement representation, the range is $-32768$ to $32767$.

Both numbers have sign bit $1$, so both numbers are negative.

Overflow in addition of two negative numbers happens only if the sum becomes less than $-32768$.

Now we need to check the most negative possible value of both numbers.

For a negative $2$’s complement number, the value becomes most negative when the remaining bits are as small as possible. So, to get the most negative case, put every $x=0$.

First number becomes:

$1010010110100000$

This is unsigned value $42400$.

So, its $16$-bit $2$’s complement value is $42400-65536=-23136$.

Second number becomes:

$1101101001100000$

This is unsigned value $55904$.

So, its $16$-bit $2$’s complement value is $55904-65536=-9632$.

Now add the most negative possible values:

$-23136+(-9632)=-32768$

The minimum possible sum is exactly $-32768$, which is still inside the valid $16$-bit $2$’s complement range.

If any $x$ becomes $1$, the unsigned value increases, so the negative number becomes less negative. Therefore, the sum cannot become smaller than $-32768$.

So, overflow is not possible.

Final Answer: $0$

0 0 votes
The 11th bit in both binary representations is 1, so adding results in a carry of 1, whether the x before it produces carry or not. The given binary representations carry forward until the first bit from the left, so at the first bit, it's always 1+1+1=11, so the sum is never positive, so no overflow. (in 2's and 1's complement when addition of numbers of same msb produces different msb then overflow)

 
Answer:
Position:
Show:

Related questions

4 4 votes
2 2 answers
212
212 views
GO Classes asked Jun 5
212 views
Which of the following $2$’s complement bit strings represents the smallest decimal value? Each bit string must be interpreted using its own given bit-width.$1001011$ as ...
10 10 votes
2 2 answers
285
285 views
GO Classes asked Jun 5
285 views
In a $10$-bit $2$’s complement system, how many bit patterns represent negative integers that are divisible by $8$, not divisible by $16$, and have even parity?
4 4 votes
1 1 answer
188
188 views
GO Classes asked Jun 5
188 views
A $12$-bit $2$’s complement number has hexadecimal representation $(B6D)_H$. This number is sign-extended to $16$ bits and then arithmetic right-shifted by $2$ positions....
7 7 votes
1 1 answer
261
261 views
GO Classes asked Jun 5
261 views
Which of the following exact decimal expressions can be represented in binary notation with a finite number of bits?$0.84-0.33$ $0.64-0.015$ $0.72+0.02$ $0.45-0.125$