Closed Captioning Closed captioning available on our YouTube channel

How to use the pi command: 2-Minute Linux Tips

Network World | Feb 26, 2021

In this Linux tutorial, learn how to use the pi command. You probably won't need it very often, but, if you need to calculate pi to some arbitrary number of digits, you'll probably be surprised at how easy this can be.

Copyright © 2021 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the pi command. It's probably not one that you will need very often but, if you need to calculate pi to some arbitrary number of digits, you'll probably be surprised at how easy this can be.
Without any arguments, the pi command will spit out the first 100 digits:
If you want to see only 10 or a million digits, supply that number as an argument. For a million digits, you might have to wait a few seconds for your answer. We'll time it to see a measure of how long it takes.
Calculating a billion digits should take about 1,000 times as long (maybe an hour?), so you might not want to do that unless you're very patient.
If you want to try for a world record, you will have to calculate more than 31.4 trillion digits to beat the record set in 2019 by a Google cloud developer (Emma Haruka Iwao). I'm assuming. She wasn't using the pi command and, hopefully, found a more efficient approach.

That’s your Linux tip for the pi command. I hope you math enthusiasts are excited and will share your new favorite command every March 14th (Pi Day).
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.

Popular
Featured videos from IDG.tv