EnggPedia - The Engineering Encyclopedia

Thu02232017

Last update06:04:15 AM

Font Size

Profile

Menu Style

Cpanel
Back Computer Computer Engineering Dictionary Dgital Logic Design Complements - Types of Complements, Radix & Diminished Radix Complement

Complements - Types of Complements, Radix & Diminished Radix Complement

Definition:

In digital computers, complements are used for simplifying subtraction operation and logical manipulation. There are two types of complements for binary as well as decimal number system.

  1. Radix Complement (r's complement)
  2. Diminished Radix Complement (r-1 complement)

For Binary Number System, the radix complement is known as 2's complement and Diminished Radix Complement is 1's complement. For Decimal Number System, radix complement is known as 10's complement and Diminished Radix Complement (r-1 complement) is 9's Complement.

Radix Complement (r's complement) :

Assume that we are given any number N having digits n in base r system,then r's complement can be defined as r^n-N for N not equal to zero and 0 for N=0.See the Examples given below.

rs-complement

The 10's complement of 52520 is obtained by subtracting the first non zero least significant digit in the given number from 10 and subtracting the rest from 9.if the least significant digits is 0 in the given number,they are left unchanged as shown in the example above. While calculating the 2's complement,the first non zero least significant bit is subtracted from 2 and the remaining are subtracted from 1.if the least significant digits is 0 in the given number,they are left unchanged as shown in the example above.2's complement can also be calculated by first taking the 1's complement(explained below) of the given number and then adding 1 to the least significant bit of the 1's complement.

Remember that:

  1. 10's complement is calculated for N=1,2,3,4,5,6,7,8,9,0 and 2's complement for binary numbers i.e 0 & 1 only.
  2. Taking Complement of the complement,we get the original number restored.

Diminished Radix Complement (r -1 complement) :

Assume that we are given any number N having digits n in base r system,then r-1 complement can be defined as (r^n)-r^(-m)-N .the concept will become clear by understanding the examples given below.

Subtraction wit Complements:

When Subtraction is done in digital computers, subtraction with complements is found to be much more efficient than ordinary subtraction method.

Subtraction with r's complement Method:

Assume that you want to subtract two unsigned numbers i.e a number N (subtrahend) from M(minuend) ,then For (M - N)r

1. Add M to the r's complement of N

2. Inspect the result for an end carry: a.If an end carry occurs, discard it b.If an end carry does not occur, take the r's complement of the result (Step-1) and place a negative sign in front subtractionrs

Note that a "0" is added to the left side of the number"3250" in both examples,this is because the numbers of digits must be same for doing subtraction with complements.Secondly,when we use complements for subtraction, then we can recognize a negative answer by the absence of the end carry and the complemented result.

subtractionrs

Subtraction with (r - 1)'s complement Method:

Assume that you want to subtract two unsigned numbers i.e a number N (subtrahend) from M(minuend) ,then For (M - N)r

1.Add M to the (r-1)'s complement of N

2. Inspect the result of Step-1 for an end carry: a.If an end carry occurs. Add 1 to the LSB. b.If an end carry does not occur, take (r-1 )'s complement of the result of 1 and place a negative sign in front. substraction example subtractionrs

Comparison of 1's and 2's Complement:

  1. 1's complement:

Advantages:

1. Easier to implement.

2. Very useful for logical manipulations (i.e. non-arithmetic applications)

Disadvantages:

1. Requires two arithmetic addition operations

2. Its complement 0 can be +ve or -ve which may complicate matters e.g 1100 - 1100 = 1100 + 0011 = 1111 =-0000

  1. 2's complement

Advantages:

1. Only 1 arithmetic addition operation is required.

2. Its complement has +ve zero 1100 - 1100 = 1100 + 0100 = + 0000

3. It is used in conjunction with arithmetic applications

Disadvantages:

1. Requires more steps to implement

Related Articles to this Article
Anomalies: Anomalies are problems that can occur in poorly planned, un-normalized databases where al
In digital computers, complements are used for simplifying subtraction operation and logical manipu
Read more similar Articles