Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Complement

1) (r-1)'s complement
The (r-1)'s complement of a number in any number system with base r can be found
out by subtracting every single digit of a number by r-1.

For Example: In the binary number system, the base is 2. Hence, its (r-1)'s i.e., (2-1
=1)'s complement can be obtained by subtracting each bit from 1, i.e., 1's complement
for 001 can also be calculated by subtracting 001 from 111 which will be (111-001) =
(110)2.

Similarly, in the octal number system, the base is 8 so its 7's complement can be
calculated by subtracting each bit by 7, i.e., 7's complement for 347 in octal number
system can be calculated by subtracting 347 from 777 which will yield (777 – 347) =
(430)8.

2) r's complement
The r's complement of a non-zero number in any number system with base r can be
calculated by adding 1 to the LSB of its (r-1)'s complement.

For Example: In binary number system, 2's complement of 001 can be calculated by
adding 1 to the LSB of its 1'complement (i.e., 110 + 1) = (111)2.

Similarly, in octal number system, 8's complement of 347 can be calculated by adding 1
to the LSB of its 7'complement (i.e., 430 + 1) = (431)8.

9's and 10's complement in Decimal Number System


We already know that the decimal number system has its base as 10, As we have
already discussed above, 9's complement of decimal number can be found out by
subtracting its each by 9.

Example 1: Calculate 9's complement of (2457)10

Solution: 9999 – 2457 = (7542)10

Now, 10's complement of a decimal number can be calculated by adding 1 to the LSB of
the 9's complement.

Example 2: Calculate 10's complement of (2457)10

Solution: 10's complement for (2457)10 is calculated by adding 1 to (7542)10 which is


the 9's complement. Therefore, 10's complement of (2457)10 is (7543)10.

Example 3:-Calculate the 7’s Complement & 8’s Complement of


Subtraction Operation Using r’s Complement system

To Perform Subtraction we have to follow the rules

IF A>B Then

1) Find A+r’s Complement of B


2) If A+r’s Complement of B will generate the carry,then we have to discard carry
that will get the actual answer

IF A<B Then

1) Find A+r’s Complement of B


2) If A+r’s Complement of B will not generate the carry
3) We have to again take the r’s complement of Second step that will generate the
Answer but it will be negative answer

Q1. Subtract using 10’s complement 52 – 12 .


We know that 52 – 12 = 40
Let m = 52 and n = 12
Take 10’s complement of 12
+99
-12
_____
+87
Now, 87 is 9’s complement because we subtracted it with 99. To make it 10’s complement
add 1 to 87. The 10’s complement of 12 is 88. Add the 88 to m
+52
+88
______
140
______
Answer : Remove the extra 1 and you get 40
Q2: Subtract using 10’s complement 12 – 52
We know that 12 < 52 , so answer is -40
Let m = 12 and n = 52
10’s complement of 52
+99
-52
______
+47
______
The 9’s complement of 52 is 47. To make it 10’s complement add 1 to 47.
Add 48 to m
+12
+48
_____
+60
_____
This is not the answer , wait
Take one more 10’s complement of the result.
+99
-60
____
+39
____
The 9’s complement of 60 is 39. Add 1 to 39 and make is 10’s complement.
Add negative to the result because m > n.
Answer: -40
Binary Subtraction

A-B where A:-Minuend & B:-Subtrahend

The operation is carried out by means of the following steps:

(i) At first, 2’s complement of the subtrahend is found.

(ii) Then it is added to the minuend.

(iii) If the final carry over of the sum is 1, it is dropped and the result is
positive. (A>B Case)

(iv) If there is no carry over, the two’s complement of the sum will be
the result and it is negative.(A<B Case)

The following examples on subtraction by 2’s complement will make the


procedure clear:

Evaluate:

(i) 110110 - 10110

Solution:

The number of bits in the subtrahend is 5 while that of minuend is 6. We make the
number of bits in the subtrahend equal to that of minuend by taking a `0’ in the sixth
place of the subtrahend.

Now, 2’s complement of 010110 is (101101 + 1) i.e.101010. Adding this with the
minuend.

1 10110 Minuend

1 01010 2’s complement of subtrahend

Carry over 1 1 00000 Result of addition


After dropping the carry over we get the result of subtraction to be 100000.

(ii) 10110 – 11010

Solution:
2’s complement of 11010 is (00101 + 1) i.e. 00110. Hence
Minued - 10110

2’s complement of subtrahend - 00110

Result of addition - 11100


As there is no carry over, the result of subtraction is negative and is obtained by
writing the 2’s complement of 11100 i.e.(00011 + 1) or 00100.
Hence the difference is – 100.

You might also like