What is the difference between signed 8-bits 1's and 2's complements and unsigned 8-bits? Does it have to do with adding 1 after the number all the way to the left? I'm lost lol
Asked
Active
Viewed 1,469 times
1
-
The only difference is in the interpretation of the value. Both holds 8 bits from all `0`s up to all `1`s. In signed bits, the left most is used as a sign bit `0` means positive and `1` means negative. The rest of the 7 bits are the scalar value. That makes signed 8 bits integer have values between -128 to 127 while unsigned 8 bits have 0 to 255. In both cases, they hold 256 values. – alvits Feb 10 '17 at 02:27
2 Answers
1
Both signed and unsigned 8-bit values are represented with 8 bits. 1's and 2's complements act the same on both:
1's complement of unsigned 01110100 = 10001011
1's complement of signed 01110100 = 10001011
2's complement of unsigned 01110100 = 10001100
2's complement of signed 01110100 = 10001100
The only difference is how the 10001011
is interpreted. For an unsigned value, 10001011
represents the positive number 139. However, for an signed value, 10001011
represents -117.

kalanchloe
- 503
- 4
- 12
0
signed bits can take negative values unsigned bits can only take positive values
so they both store the same range of values however the numerical values they can store are as follows
unsigned 8 bit: 0 to 255
signed 8 bit: -128 to 127

AlexanderRD
- 2,069
- 2
- 11
- 19
-
ok, so for signed 8bits 1's complement the maximum value would be 256? and 2's complement would be 512? – Feb 10 '17 at 02:25
-
what about signed 16bit 1's complement and 16bit 2's complement? Whats the difference? – Feb 10 '17 at 02:33
-
1's complement stored negative numbers as by inverting each digit this meant when the number and its negative were added you would get 0 however this number system had a offset of -1 which lead to twos complement being developed that does not have the offset – AlexanderRD Feb 10 '17 at 02:41
-
also comments about the question should be posted under the question comments section – AlexanderRD Feb 10 '17 at 02:41