If you’re new to the world of circular math, you might be content with referring to pi as 3.14. If you’re getting a little more busy with geometry, science, or engineering, you might have tacked on a few extra decimal places in your usual calculations. But what about the big dogs? How many decimal places do NASA use?
Thankfully, the US space agency has been kind enough to answer that question. For the highest precision calculations, which are used for interplanetary navigation, NASA uses 3.141592653589793 — that’s fifteen decimal places.
The reason why is quite simple, going into any greater precision is unnecessary. The article demonstrates this by calculating the circumference of a circle with a radius equal to the distance between Earth and our most distant spacecraft, Voyager 1. Using the formula C=2pir with fifteen decimal places of pi, you’d only be off on the true circumference of the circle by a centimeter or so. On solar scales, there’s no need to go further.
Ultimately, though, you can calculate pi to a much greater precision. We’ve seen it done to 10 trillion digits, an effort which flirts with the latest Marvel movies for the title of pure irrelevance. If you’ve done it better or faster, don’t hesitate to let us know!
sounds about like what fits in a 64-bit float (double in most compilers). you can always catch the nan exception and perform the calculation with fixed point math if neccisary.
That’s exactly what it is – as in, if you add decimals, the double value won’t change. The “off by a centimeter on the scale of the Solar System” is just a friendly description of what double precision provides.
Of course, the funny part is that you shouldn’t be specifying pi in decimal digits anywhere, it should be specified in the format being used.
http://mimirgames.com/articles/programming/digits-of-pi-needed-for-floating-point-numbers/
and you definitely shouldn’t be using Doom’s version
My former Data Communications instructor informed us “a rule of thumb for Pi is 2”.
B^)
Oh, and kudos for including DOOM in the comments!
my favorite code snippets out there are the ones that undefine PI and redefine it as DOOM’s Pi.
You can specify Pi in decimal, and get exactly the same floating point number down to the last bit, is if you specified the bits directly.
Yeah, I probably didn’t clarify that right – what I meant was you shouldn’t specify a decimal approximation to the float you plan on using, you should specify the float value directly: as in, the value of pi that’s listed here is not actually what’s in the double: it’s a decimal approximation to the double value.
C, for instance, defines M_PI beyond this (as a decimal) to accomodate constant multiplication so you don’t drift from a “true” value, but this also means that stuff that should be completely exact in floating point isn’t depending on the compiler, and it also means it can be a bit hard to figure out exactly what value is being used.
At the double level it really doesn’t matter because everyone just assumes part-in-2^50-ish errors are going to show up everywhere. It can be annoying if someone writes a simulator in a different language that handles the constants differently.
But I’m a fan of actually specifying what the exact values are for readability, and any float value is exactly representable in decimal, but the reverse isn’t true (since there’s a 2 in 10 but no 5 in 2).
You would need log2(5)=2.32…[to 34 digits] times as many digits to represent the binary representation of pi exactly than needed to get exact binary representation in IEEE 754. And the last 19 digits are not pi anyway. Where’s the joy in that?
The joy is in watching scaled constants cancel exactly.
When I was studying numerical meteorology, I know that if I used double-precision Pi in my numerical models I’d induce enough gravity waves in a forecast to predict a snowstorm, in Florida, in July.
Please post details.
Keeping in mind that I was a student in the late 1980s, and the easiest programming language for most of the students was QBASIC, the issue that arises is matching the precision of the incoming data with the precision of the numerical constants (of which Pi is just one of them). QBASIC at the time could be run in double-precision or single-precision mode (basically, the number of digits after a decimal point). Using 3.1415926 instead of 3.14159 caused serious problems after about 8 hours of prediction.
And you trusted your meteorological predictions to 7 digits? In the late 80s?
Sounds about right for meteorology models
I like how much precision you get with the first 3 odd digits doubled up… 355/113 is good to about 8 decimal points.
I wonder what is the highest precision you can get using binary numbers and only bit shifts for division 🤔
I did this for atan2, was building an autopilot a long time ago. https://www.f3.to/portfolio/math/fastatan2_integer.htm
Fixed point binary — as many digits as you want, 3 digits per 10 bits. 2^10~10^3.
That is my favourite these days and I think it would have been a whole lot better than the 22/7 we used at grammar school back in the dark ages when we were using 4 figure log tables.
6 decimal points (7 digits). 355/113 is really the “last good rational approximation”, though: the next step up requires a lot larger size digits.
65298/20785 is only slightly better. Next up is 93343/29712 which is still less than one decimal place better than 355/113. I have some more at http://wilsonminesco.com/16bitMathTables/RationalApprox.html .
Of course you might as well just remember 10 digits of pi then.
That’s the downside to all of the rational approximations except 355/113, except even 355/113 only buys you 1 more: and it’s silly because everyone basically remembers 3.14 straight up (at the very least everyone should remember 3 straight up). There are weird mnemonic-y things to say “hey look it’s just 1/3/5 and those already exist in pi” but at that point you’ve got 5 digits already: seems like you’d be better off with a mnemonic for “26.”
355/113 has been around for a while (+50 years from one published account I can reference). And it does pretty well for many mechanical engineering conversions from [radial -to-linear] and vise-versa, like say in an automotive steering rack.
It’s way older than that. 5th century China.
355/133 is 6 digits and it is good to 6 decimal places.
Well I suppose you could calculate the radius of the universe to the planck length, but why would you want to?
To know the answer.
Now i want to know the answer. This would contend for the highest practical ratio needed for quantum cosmology.
I use Pi-anary. Which is simply an integer power of Pi multiplied to whatever float format you wanted to use as a coefficent. Take this to an extreme to make a super complex number with terms for pi, e, i, and so on.
“…an effort which flirts with the latest Marvel movies for the title of pure irrelevance.”
Genuinely made me laugh out loud. Thank you for that :)
Came here to say this. And bravo.
Awesome drive by on Marvel movies!
Ditto.
And the punishment for this is to write all 10 trillion digits in a circle, then find the radius of the circle.
Back in the days of the 4-banger calculator, I memorised pi to the 8 significant digits (plus one) that would fit on the display: 3.14159265. Worked for me until I got my HP-25. Logs, sin and cos on keys! Saved me from also having to carry a slide rule to exams. :-)
not 8 signifiicant digits but…
mnemonic: How I wish I could calculate Pi
number of digits in each word 3 1 4 1 5 9 2
How I wish I could calculate pi better
How I wish I could calculate pi better still
How I wish I could calculate pi better still for every occasion required!
From early in junior high it seems, we all (well some of us) had at least memorized PI as 3.14159 . Good enough for anything we needed to do for algebra/trig/calculus through college . Wasn’t tell recently I memorized it to a few more digits just to see if I could. Also E and the Golden Ratio. The known history of PI (and E and Golden Ratio) down through the ages is a good read (my wife goes to sleep/tunes me out when I talk about it :) ).
As said in the article PI is only needed to a ‘few’ digits in our universe. The rest is just an academia pursuit to find the next digit… JPL/NASA uses 3.141592653589793
Here is a good layman article on the subject:
https://www.jpl.nasa.gov/edu/news/how-many-decimals-of-pi-do-we-really-need/
Pi not not a number. It is an converging infinite series.
The actual ratio of radius to circumference depends on how many atoms are in the circle.
yes. this /\ /\
at that scale sometimes atoms are in and not in the circle, sometimes both at the same time.
Pi is a number, and yes, it can be represented as the limit of a convergent series; however, pi itself is not “converging”, as it is just a number.
A circle has no atoms in mathematics, so the value of pi certainly has nothing to do with atoms.
You didn’t mention which atoms, as hydrogen atoms are smaller than uranium, and those darn hydrogen atoms keep wandering off to pair up with another!
NASA wouldnt have got off the ground without the mathematical machinery behind pi-ology.
A catchy way of memorizing more digits is the first song on this page:
http://facstaff.bloomu.edu/kferland/Deriv_Songs/album.html
Some other goodies also.
3 pi e
When I was learning FORTRAN (mumble) years ago, we were taught to use
PI = 4.0 * ATAN(1.0)
which gives pi to the resolution of the machine (with a possible small error in the LSD due to the trigonometry).
Pi is an abstract number anyways. A real life circle would have granularity at the smallest scales, so the maximum useful Pi representation I can think off, would be up to a planck unit. After that, it doesn’t apply to the physical world, just useful for flexing your math.
Since pi is a ratio of circumference and diameter, everything depends on how one measures these distances accurately.
What method is used for verification of these distances. Or which formula is used as sum of infinite series.
Hence it is necessary to establish which formulas , methods etc need to be used to find out the value of pi.
Without these standards, talking of value of Pi is meaningless.
In short basis of evaluation of value of pi must be specified first.
Dhanyavad!!!
Prakash Lakhapate
9867069587
The Universe may have expanded a bit since I learned this data point, but awhile back I learned that a circle the circumference of the Universe can be expressed accurately with Pi to 39 decimal places. So calculating Pi to huge numbers of decimal places may be interesting and fun, but we currently need only 39 decimal places within our Universe.
i think nasa’s approach here is a lot more general than pi, and i use it a lot myself.
depending on the project, i often use several wrong estimating approaches and compare them. in the best case, maybe i’ll have a source of error so egregious that i know the number is too low, and another that is so egregious i know the number is too high. and then if the distance between those two numbers isn’t too large, i know i’ve got the problem pretty well bracketed. my point is, i don’t invest much effort in minimizing error. instead, i try to characterize it. if i got to the result “one centimeter of error out past pluto”, that’d suit me fine.
i use this a lot in software to decide whether a numerical algorithm is ‘good enough’. every foray into fixed point starts with this kind of work. but i also use it when i’m building something physical…mostly because i know there will be slop in my implementation and i want to know if that will be a big deal. mostly, i just don’t want to do it twice (especially if the consumables are expensive or the process is time-consuming), so i want some sort of guarantee that it will work.
i think interrogating error magnitude is one of the most important engineering principles. far more important than doing everything correctly.
While not faster or better, I when I was a kid thought it was cool to calculate Pi by using a few lines of BASIC code and the random number function. I can’t recall how many decimals I could generate accurately on the school’s Commodore PET.