Calculate pi to an arbitrary number of decimal places

bc -l <<< "scale=1000; 4*a(1)"

3
2020-03-11 15:58:21
bc

1 Alternatives + Submit Alt

  • Change the scale to adjust number of decimal places prefix the command with "time" to benchmark the computer (compare how long it takes to calculate 10000 digits of pi on various computers). Show Sample Output


    1
    echo "scale=1000; 4*a(1)" | bc -l
    regulatre · 2014-07-31 19:13:26 0

What Others Think

Thanks, I'll do that everyday from now on https://linktr.ee/DonaldTrump
pascalv · 26 weeks and 4 days ago
pascalv · 26 weeks and 4 days ago
When you choose the competition, you may not be getting the newest and latest episodes and movies. Have you ever heard of a brand new film that just came out, went to a free movie site, and found it unavailable? This happens quite frequently with our competition. They just don’t have the time or energy to keep up with the newest shows on the airwave1123movies unblock. they just go for Unlike them, we keep our catalog updated regularly, so you always have access to the latest TV shows and movies.
leqeen · 26 weeks and 2 days ago
Calculator all-time help me in my exams special in math subject we all depend on this. I used an online calculator you want to join then Click
Elie77 · 13 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: