1's Complement of 6 and 9

2.7k Views Asked by At

My question is related to 1's complement. In the book it is mentioned that +6 is represented as 0110 and -6 as 1001 ( 1's complement of 6).

If the system is using the pattern 1001 to represent -6, then how will it represent 9, since the binary of 9 is also 1001?

Can someone please throw light on where I am missing on the logic.

2

There are 2 best solutions below

0
On BEST ANSWER

The point is that the number "width" in bits (the "word size") is given. So with 4 bits 3 bits can be used for the actual size of the number (its absolute value) and 1 bit (the leftmost) for its sign. With 3 bits we can go from -7 to 7 that way (with 0 having two representations, so the 16 bit strings are all used).

So +9 cannot be represented, unless we use more bits.

0
On

Firstly, in one's complement, there are two representations of zero - $\overbrace{00\dots00}^{n\text{ zeroes}}$ and $\overbrace{11\dots11}^{n\text{ ones}}$ - when using $n$ bits to represent each number. Secondly, if we are using $n$ bits then the largest possible positive number that can be represented is $2^{n-1}-1$ so you cannot express $+9$ using $4$ bits as $2^{4-1}-1=7\lt9$.