You are on page 1of 4

MODULE 2 – ADDITION/SUBTRACTION IN BASE R AND COMPLEMENTS

Practice Problems:
1. ABCD.25A16 + FF54.35616
2. FFFEA.F216 + ABCF.FF16 + FACE.FFA16
3. AABB.B712 + 9977.7712
4. 110111.1012 + 1111.1112 + 11001.0012
5. 10000.34516 – FFF.BCE16
6. 7352.369 – 556.569
7. 1001001.112 – 111111.0012
Study Guide/Resources:
1. https://online.math.uh.edu/Math2303-unpaid/ch1/s15/2303-Section-15.pdf
2. https://www.youtube.com/watch?v=vR5c1i18ljQ&feature=youtu.be

COMPLEMENTS
➢ Used in digital computers to simplify the subtraction operation and for logical
operation
Two types of complements for each base – r system
A. Radix complement – r’s complement
B. Diminished radix complement – (r-1)’s complement
Examples :
1. if r is 10 then 9’s complement is the diminished radix complement
and 10’s complement is the radix complement
2. If r is 2 then 1’s complement is the diminished radix complement and
2’s complement is the radix complement
A.Diminished radix complement - (r-1)’s C
Formula : (r-1)’s C = (rn – 1) – N
where : N – the number in base r having n digits

if r = 10 , then (r-1)’s C is 9’s C


if n = 4 , then we have 104 = 10,000
so 104 – 1 = 9999

Examples: find the 9’s complement of:


1. 546700 → 999999 – 546700 = 453299
2. 012398 → 999999 – 012398 = 987601
Note:
➢ In general the (r-1)’s complement of a number in base r is the subtraction of it’s
each digits from (r-1)
➢ the 1’s C of a binary number is formed by inverting each bit
example : the 1’s C of 101102 is 010012
Exercise: Find the (r-1)’s C
1. 356278
2. AB67F16
3. 542326
4. 10111012

B.The radix complement – r’s C


Formula: r’s = rn – N (or simply the (r-1)’s C + 1)
Example: Find the r’s C of the following:
1. 346158
2. ABDFC16
3. 1011012
4. 642639
Subtraction with complements
➢ The subtraction of a 2-digit unsigned numbers M – N in base r can be done as
follows :
1. Add the minuend M to the r’s complement of the subtrahend N.
2. If M ≥ N, the sum will produce and end carry, which is discarded, the result is
M – N.
3. If M ≤ N, the sum does not produce an end carry. To obtain the answer, take
the r’s C of the sum and place a negative sign in front.
Examples : Subtract using complements:
1. 7253210 – 325010
a. M = 72532 , N = 3250 = 03250 (no. of digits of M and N should be the same)
b. Get the 10’s C of N → (99999 – 93250) + 1 = 96750
c. Add M and r’s C of N → 72532 + 96750 = 169282
d. Discard the end carry of 169282 → final answer is 6928210

2. 325010 – 7253210 (note that M < N)


a. M = 03250, N = 72532
b. 10’s C of N → (99999-72532)+1 = 27468
c. Add M and r’s C of N → 03250 + 27468 = 30718
d. Get the 10’s C of sum since M<N → (99999-30718)+1 = 69282
e. Place a negative sign in front of sum → -6928210

3. If X = 10101002 , Y = 10000112, find a) X – Y , b) Y – X


a.) 2’s C of Y = 0111101
sum= 100012 (X + 2’s C of Y )
b.) 2’s C of X = 0101100
sum= 1101111 (Y + 2’s C of X)
Since M < N, get the 2’s C of sum → 0010001
Place a negative sign in front of sum → -100012

Exercise: Subtract using complements


1. 56328 – 45678
2. FAB16 – 456716
3. 1010112 – 111012
4. A67313 – 987613
5. 7822 - 8789

This module may contain errors. Please don’t hesitate to report such errors

You might also like