Re: [OT] 355/113 and pi Message #22 Posted by Gilles Carpentier on 26 July 2012, 4:52 p.m., in response to message #15 by Gerson W. Barbosa
Hi Gerson,
here is the program for 2000 decimals.
«
2000 ALOG
0 DUP 1701 FOR k
k 1. DISP
k DUPDUP 151 * SWAP SQ DUP 120 * ROT + 47 + 5. PICK *
UNROT
DUP SQ 512 * UNROT DUP2 * 1024 * UNROT 712 * SWAP 194 * 15 + + + + 16 k ^ *
IQUOT +
NEXT
»
It's only 207 Bytes. It requires no extension precision library. It only use the 'infinite' integer possibility of the 50G. In this case, it works with a 2000 digits integer number.
The idea is :
10^2000 * * 10^2000
I evaluate the Plouffe formula with the 50G and transform it in full RPN (but it is not obvious it's faster that the algebraic, I dont try, but there is sometimes surprises with this !)
Must run in exact mode, uncheck LASTARG
With full speed emu48, it takes 18 minutes. Much more on a real 50G (many hours ?) (the emulator is much faster that the real calc with long integer, more than for other calulations...)
The number of iterations (here 1701 for 2000 décimals) is calculated with :
2+log(8n)+n*log(16)
For example, if you want 200 decimals to test, just change :
2000 ALOG -> 200 ALOG
1701 -> 247 (numbers of iterations)
So it possible to modify the program to ask the number or decimal you want... I tried with 5000 but it seems that a 5000 digits integer is too big for the 50G (Just try 5000 ALOG, you will get an error) ! It is very 'economic' in memory because 1 digit is only a nibble ( 1 octet for 2 digits !)
PS : I deleted some library on my EMU48 and try again with 5000 digits.... My computer will work this night ;)
PS : Gerson in your link, there is a PASCAL version. Seems very easy to use it for the 39Gii (copy and paste and few change !)
What does the :nn here
WriteLn(n:4,a:22:17,b:22:17);
?
Edited: 26 July 2012, 5:22 p.m.
|