Professional Documents
Culture Documents
Dr. Arunachalam V
Associate Professor, SENSE
Introduction
• Dividend(D) is divided by the divisor (d) to get the quotient (Q) and the
reminder (R).
• = × +
• Division is the next operation to consider after multiplication.
• Optimizing division is almost as important as optimizing multiplication,
since division is usually more expensive, thus the speedup obtained on
division will be more significant.
• On the other hand, one usually performs more multiplications than
divisions.
• One strategy is to avoid divisions when possible, or replace them by
multiplications.
• An example is when the same divisor is used for several consecutive
operations; one can then precompute its inverse.
Types of division
• We distinguish several kinds of division:
• Full division computes both quotient and remainder,
• While in other cases only the quotient (for example, when dividing two
floating-point significands) or remainder (when multiplying two residues
modulo n) is needed.
• Exact division — when the remainder is known to be zero — and the
problem of dividing by a single word.
Normalized divisors
• In all division algorithms, we assume that divisors are normalized.
• We say that ≔ ∑ is normalized when its most significant word
satisfies ≥ ⁄2.
• This is a stricter condition (for β>2) than simply requiring that be
nonzero.
Naive Division
j = m – 1 = 1,
∗ = 2 × 10 + 4 /2 = 12 = 12, 9 = 9
i 5 4 3 2 1 0 n = 3, m = 3
ai 766 970 544 842 443 844
bi 862 664 913
= 766 970 544 842 443 844 ≥ 862 644 913 000 000 000 ∶ ∴ =0
j = m – 1 = 2,
∗ = 766 × 1000 + 970 /862 = 889 = 889, 999 = 889
← 766 970 544 842 443 844 − 889 × 1000 × 862 664 913
← 766 970 544 842 443 844 −889 × 862 664 913 000 000 = 061 437 185 443 844
862 664 913 000 000 × 889
766 590 811
318 296 657 000 000
-766 909 107 657 000 000
766 970 544 842 443 844
061 437 185 443 844
i 4 3 2 1 0
ai 061 437 185 443 844
bi 862 664 913
j=1
∗ = 61 × 1000 + 437 /862 = 71 = 71, 999 =71