These days we sometime hear of topics of the inconceivable digit, for example, when someone say "I found to 100 million decimals using my computer". So, I will describe a basis of program, or a basis for computing numbers of a great number of digits. This includes how to add numbers of 1000 digits.
When dealing with numbers with programs, we can usually deal only with at most numbers of 15 digits or so, and overflow indications will occur if numbers have more than 15 digits. Thus, it is necessary to avoid such errors using techniques in our own way.
Like an elementary school boy, try to compute, for example, 3278*782.
This is how to multiply in decimal base, or denary. It is "bridging" that I would like you to especially notice. We compute digitally one by one, and add what goes over 10 to the next digit.
I compute in 100-ary applying the above.
You can understand that what goes over 100 is added to the following two digits.
Now, addition in 10000-ary will be described.
We have two numbers A and B to be computed. By dividing A and B (both are of 1000 digits) by 4 digits.
A figure from 997th digit to 1000th digit in A is stored into A(250)
A figure from 5th digit to 8th digit in A is stored into A(2).
A figure from 4th digit to 1th digit in A is stored into A(1).
Similarly, figures from B are stored into B(250),,,,,,B(2), and B(1).
Computed results are to be stored into C(250),,,,,,C(2), and C(1).
What is overflowed from 1000-ary is to be rounded down.
For I = 1 to 250 C(I) = 0 Next I For I = 1 to 250 C(I) = C(I) + A(I) + B(I) -------------------Add by four digits IF I = 250 Then C(I) = C(I) - Int(C(I) / 10000) * 10000 Exit For End if C(I + 1) = C(I + 1) + Int(C(I) / 10000) --------Bridge for what goes on and C(I) = C(I) - Int(C(I) / 10000) * 10000 --------Residues generated from Next IAside from this, various computation including subtraction, multiplication, division and addition of decimals can be dealt with by application of "bridging" as computing method at elementary-school level.
Mathematical Formulas| Kodawari House| Pinpoint StreetView|