0% found this document useful (0 votes)
242 views20 pages

Complements: 2 Types of Complements R's Complement (r-1) 'S Complement

The document discusses two types of complements - r's complement and (r-1)'s complement. R's complement is used to subtract numbers in base r by adding the minuend to the r's complement of the subtrahend. (R-1)'s complement is similar but for numbers with fractional parts, where the (r-1)'s complement is added instead. Examples are provided of subtracting numbers step-by-step using both r's and (r-1)'s complements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
242 views20 pages

Complements: 2 Types of Complements R's Complement (r-1) 'S Complement

The document discusses two types of complements - r's complement and (r-1)'s complement. R's complement is used to subtract numbers in base r by adding the minuend to the r's complement of the subtrahend. (R-1)'s complement is similar but for numbers with fractional parts, where the (r-1)'s complement is added instead. Examples are provided of subtracting numbers step-by-step using both r's and (r-1)'s complements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPLEMENTS

2 Types of Complements

r’s Complement
(r-1)’s Complement

Logic Circuits and Switching Theory by: Engr. Marzan


r’s complement
Given a number N with a base of r and n number
of integer part, the formula in getting the r’s
complement of N is taken as follows:

𝒓𝒏 − N

Logic Circuits and Switching Theory by: Engr. Marzan


r’s complement
Example:

Take the r’s complement of the following:

a. 2345.2610
b. 10110.0112

Logic Circuits and Switching Theory by: Engr. Marzan


1. Solution:

Logic Circuits and Switching Theory by: Engr. Marzan


2. Solution:

Logic Circuits and Switching Theory by: Engr. Marzan


(r-1)’s complement
Given a number N with a base of r and n number
of integer part, and m number of fractional part,
the formula in getting the (r-1)’s complement of
N is taken as follows:

𝒓𝒏 − 𝒓𝒎 − N

Logic Circuits and Switching Theory by: Engr. Marzan


(r-1)’s complement
Example:

Take the (r-1)’s complement of the following:

a. 2345.2610
b. 10110.0112

Logic Circuits and Switching Theory by: Engr. Marzan


1. Solution:

Logic Circuits and Switching Theory by: Engr. Marzan


2. Solution:

Logic Circuits and Switching Theory by: Engr. Marzan


Subtraction Using Complements

Logic Circuits and Switching Theory by: Engr. Marzan


Subtraction Using
r’s Complement
Given a minuend M and a subtrahend N, to perform M-N,
the following steps are followed:

1. Add the minuend M to the r’s complement of N.


2. Check the result in step 1 for an end carry
a. If an end carry occurs, discard the end carry and
the remaining is the difference.
b. If an end carry does not occur, take the r’s
complement of the result in step 1 and preceed
the result with a negative sign. Then that will be
the difference.
Logic Circuits and Switching Theory by: Engr. Marzan
Examples:
Subtract the following using r’s Complement:

1. 4567.23410 - 326.210
2. 326.210 - 4567.23410

Logic Circuits and Switching Theory by: Engr. Marzan


Solution to #1: (Perform 4567.234 – 326.2)

Difference

Logic Circuits and Switching Theory by: Engr. Marzan


Solution to #2: Perform 326.2 – 4567.234

Difference
Logic Circuits and Switching Theory by: Engr. Marzan
Subtraction Using
(r-1)’s Complement
Given a minuend M and a subtrahend N, to perform M-N,
the following steps are followed:

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


2. Check the result in step 1 for an end carry
a. If an end carry occurs, discard the end carry, add
1 to the least significant digit to get the
difference..
b. If an end carry does not occur, take the (r-1)’s
complement of the result in step 1 and preceed
the result with a negative sign to get the
difference.
Logic Circuits and Switching Theory by: Engr. Marzan
Examples:
Subtract the following using (r-1)’s
Complement:

1. 4567.23410 - 326.210
2. 326.210 - 4567.23410

Logic Circuits and Switching Theory by: Engr. Marzan


Difference

Logic Circuits and Switching Theory by: Engr. Marzan


Difference

Logic Circuits and Switching Theory by: Engr. Marzan


Try it Yourself:

Think of numbers for you to


subtract and try to apply the use
of complements to get its
difference

Logic Circuits and Switching Theory by: Engr. Marzan


END

Logic Circuits and Switching Theory by: Engr. Marzan

You might also like