1

I am a bit confused. Because isn't the 8-bit one’s complement representation exactly the same as the 8-bit unsigned binary numbers representation?

Because I read somewhere that "in one’s complement, positive numbers (also known as non-complements) remain unchanged"

So for instance, 01010101 simply remains 01010101 ?

or 00100000 is just 00100000 ?

Vroryn
  • 13

1 Answers1

0

00000000 to 01111111 represents 0 to 127 always,
but
10000000 to 11111111 represents 128 to 255 in unsigned.
10000000 to 11111111 represents -127 to -0 in one's complement.
10000000 to 11111111 represents -128 to -1 in two's complement.

  • so I think I am right with my assumption then? I mean don't you only invert the numbers when it's signed? – Vroryn Sep 01 '17 at 10:08
  • The only numbers that are representable in both 8-bit unsigned and 8-bit one’s complement are the numbers 0-127, and they have the same binary representation in both, so for them there is nothing to do for the conversion. You cannot convert the unsigned 8-bit numbers 10000000-11111111 because they represent 128-255 in decimal and 8-bit one's complement cannot represent that range of numbers. – Jaap Scherphuis Sep 01 '17 at 11:11