Hacker News new | ask | show | jobs
by jonhohle 3750 days ago
So don't use a lossy floating point representation and use arbitrary precision instead.

Just because π is estimated to 15 significant digits doesn't mean the entire calculation needs to be.

2 comments

Arbitrary precision is not a valid answer: every multiplication doubles the number of mantissa bits. Starting with a 64-bit precision, after just 40 multiplications, you will have consumed 800 GB of RAM just for storing a single number, at which point you'll ask yourself: how many decimal digits do I really need? Which was the initial question...
Pi cannot be stored exactly even with arbitrary precision.