Reputation:
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
Upvotes: 1
Views: 1689
Reputation: 503
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.
Upvotes: 1
Reputation: 2089
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
Upvotes: 0