Convert from two's complement into unsigned number

22.1k Views Asked by At

There is an 8-bit numerical value, where a negative number is represented in two’s complement. When this value is represented in decimal, it becomes -100. When this value is regarded as an unsigned number, which of the following is the correct value in decimal?

First, I have to calculate the decimal 100 in binary, and add the signed bit at the start :

1110 0100

Then, to get the non-negative decimal value of the object, I convert the two complement back to its original value :

0001 1100

which gives me the result is 28

But the correct answer is 156, this is the value I will get if I did not replace the MSB (1) with (0) when converting the two complement back to the original value

1001 1100

What am I missing here?

1

There are 1 best solutions below

0
On BEST ANSWER

First consider the decimal number 100. Binary notation of 100 would be

01100100

Applying the two's complement, we find that -100 must be

10011011 + 00000001 = 10011100

Assuming now this is unsigned, we get $128+16+8+4=156$