Complements of numbers
Complements are used in digital computers to simplify the
subtraction operation and for logical manipulation. Simplifying
operations leads to simpler, less expensive circuits to implement
the operations. There are two types of complements for each
base‐r system: the radix complement and the diminished radix
complement. The first is referred to as the r’s complement and
the second as the (r - 1)>s complement. When the value of the
base r is substituted in the name, the two types are referred to
as the 2’s complement and 1’s complement for binary numbers
and the 10’s complement and 9’s complement for decimal
numbers.
Complements of numbers
Diminished Radix Complement
Complements of numbers
Diminished Radix Complement
Complements of numbers
Radix Complement
Complements of numbers
Radix Complement
Complements of numbers
Complements of numbers
Subtraction with Complements
The direct method of subtraction taught in elementary schools uses the borrow
concept. In this method, we borrow a 1 from a higher significant position when the
minuend digit is smaller than the subtrahend digit. The method works well when
people perform subtraction with paper and pencil. However, when subtraction is
implemented with digital hardware, the method is less efficient than the method
that uses complements. The subtraction of two n‐digit unsigned numbers M - N in
base r can be done as follows:
Complements of numbers
Subtraction with Complements
The following examples illustrate the procedure:
Using 10’s complement, subtract 72532 - 3250.
M = 72532
10’s complement of N = + 96750
Sum = 169282
Discard end carry 105 = - 100000
Answer = 69282
Note that M has five digits and N has only four digits. Both numbers must have the
same number of digits, so we write N as 03250. Taking the 10’s complement of N
produces a 9 in the most significant position. The occurrence of the end carry
signifies that M Ú N and that the result is therefore positive.
Complements of numbers
Subtraction with Complements
Using 10’s complement, subtract 3250 - 72532.
M = 03250
10’s complement of N = + 27468
Sum = 30718
There is no end carry. Therefore, the answer is -(10>s complement of 30718) = -69282.
Note that since 3250 < 72532, the result is negative. Because we are dealing with
unsigned numbers, there is really no way to get an unsigned result for this case. When
subtracting with complements, we recognize the negative answer from the absence of the
end carry and the complemented result. When working with paper and pencil, we can
change the answer to a signed negative number in order to put it in a familiar form.
Subtraction with complements is done with binary numbers in a similar manner,
using the procedure outlined previously.
Complements of numbers
Subtraction with Complements
Complements of numbers
Subtraction with Complements
Complements of numbers
Subtraction with Complements
Repeat previous example, but this time using 1’s complement.
Complements of numbers
Subtraction with Complements
Repeat previous example, but this time using 1’s complement.
Note that the negative result is obtained by taking the 1’s complement of the sum, since this is the type of complement used. The
procedure with end‐around carry is also applicable to subtracting unsigned decimal numbers with 9’s complement.