# COMPLIMENTS

For a number system with base r (with r > 1), there are two types of compliments:

1. r’s compliment
2. (r-1) ‘s compliment

r’s Compliment: If we have a positive number N with integer part of n digits  then we define r’s compliment  as

10’s compliment of number (5432) 10 is 104– 5432 = 10000 – 5432 = (4568) 10

[value of n is 4]

10’s compliment of number (0.5432) 10 is 100– 0.5432 = 1 – 0.5432 = (0.4568) 10

[value of n is 0 as there is no integer  part in this number]

10’s compliment of number (54.32) 10 is 102– 54.32 = 100 – 54.32 = (45.68) 10             [value of n is 2]

2’s compliment of number (110.01) 2 is (23)2– 110.012= 1000 – 110.01 = 001.11         [value of n is 3]

Eg. Find 2’s compliment of (110.01) 2 (value from above example)

Ans: Following the rule we get the answer as 000.1110

(r-1) ‘s compliment: If we have a positive number N with base r and integer part with digits n and fractional part of m digits,  we define (r-1) ‘s compliment as r– r-m– N

9’s compliment of number (5432) 10 is 104– 100 – 5432 = 10000 – 1 –  5432 = (4567) 10

[Value of n is 4 and of m is 0]

9’s compliment of number (0.5432) 10 is 100– 10-4 – 0.5432 = 1 – 0.0001 – 0.5432 = (0.4567) 10

[Value of n is 0 as there is no integer part in this number and of m is 4]

9’s compliment of number (54.32) 10 is 10– 10-2 – 54.32 = 100 – 0.01 – 54.32 = (45.67) 10 [Value of n is 2 and of m is 2]

1’s compliment of number (110.01) 2 is (23)10– (2-2)10 – 110.012= 1000 – 0.01 – 110.01 = 001.10      [Value of n is 3 and of m is 2]

Applying the rule to above example we get the answer as 001.10, the sameJ

Relation between the r’s Compliment and (r-1) ‘s compliment: We can get r’s Compliment from (r-1) ‘s compliment by just adding r-m  and vice-versa by subtracting   r-m

Compliment of compliment: If we take r’s compliment of r’s compliment we get the original number as

Let the original number be N

So r’s compliment is r– N and compliment of compliment is r– (r– N) = N  which is the original number

and the same is for (r-1) ‘s compliment.

Let the original number be N

So r’s compliment is r– r-m – N and compliment of compliment is r– r-m – (r– r-m – N ) = N  which is the original number

1’s compliment and 2’s compliment:  Following table would show the representation of decimal -7 to +8 in 1’s and 2’s compliment. In the signed number , we take the 4th bit as signed bit and make this bit one(‘1’) when ever we have negative number & make it zero(‘0’) when we have a positive number and rest of  the 3 bits are used to represent magnitude.

Comparison of 1’s compliment and 2’s compliment:

• 1’s compliment is easier to implement than 2’s compliment
• While for the subtraction, 2’s compliment is better because for 2’s compliment we need only 1 arithmetic operation while 2 arithmetic operations are needed for 1’s compliment.
• 2’s compliment has only one representation for zero while  1’s compliment has two representation for zero as shown above