Complement System and Substraction of Number Using R's Complement
Complement System and Substraction of Number Using R's 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.
Now, 10's complement of a decimal number can be calculated by adding 1 to the LSB of
the 9's complement.
IF A>B Then
IF A<B Then
(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)
Evaluate:
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
Solution:
2’s complement of 11010 is (00101 + 1) i.e. 00110. Hence
Minued - 10110