0
$\begingroup$

I'm wanting to carry out the calculation of 8 - 11 (assuming that 5 bits represents a number and also using 2s complement representation), however, I can't seem to get the correct answer. This is what I have so far;

8 in binary is 01000. 11 in binary is 01101, which we invert to get -11: 10010 and then add one => 10011.

Adding these together (8 + -11) I thought resulted in 11100, however, when converting this back to decimal I can see that this isn't the (final) answer. Does anyone know where I'm going wrong?

$\endgroup$

1 Answer 1

1
$\begingroup$

You representation of $11$ is wrong (you actually compute with $-13$), here the steps to get $8-11 = -3$

 8 = 01000 -11 = inv(01011)+1 = 10100+1 = 10101 01000 + 10101 = 11101 

Now compute $-3$ and see that results match:

 -3 = inv(00011)+1 = 11100+1 = 11101 
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.