0% found this document useful (0 votes)
8 views25 pages

DLD Lecture No. 5 Complement of Numbers 9 October 24

Uploaded by

ahmedrehan4040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views25 pages

DLD Lecture No. 5 Complement of Numbers 9 October 24

Uploaded by

ahmedrehan4040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Department of Avionics Engineering

Digital Logic Design (208412)

Lecture No 5

Complement of Numbers

Wednesday 9th October 2023


Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Base Conversion of Numbers with Fractions
Introduction
• Complements are used in digital computers to simplify the
subtraction operation and logical manipulation.
• Simplifying operations leads to simpler, less expensive
circuits to implement the operations.
• There are two types of complements for each base‐r
system:
• Radix Complement and
• Diminished Radix Complement.
Introduction
r’s complement (r - 1)’s complement
(Radix Complement) (Diminished Radix Complement)

2’s complement 1’s complement

10’s complement 9’s complement


Introduction
• The first is referred to as the r’s complement and
• The second as the (r - 1)’s complement.
• When the value of the base r is substituted in the name, the two
types are referred to as the
• 2’s complement and 1’s complement for binary numbers and
• 10’s complement and 9’s complement for decimal numbers.
Radix Complement (r’s Complement)
• If we are given a number N in base-r having n digits the (r)’s
Complement or Radix Complement is defined as: rn - N
• Let N = 12345 and n = 5 and r = 10. So 10’s complement of N is
100000 - 12345 = 98765
Radix Complement (r’s Complement)
(10’s Complement)
• Calculate 10’s Complement of following numbers:

• 23456

• 5151

• 36547

• 9632541
Radix Complement (r’s Complement)
(2’s Complement)
• If we are given a number N in base-r having n digits the (r)’s
Complement or Radix Complement is defined as: rn - N
• Let N = 010101, n = 6 and r = 2,
So 2’s complement is 1’s complement +1 i.e. change 1 to 0 and 0 to 1
and then add 1 to the number.
So 2’s complement of 010101 is 101010+1 = 101011
2’s Complement
2’s Complement
Radix Complement (r’s Complement)
(2’s Complement)
• Find out 2’s Complement of following binary numbers:

• 10010

• 1010101

• 0001

• 10001
Diminished Radix Complement
((r-1)’s Complement) / 9’s Complement)
Diminished Radix Complement
((r-1)’s Complement) / 9’s Complement)
• If we are given a number N in base-r having n digits the (r-1)’s complement or
Diminished Radix complement is defined as (rn - 1) - N
• Example 1:
• Let us take r = 10 i.e. we need to find 9’s complement of a number. Let the
number be N, then 9’s complement of N is 10n -1 -N i.e. 999....99 (n digits) - N
• Example 2:
• Let us take N =1988. Here, r = 10 and n = 4, so 9’s complement of 1988 is 9999 -
1998 = 8001
• Example 3:
• Let us take N = 01234. Here, r = 10 and n = 5, so 9’s complement of 01234 is
99999 - 01234 = 98765
Diminished Radix Complement
((r-1)’s Complement) / 9’s Complement)

• Find out 9’s Complement of following numbers:

• 12345

• 456789

• 101456

• 98765
Diminished Radix Complement
((r-1)’s Complement) = 1’s Complement)

• For binary numbers, r = 2


• So 2n is represented as 100…00 (1 followed by n 0’s)
• This implies 2n -1 is represented as 1…11(n 1’s)
• In the case of binary 1’s complement, we see that it has all 1’s i.e. 1-1=0 and 1-
0=1
• This means if we just change 1 from 0 and 0 from 1, we directly get its
complement.
• Example 4:
• Let us take N = 010010 and r = 2 and n = 6. So directly 1’s complement of N is
• 111111-010010 = 101101
Diminished Radix Complement
((r-1)’s Complement) = 1’s Complement)
Diminished Radix Complement
((r-1)’s Complement) = 1’s Complement)

• Find out 9’s Complement of following numbers:

• 10101

• 111111

• 101

• 00001
Q&A

You might also like