Binary calculation (11 +01010101 )

Kindly help me with this Binary calculation

Add the following 2's complement numbers 11 +01010101 = ?

How i solve it :

0000 0011 + 01010101 = 01011000 but the book say its 84???

• Your approach is reasonable. The question is misleading. – Pete Becker May 10 '15 at 18:04
• The question is not misleading it is meant to require some thought, as in a leading 1 is a negative number – user76201 May 10 '15 at 18:57
• IMO (as a teacher who teaches this kind of stuff) the question is badly 'worded'. It assumes that the 11 is to be interpreted as a 2-bit value, which is (unless made clear by context) not something one would automatically assume. Hence the question tests the students ability to see through this 'trick', NOT the students ability to do binary math. Maybe trickery is the subject of the course (and in that case the question is OK), but I doubt that. – Wouter van Ooijen May 10 '15 at 19:12
• @WoutervanOoijen Also - are you adding a 2-bit value to an 8-bit value in an 8-bit context, or a 2-bit value to an 8-bit value in a 2-bit context? If the latter the answer would actually be 1. – Majenko May 10 '15 at 23:48

The value 11 isn't the same as the value 00000011 when 11 comes from a 2-bit system. Instead, to take into account the two's complement sign you have to sign extend the smaller value into the same space as the larger value. That means copying the most significant bit into all the "new" bits you add to make it 8-bit.
So, 11 becomes 11111111. In two's complement, that equates to -1.
01010101 is decimal 85. 85 + -1 is 84.
Alternatively, in binary, 01010101 + 11111111 = 101010100 but since it's 8 bits the top-most bit gets lost, and the result is 01010100 which is 84.