# Twos complement arithmetic

If I have the expression:

 1011 0000 1110
-1000 1110 0001
----------------


Then, I find the twos complement of the second number:

 0111 0001 1110
+0000 0000 0001
---------------
0111 0000 1111


I then add this to the first number:

 1011 0000 1110
+0111 0000 1111
---------------
0010 0001 1101


 0010 0001 1100


Can anybody see my error?

• I don't see how this is a computer science question. – Raphael Dec 6 '14 at 9:08
• @Raphael, it's part of my Digital System Architecture module on my BEng Electronic Engineering course. I'm not sure if it counts as a CS question; I just assumed anybody that studies CS might be able to give me a hand. – smollma Dec 6 '14 at 16:08
• @Raphael, in hindsight, perhaps the Electrical Engineering forum is the place for it. – smollma Dec 6 '14 at 16:09
• Neither, imho. When it comes down to it, you are asking, "how to add two numbers?". Granted, twos complement is not the encoding we learn in elementary school, but the scope/difficulty of the task is the same as back then. Being able to do so is a tool but neither (part of) what computer science or electrical engineering is about. – Raphael Dec 6 '14 at 16:11

The given answer can't be correct: Just from the last digits it claims that the result of subtracting an odd number from an even number is even.

However, you also made a mistake in your calculation: The 2's complement should be 0111 0001 1111.