Tip: Calculate Pi on Pi Day

Share your own howto's etc. Not for support questions!

Tip: Calculate Pi on Pi Day

Postby Hallvor » 2020-03-14 11:40

14th of March is Pi Day. It is an annual celebration of the mathematical constant π (pi). If you want to calculate Pi, you can do it yourself with the following command, where the number after = is the number of decimals you want to calculate:

Code: Select all
$ echo "scale=1000; 4*a(1)" | bc -l


If you want to calculate large amounts of data, I recommend saving the output to a text file. It can be done like this:

Code: Select all
$ echo "scale=1000; 4*a(1)" | bc -l > pi.txt
Lenovo ThinkPad T440S, Intel Core i7-4600U CPU @ 2.10GHz, 8 GB RAM, 256 GB SSD, Debian Buster (KDE)
Lenovo ThinkPad X240, Intel Core i5-4300U CPU @ 2.90GHz, 8 GB RAM, 120 GB SSD, Debian Buster (KDE)
User avatar
Hallvor
 
Posts: 1031
Joined: 2009-04-16 18:35
Location: Norway

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable