commands → pi
pi()
The pi command returns an approximation to pi.
Examples
# hardware floats
pi();
3.14159265358979
# software floats
digits(30);
30
pi();
3.14159265358979323846264338327
Algorithm
To approximate pi in extended precision we use the Gauss-Legendre algorithm.
References
The Gauss-Legendre Algorithm on Wikipedia
Gullberg, Jan. Mathematics: From the Birth of Numbers. Norton, 1996.