[This page is auto-generated; please prefer to read the article’s PDF Form.]
Let us denote the dividend by a = (ana−1ana−2…a1a0) having na digits, and the divisor by b = (bnb−1bnb−2…b1b0) having nb digits, in base B numeral system. The case when na < nb simply implies the quotient is 0 and remainder is a. So, we only need to consider the other case, na ≥ nb.
The long-division algorithm can be seen as an iterative process where each iteration generates exactly one quotient-digit. In each iteration, the “current” IDD x, having width nb + 1 is considered and a digit d needs to be found such that:
Once this quotient-digit d is found, subtraction (x−bd) is done and the next digit from a is suffixed to the result, to form the next IDD. This continues until there are no more digits to bring down from a. At that point, the subtraction result, (x − bd), is the remainder of this division.
Note that the result of subtraction t = (x − bd) in any iteration follows:
|
i.e. t ≤ b − 1. So, t has at most nb digits.
The next IDD, which is formed by suffixing a digit (say, ai) from a to t is (tB + ai), and must have at most nb + 1 digits. Also, it must follow:
|
The initial IDD is also chosen as having nb digits from the dividend, and must be less than bB, which has nb + 1 digits. So, we can conclude that every IDD must have at most nb + 1 digits, and must be less than bB. Though, as mentioned earlier, we will always be treating them as having width nb + 1.
Further, any number d which satisfies (1) must follow d ≤ x∕b < bB∕b = B. That is, d ≤ B − 1, and so d must be a single digit number.
Now we look into the problem of computing quotient-digit d in each iteration.
Copyright © 2021 Nitin Verma. All rights reserved.