Javatpoint Logo
Javatpoint Logo

Radix and Diminished Radix complement

The mostly used complements are 1's, 2's, 9's, and 10's complement. Apart from these complements, there are many more complements from which mostly peoples are not familiar. For finding the subtraction of the number base system, the complements are used. If r is the base of the number system, then there are two types of complements that are possible, i.e., r's and (r-1)'s. We can find the r's complement, and (r-1)'s complement of the number, here r is the radix. The r's complement is also known as Radix complement (r-1)'s complement, is known as Diminished Radix complement.

If the base of the number is 2, then we can find 1's and 2's complement of the number. Similarly, if the number is the octal number, then we can find 7's and 8's complement of the number.

There is the following formula for finding the r's and (r-1)'s complement:

r' s= complement=(rn )10-N
(r-1)' s complement={(rn)10-1}-N

In the above formulas,

  • The n is the number of digits in the number.
  • The N is the given number.
  • The r is the radix or base of the number.

Advantages of r's complement

These are the following advantages of using r's complement:

  • In r's complement, we can further use existing addition circuitry means there is no special circuitry.
  • There is no need to determine whether the minuend and subtrahend are larger or not because the result has the right sign automatically.
  • The negative zeros are eliminated by r's complement.

Let's take some examples to understand how we can calculate the r's and (r-1)'s complement of binary, decimal, octal, and hexadecimal numbers.

Example 1: (1011000)2

This number has a base of 2, which means it is a binary number. So, for the binary numbers, the value of r is 2, and r-1 is 2-1=1. So, we can calculate the 1's and 2's complement of the number.

1's complement of the number 1011000 is calculated as:

={(27 )10-1}-(1011000)2
={(128)10-1}-(1011000)2
={(127)10}-(1011000)2
=11111112-10110002
=0100111

2's complement of the number 1011000 is calculated as:

=(27 )10-(1011000)2
=(128)10-(1011000)2
=100000002-10110002
=01010002

Example 2: (155)10

This number has a base of 10, which means it is a decimal number. So, for the decimal numbers, the value of r is 10, and r-1 is 10-1=9. So, we can calculate the 10's and 9's complement of the number.

9's complement of the number 155 is calculated as:

={(103 )10-1}-(155)10
=(1000-1)-155
=999-155
=(844)10

10's complement of the number 1011000 is calculated as:

=(103 )10-(15510
=1000-155
=(845)10

Example 3: (172)8

This number has a base of 8, which means it is an octal number. So, for the octal numbers, the value of r is 8, and r-1 is 8-1=7. So, we can calculate the 8's and 7's complement of the number.

7's complement of the number 172 is calculated as:

={(83 )10-1}-(172)8
=((512)10-1)-(132)8
=(511)10-(122)10
=(389)10
=(605)8

8's complement of the number 172 is calculated as:

=(83 )10-(172)8
=(512)10-1728
=51210-12210
=39010
=6068

Example 4: (F9)16

This number has a base of 16, which means it is a hexadecimal number. So, for the hexadecimal numbers, the value of r is 16, and r-1 is 16-1=15. So, we can calculate the 16's and 15's complement of the number.

15's complement of the number F9 is calculated as:

{(162 )10-1}-(F9)16
(256-1)10-F916
25510-24910
(6)10
(6)16

16's complement of the number F9 is calculated as:

{(162 )10 }-(F9)16
25610-24910
(7)10
(7)16






Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA