Pi calculation not accurate

Repl link: https://replit.com/@s3D27ZHOU/Const-Calculator#Pi.py

No matter how I calculate, it is a complete mess of wrong output after the 28th digit, just askin for help

I’m using the chudnovsky algorithm btw, AI just say “Message chunk times out” when I ask how to improve.

The only things that could cut off precision are floats and not precise enough Decimals.

x += Decimal(P(n)/Q(n))*((545140134*n)+13591409)

Perhaps P(n)/Q(n)? Looks like a precision bottleneck. I really don’t know anywhere else where the error may be (everything else are integers).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.