John Allain wrote:
multi-precision
libraries which can handle up to 128 bit integers?
I wanted to get thousands of digits of Pi once and implemented
it using up to 1500 bit precision integers (Yeah Rite).
For this simple program I just used arrays of integers and kept
shifting carry bits to the left or right, depending on whether I was
dividing or multiplying. I got about 500 digits of Pi at the time
(1976). Today we could probably get something like 5000 digits
in 5 seconds on a PC.
I encourage you to try this yourself.
For example an array of (1,0,0,0) divided by 3 would become (0,3,3,3),
minding carries. An array of (0,0,0,5) times 6 would be (0,0,3,0).
Using these two simple tools I was able to get hundreds of digits of Pi
in 2 pages of code.
Jerome Fine replies:
If the code could be written in FORTRAN, it would be
fairly simple. Then common source code could be used.
But, even if possible, FORTRAN is simply not structured
to easily allow multiple operations on succeeding values
which are required when adding carry bits between even two
words, let alone 8 * 16 bit words needed for 128 bit
arithmetic. Which means coding in assembler!
Since I do NOT find that to be a problem, I am not very
concerned. But in case there was already a library around,
I thought I would ask.
By the way, are there any standard algorithms for the
4 basic operations (add, subtract, multiply and divide)
for 128 bit numbers which are composed of 8 * 16 bit
words? As per your suggestion, I would probably use:
CHARACTER * 16 ARRAY ( nnn )
If anyone else has some suggestions, please reply.
Sincerely yours,
Jerome Fine
--
If you attempted to send a reply and the original e-mail
address has been discontinued due a high volume of junk
e-mail, then the semi-permanent e-mail address can be
obtained by replacing the four characters preceding the
'at' with the four digits of the current year.