Just finished calculating pi to 30 trillion places.
#17
Pete, that should work but you need to perform all calculations to digits accuracy
there's a quartic version of the Gauss–Legendre algorithm for Pi, that is the accuracy quadruples on each iteration, but I find that's a bit slower https://en.wikipedia.org/wiki/Approximat...algorithms
the quartic version would be something like the following
Code: (Select All)
    y=2 : y=sqr(y)
    a=6 : a=a-4*y : y=y-1
    p=2
    for k=0 to int(log(NUMBER_OF_DIGITS)*0.72134752044448) '1/ln(4)
        y=y*y : y=y*y 'y^4
        y=1-y : y=sqr(y) : y=sqr(y)
        y=(1-y)/(1+y)
        p=p*4
        yk=y+1
        yk=yk*yk : yk=yk*yk
        a=a*yk-p*y*(1+y+y*y)
    next
    pie = 1/a
    print pie
Reply


Messages In This Thread
RE: Just finished calculating pi to 30 trillion places. - by Jack - 08-16-2022, 02:15 AM



Users browsing this thread: 5 Guest(s)