8 bit binary number $01101110$ is on a computer using two’s complement representation. What should it be in decimal?

615 Views Asked by At

8 bit binary number $01101110$ is on a computer using two’s complement representation. What should it be in decimal?

My solution is:
reverse it to $10010001$
$10010001+1 = 10010010$
$10010010$ to decimal is $146$
answer is $-146$ but this seems incorrect.

Any ideas?

3

There are 3 best solutions below

0
On BEST ANSWER

Th number is positive because the MSB is $0$. So simply $01101110_2 = 64+32+8+4+2$.

0
On

This is a positive number because the most significant bit (MSB) is $0$. So the decimal representation of $01101110_2$ is $2^6+2^5+0+2^3+2^2+2^1+0=110$

0
On

Although both answers from previous users are correct, if the number given is indeed in two's complement form, you would need to reverse the process. I believe the approach you were looking for is as follows:

Two's complement form: 01101110
subtracting one: - 1
One's complement form: 01101101
Binary form: 10010010
Decimal form: 128+0+0+16+0+0+2+0=146

Note: the result is positive, which is reflected in both the one's complement & two's complement form.