Introduction
Complements are used in digital computers for simplifying the manipulation of logical operations. Subtraction operation in binary can be simplified by using complements as signed binary numbers can be expressed using the complement.
Here, we will describe basic concepts of complements and its types.
Recommended Topic, Microinstruction in Computer Architecture and Difference Between Jfet and Mosfet
Complements
There are two types of complements for each r-based number system. These are the radix complement and diminished radix complement.
Let’s discuss each type of complement with examples.
Diminished Radix Complement or (r-1)’s complement
This complement is defined as if there is a number N in base r having n digits, the
Diminished Radix Complement or (r-1)’s complement of N is (r^n - 1) - N .
Example
So for a 6-digit decimal number( base 10) N, Diminished Radix Complement or (r-1)=9’s complement is (10^6 - 1) - N = 999999 - N
For, a 6-digit binary number N, (2-1)= 1’s complement is (2^6 - 1) - N = 111111 - N
So, 1’s complement of 101100 is (111111 - 101100) =010011
Also Read - Shift Registers in Digital Electronics
Characteristic
- While computing the Diminished Radix Complement, subtraction from (r^n - 1) will never require a borrow.
- This complement can be computed digit by digit.
Radix Complement or r’s complement
Radix complement of an n-digit number N in base r is defined as (r^n - N) for N ≠ 0 and as 0 for N = 0.
Example
So for a 6-digit decimal number( base 10) N, Radix Complement or r =10’s complement is (10^6 - N ).
For a 6-digit binary number N, 2’s complement is (2^6 - N)
So, 2’s complement of 1101100 is 0010100.
Characteristic
r’s complement can be obtained by adding 1 to the (r-1)’s complement as
(r^n - N) =[ (r^n - 1) - N ] +1