Section 6.3: Signed binary numbers (integers) (Frame 4)                     [prev][home][next]

Another method of encoding negative integers is called 2's complement. This notation is more widely used than sign-magnitude because it is easier to implement subtraction. However, 2's complement is more difficult for humans to understand.

First, let's look at a simpler system called 1's complement. In 1's complement notation, negative numbers are formed by inverting all the bits of the positive form. Again, the size of the numbers must be fixed once and for all. Here are the same values as given above, only using 1's complement.

number     4 bits     8 bits     12 bits
------     ------     ------     -------
0          0000       00000000   000000000000
1          0001       00000001   000000000001
-1         1110       11111110   111111111110
-15        can't do   11110000   111111110000
7          0111       00000111   000000000111
-7         1000       11111000   111111111000
8          can't do   00001000   000000001000
-8         can't do   11110111   111111110111
576        can't do   can't do   001001000000
-576       can't do   can't do   110110111111