Calculate a million digits of Pi within seconds

250 points El_Kasztano 33 comments

Happy Pi Day!

I wanted to see how far I could go with calculating Pi using Rust on a regular desktop machine. I came across the Chudnovsky algorithm and the binary splitting technique. On my Intel Core i7 (10th gen) it takes now a little more than three seconds to calculate one million digits of Pi, which is amazing. All in all it was basically an exercise on various multithreading techniques and I am still not entirely sure if I could make it even faster.

Please let me know what you think!

Repository: https://github.com/elkasztano/piday25