# Signed binary arithmetic

I'm having trouble with a fairly simply concept, signed binary arithmetic. I know how to do 1's and 2's complement, convert from binary, decimal, octal, and hex, multiply and add bytes and bits, but for some reason this is stumping me:

Take 77 - 99 + 44 for example.

    77 > 01001101
-(99) > 01100011
10011100
+      1   2's complement
10011101
44 > 00101100


At this point, I thought I could just take the sum of 77 and the 2's complement of 99, but I feel like I'm going in the wrong direction after completing that step and then adding 44, like below:

   77 >   01001101
-(99) > + 10011101
= 00000010
44 > + 00101100 (cut off ending 1, past 8)
= 00101111


What am I missing? Thanks

Update: I've followed this example, and it shows that when dealing with a 1 (negative) sign bit in a given result, to do another 2's complement with the result, but I am not getting that result.

• In your example adding the $77$ and $-99$ the third column ($8$'s place) carries, so you have three $1$'s to add in the fourth column. Then the fourth column carries (with sum one) and the fifth column carries (with sum zero). There is no carry in the sixth, and the seventh and eighth are $0+1=0$. You add it like regular binary. – Ross Millikan Sep 10 '13 at 3:04
• Yeah I realized I was completing messing up with binary addition @RossMillikan, thanks – Ben Sewards Sep 10 '13 at 3:15

• $+77 = 0~1~0~0~1~1~0~1$
• $-99 = 1~0~0~1~1~1~0~1$

Adding these produces $-22$, that is:

• $-22 = 1~1~1~0~1~0~1~0$

Now, we want to add that to $+44$:

• $+44 = 0~0~1~0~1~1~0~0$

• $-22 + 44 = 1~0~0~0~1~0~1~1~0$
Discard the overflow (MSB) and we are left with the result $= 22$.
• I lined up the bits so you can easily follow along. Do one operations at a time. So, do $77-99$ and see if you get the bits I show. Recall, when you add $1+1 = 0$ with a carry bit. Clear? – Amzoti Sep 10 '13 at 3:00