I am struggling with performing binary math with unsigned numbers. I know I am supposed to take the 2s complement (flip the bits and add 1) of the subtrahend before I subtract, but for some reason my teacher marked me wrong on every single question I did.

Here is the question:

Perform the following operations on the given numbers using the 2's complement of the subtrahend (bottom number).

The following numbers are UNSIGNED binary representations of the given decimal number. Write the 2's complement of each number in the space provided. enter image description here

Like take A for example: If 0111 1010 is unsigned, then I make it a signed number by appending a sign bit in front of it. Right? Here is what I did for the first one:

122 = 1000 0101
+                          1
            1000 0110

-122 = 0000 0110 (by replacing the 1 with a zero on the rightmost bit)

What am I doing wrong?

  • 1
    $\begingroup$ You came up with $-122=00000110$, which is wrong. (You should recognize that as a representation of the number $+6$, whether the type is unsigned or not. The number $122$ in binary is (given as) $01111010$. The left bit is $0$, so $-122$ is representable as a signed $8$-bit integer. To find the binary representation of $-122$, flip each bit of $01111010$ and add $1$. You did this, but then you went ahead and did something further. You should have stopped at $10000110$, which is the $8$-bit signed integer representation of $-122$. $\endgroup$ – Steve Kass May 7 '15 at 4:30
  • $\begingroup$ Thanks, that was actually very helpful. $\endgroup$ – jshapy8 May 7 '15 at 5:37

Your Answer

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

Browse other questions tagged or ask your own question.