Two's complements

162 Views Asked by At

Calculate 111000_2 - 1100111_2 and convert the result into a 8-Bit two's complement.

My suggestion:

I'm inverting 1100111_2 into 0011000_2 and add +1, so the result would be: 0011001_2.

Then I'm adding this result to 0111000_2 and get 01010001_2.

But this is wrong. Could anyone help me out?

1

There are 1 best solutions below

0
On BEST ANSWER

In two's complement we have that $$-01100111_2=\dots1110011001_2$$ Where any number of initial $1$s $($at least one$)$ can be used in an equivalent fixed size two's complement representation. For an $8$-bit representation we have $$-01100111_2=10011001_2$$ and hence the result is given by $$00111000_2+10011001_2=11010001_2$$