Need Helped Understanding an 8-Bit Signed Decimal with 2's Compliment

653 views Asked by At

I need help in determining if my logic here is right or wrong.

Example Question

"Assuming I have an 8-bit signed decimal value of 200 in two's compliment form..."

My Thought Process

Now because it is 8-bits and is signed, the most significant bit must be reserved for the sign.

Thus, the maximum positive value it can have is:

2^(8-1) - 1 = 127

At first I was confused because I thought, why is the question stating that 200 is able to be 8-bits and signed? Then I thought, that's where the two's compliment statement comes into question.

Because it is two's compliment in reality, this is the case:

8-bit Signed, 2's Compliment, Decimal = 200

Convert to Binary --> 1100 1000

Because it is signed, the actual two's compliment number is ACTUALLY -56 (I would use negating methods to invert the 1's and 0's then + 1, but for the interest of time, I just found a converter online).

So my conclusion is:

8-bit Signed, 2's Compliment, Decimal value of 200 is actually -56.

Ultimate Question

Is my thought process correct with this? If so, I think the most confusing part about this is telling my brain that one number is equal to a completely different number.

1

There are 1 answers

2
intentionally-left-nil On

Yes, I think your analysis is correct.

To expand a bit more, I think the wording of the question is awkward and would have been better stated as "What is the value of 1100 1000 in base 10, where the number is a two's complemented number?"

The trick here is to think not that 200 == -56, but that the single point of truth is the bits 11001000. These bits of numbers have no meaning by themselves. We have the computer interpret them differently based on the program. So two's complement (with 8 bit numbers) treats that as -56, an unsigned interpretation would treat that as 200, and in ASCII this would be some special character depending on the encoding.