How do I print pi (3.14159)?
If you have tex(1)
installed:
tex --version | head -1 | cut -f2 -d' '
You can use this command:
echo "scale=5; 4*a(1)" | bc -l
3.14159
Where scale is the number of digits after decimal point.
Reference: http://www.tux-planet.fr/calculer-le-chiffre-pi-en-ligne-de-commande-sous-linux/
For printing with arbitrary precision, you could use bc
and the formula pi = 4*atan(1)
:
# bc -l
scale=<your precision>
4*a(1)