Representing a signed number with 2's complement is done by adding
1 to the 1's complement representation of the number. To illustrate,
let's look at the same example we used for 1's complement. How can we
represent the number -510 in 2's complement
- First, we write the positive value of the number in binary.
- Next, we reverse each bit to get the 1's complement.
- Last, we add 1 to the number.
To the right is a table of 4-bit binary numbers in 2's complement notation.
Comparing these values with our 1's
complement table, we see that both representations use the most
significant bit to represent the sign. We also notice that we only have
one way to represent 0 in 2's complement. This is an advantage because
it simplifies representation of signed numbers. As with 1's complement,
only negative values need to be complemented in 2's complement. The
positive values are the same as the normal binary numbers. You should
verify for yourself that the negative values are correct by using the
steps below to produce this table.
Here is a quick summary of how to find the 2's complement representation
of any decimal number x. Notice the first three steps are the
same as 1's complement.
- If x is positive, simply convert x to binary.
- If x is negative, write the positive value of x in
- Reverse each bit.
- Add 1 to the complemented number.