1
$\begingroup$

Perform the following additions of 2’s complement numbers. Indicate whether or not the sum overflows a 4-bit result.

1) 1101+0100 > I apply 2's Complement to 1101 = 0011 > 0011+0100 = 0111

So, it's -3+4 = 7

2) 1000 + 1001 > I apply 2's Complement to both = 1000+0111 = 1111 > Take 2's Complement on the answer > 0001

So, it's -8 -7 = -1

3) 0111+1000 > I apply 2's Complement to 1000 = 1000 > 0111 + 1111 = 1111 > Take 2's Complement on the answer > 0001

So, it's 7-8=1

As you can see, all the answers are wrong when double-checking with real numbers. Why?

$\endgroup$
0
$\begingroup$

You are confusing the 2's complement convention (writing negative numbers as the 2's complement of the absolute value) and the 2's complement operation.

Addition in the 2's complement convention is ordinary addition.

 1101
+0100
=0001 (harmless overflow)
(-3) + 4 = 1

 1000
+1001
=0001 (true overflow)
(-8) + (-7) = 1

 0111
+1000
=1111 (no overflow)
7 + (-8) = -1
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.