[VA] SRC#006- Pi Day 2020 Special: A New Fast Way to Compute Pi
|
03-16-2020, 11:15 AM
(This post was last modified: 03-16-2020 01:13 PM by J-F Garnier.)
Post: #13
|
|||
|
|||
RE: [VA] SRC#006- Pi Day 2020 Special: A New Fast Way to Compute Pi
(03-15-2020 06:08 PM)Albert Chan Wrote: Slightly optimized version, using less operations. Ok, now let's try the next iteration, on the 35-digits Decimal Free42. The program is easily ported to RPN, thanks to Albert's structured code: Code: # FNM(X)=X*(5-X*X*(4+16*(1-X)*(1+X))) xeq fnp 3,141120008059... xeq fnp 3,14159265357... xeq fnp 3,141592653589[636096612966527996358] 13 correct digits. Not accurate enough. Let's try with 5 calls to fnm: Code: lbl fns 3 xeq fnp xeq fnp xeq fnp 3,1415926535897932[28408529447963301] Still not accurate enough. Let's try to add 1 term in the sin expansion: Code: # FNT(X)=X*(1-X*X/6*(1-X*X/20*(1-X*X/42))) xeq fnp xeq fnp xeq fnp 3,14159265358979323846264[6911462229] 24 correct digits. Still not accurate enough. Let's try to add another term in the sin expansion: Code: # FNT(X)=X*(1-X*X/6*(1-X*X/20*(1-X*X/42*(1-X*X/72) ))) xeq fnp xeq fnp xeq fnp 3,14159265358979323846264338327[8692] 30 correct digits. Let's stop here. Total 9 + 5*5 = 34 mult/div operations, with optimizations (avoiding to calculate x*x several times) J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)