Calculating PI in Rust

I'm trying to calculate PI up to one million digits using the Chudnovsky algorithm or any machin-like formulas using Rust's safe concurrency, after implementing it in Python. I'm curious about the speed difference, knowing that Rust is compared with C/C++ in terms of speed. My question is: do any of you guys have something like this implemented or know any information on how to approach this? Any help would be highly appreciated!

I think one could technically use template metaprogramming in C++ so the runtime is effectively O(1) --- minus the compile time :slight_smile: --- but that's a moot point. Not sure what is its equivalent in Rust.

Very not trivial. Template metaprogramming doesn't work with floating point numbers. But in new editions constant evaluation is pretty good so constexpr should also make it whole in compile time.

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