Install prerequisites. This program uses GMP, MPFR, and {fmt}. You also need a working C++17 compiler (tested with GCC 10 on Debian 11).
On Debian, run:
sudo apt update
sudo apt install -y build-essential libgmp-dev libmpfr-dev libfmt-devNow compile the source:
c++ -opi pi.cc -std=c++17 -O3 -march=native -lgmp -lmpfr -lpthread -lfmtYou'll have pi executable file in the current directory.
The program takes one argument, number of decimal digits to calculate. For example, to calculate 100 digits of pi, run:
./pi 100