More details can be found in https://en.wikipedia.org/wiki/Pi and https://en.wikipedia.org/wiki/Approximations_of_%CF%80 and http://www.thefullwiki.org/Pi_approximation
Some algorithms can be found in http://myownlittleworld.com/miscellaneous/computers/pilargetable.html and https://thestarman.pcministry.com/math/pi/piprogs.html
GMP: https://gmplib.org/
\[\begin{align*} \frac{1}{\pi}=12\sum_{n=0}^\infty\frac{(-1)^n(6n)!}{(3n)!(n!)^3} \frac{13591409+545140134n}{640320^{3n+3/2}} \end{align*}\]
\[\begin{align*} \pi=\frac{426880\sqrt{10005}}{\sum_{n=0}^\infty\frac{(6n)!(13591409+545140134n)}{(3n)!(n!)^3(-640320)^{3n}}} \end{align*}\]