
How Many Decimals of Pi Do We Really Need? - bouncingsoul
http://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimals-of-pi-do-we-really-need/
======
drewolbrich
If you know the diameter of the observable Universe and you want to calculate
its circumference with the accuracy of the diameter of a proton, the number of
digits of pi that you need is 43.

~~~
gmuslera
The smallest possible distance is the Plank lenght, 1,6 _10^-35 (1_ 10^-15 is
the diameter of a proton). And for that you only need around 60 digits of pi
to calculate the circumference of the universe.

Of course, that is just for the simple operation of calculate the
circumference given the diameter, more complex operations with pi may require
more precision.

~~~
ghayes
Never heard it stated that way. Can you elaborate on "the smallest possible
distance is Plank's length"? Is that the smallest _observable_ distance?

~~~
jaseemabid
If you have some time to spare, watch this talk "The astonishing simplicity of
everything" by Neil Turok. He explains all this so beautifully.

[https://www.youtube.com/watch?v=f1x9lgX8GaE](https://www.youtube.com/watch?v=f1x9lgX8GaE)

~~~
mstade
Well presented and really gets you thirsty for more, excellent talk – thank
you very much for sharing!

------
WalterBright
This overlooks the issue that for repeated calculations, such as numerical
integration, the trouble comes from accumulated roundoff errors. Even 16
digits of precision can become 0 digits pretty quickly if you're not very
careful.

~~~
julie1
A branch of physics used to be taught a long time ago called "numerical
analysis" to deal with this issue.

We even used to be careful about the difference between 'precise and exact'.

Pi = acos(0) is absolutely exact. But computer don't know about symbolic
calculus. So to put the value in a register we used tricks.

Pi as a the converging value at the infinite of the Taylor development is
awesome. But computer don't know about infinite.

3.1415926535897932384626433832795028841971 is precise.... it has a lot of
digit and people loves that.

In ana num 3.15159 +- 0.00001 is exact. It bounds your result. Hence you can
estimate your error and its propagation.

Because we thought humans were smart we thought that 3.14159 would be so
meaningful people would understand that a constant should be considered to be
exact with the implicit meaning that 9 was the last significant digit and
people would be wise to use upper and lower bounds to estimates their results.

Then Computer Science was taught in university.

People not understanding why they had to study math and physics to simply
program 2 + 2 and thought, stop bothering us. We just compute TVA we don't
send a rocket to mars. Why learn boring math (integration, derivation,
Newton's methods for approximation, Taylos's development, Cauchy Suites,
condition of converging Suites, Integration in the complex field to compute
generalized integrals, simplex, LU/RU matrices ....)

Yes people loves recurrence. They cannot apply the reasoning to simple maths
series.

And that's how we have funny stuff like a lot of coder not understanding why :

    
    
       1.198 * 10.10
       12.099799999999998
    

Yes ... why are computers' maths so odd. What can we do about it?

Having a look at HP Saturn opcode makes you wonder if the lack of solution is
because it does not exists or because people forgot.
[http://www.hpcalc.org/details.php?id=1693](http://www.hpcalc.org/details.php?id=1693)

~~~
xiaq
I can't speak for other nations, but they still teach numeric analysis in
Chinese universities as an undergraduate course. In my university it is a
required subject. Many of us have countless dreadful memories of Runge-Kutta
method, Euler's method, Newton's method, rate of convergence, numerical
stability and error margins, just to name a few of the dreads...

~~~
julie1
And this ?
[https://zh.wikipedia.org/wiki/%E6%91%84%E5%8A%A8%E7%90%86%E8...](https://zh.wikipedia.org/wiki/%E6%91%84%E5%8A%A8%E7%90%86%E8%AE%BA)
(pt
[https://pt.wikipedia.org/wiki/Teoria_de_perturba%C3%A7%C3%B5...](https://pt.wikipedia.org/wiki/Teoria_de_perturba%C3%A7%C3%B5es))
(fr
[https://fr.wikipedia.org/wiki/Th%C3%A9orie_des_perturbations](https://fr.wikipedia.org/wiki/Th%C3%A9orie_des_perturbations))

~~~
ovis
Yes, perturbation methods are still taught and are still recognized as
important. The first math course I took during my graduate degree (Intro
analytic methods) covered it, for example.

------
13of40
According to Google NGrams, World Wars I and II both primarily used 3.1416 to
represent pi.

[https://books.google.com/ngrams/graph?content=3.1416&year_st...](https://books.google.com/ngrams/graph?content=3.1416&year_start=1800&year_end=2000&corpus=15&smoothing=3&share=&direct_url=t1%3B%2C3.1416%3B%2Cc0)

~~~
lovemenot
I think this is a typo. Right?

~~~
13of40
Yep. Fixed.

------
sharkjacobs
This story is frustrating to me because it makes it sound like 15 digits of
precision isn't a lot. Fifteen isn't a big number, but fifteen degrees of
precision is almost incomprehensible.

If you measured your height with fifteen degrees of precision, you would have
a measurement in femtometres. A femtometre is roughly the diameter of a
proton.

That's really precise!

------
sago
In the 'Frontiers in Astrophysics' course on Open Yale, professor Bailyn says
that, for the purpose of the course, pi = 3, and pi^2 = 10.

Pi = 3, coincidentally, is the Hebrew Bible's approximation too.

~~~
KMag
> Pi = 3, coincidentally, is the Hebrew Bible's approximation too.

Certainly it's not explicitly spelled out. The example I've heard was the
outer diameter and inner circumference of a vessel's circular rim were given.
Pi comes out to 3 only if the thickness of the rim of the vessel is zero.

~~~
sago
Yes I was over-egging the cake.

It is a large cast bowl in 1 Kings 7:23ff. It's beloved of a certain kind of
'gotcha' internet skeptic "Proof that the bible thinks Pi is 3 !!1! How dumb
are teh Christians!".

But the passage itself even mentions the thickness of the bowl, and there's no
reason to assume the numbers are anything more than a description of a
particular bowl (which inevitably wouldn't have been perfectly circular).

------
gunnihinn
I remember back in high school physics when we were calculating the volumes of
a few stars and my teacher said "Just round out 4\pi/3 to 4". I completely
understand why we'd do that -- the error terms in the radius of the star
completely drown out that approximation -- but goddammit it still feels wrong.
I guess I'm a mathematician and not a physicist for a reason.

~~~
marcosdumay
:)

Physics is full of dirty shortcuts. I dread every time I see somebody using a
natural units system.

------
mchahn
15 digits is about the precision hand-held calculators provide, right? Many
early NASA missions took HP calculators along in missions with trajectory
routines in case the computer failed.

~~~
todd8
Hand-held calculators might have been carried on many NASA missions, but not
the early ones. The first missions started in 1961 and hand-held HP
calculators weren't invented until more than ten years later. By that time we
had already been to the moon 6 or 7 times.

The first actual hand-held calculator I every saw was a Bowman Brain (simple 4
function calculator) it was for sale in 1971 at the MIT COOP (the bookstore).
I only knew one person that bought one; the rest of us continued carrying
around our slide rules (they came in handy leather holsters with belt loops.)
The HP that came out about a year later was a real scientific calculator.

Years before that, sometime between 1965 and 1968, on an episode of Lost in
Space (a TV program with a family of early space explorers lost in outer
space) the son, Will Robinson, was carrying around a large device about 3
inches thick and a foot tall that looked like a calculator. I thought the idea
quite marvelous and went to bed thinking about it and how much better it would
be than my slide rule for playing around with calculations. (I was a weird
kid.)

~~~
skykooler
Did the astronauts use slide rules? I know the E6B is pretty common for pilots
still.

~~~
mchahn
> I know the E6B is pretty common for pilots still.

I've used that before. It is not a standard logarithm stick but a vector
addition tool. Does one thing very quickly.

~~~
yuubi
The other side from the vector adder ("front" side at
[https://upload.wikimedia.org/wikipedia/commons/c/c4/StudentE...](https://upload.wikimedia.org/wikipedia/commons/c/c4/StudentE6BFlightComputer.jpg)
) includes a circular slide rule with perfectly normal log scales for fuel,
time, distance calculations, an extra scale to help with hours/minutes
conversions, and some marks for various conversion factors, including lb/gal
fuel and lb/gal oil for use in weight/balance.

The main difference between a straight and circular rule is that it has only
one appearance of the index, so you don't have to move the slide around as
much, and it's round so the equivalent of a 10" rule has around 3" diameter.

It also has other scales for converting altimeter/airspeed (really pressure
gauge) readings into other numbers more useful for certain purposes like true
altitude (good for missing obstructions) and "density altitude" (for
estimating takeoff performance, also helpful for missing obstructions).

~~~
lostlogin
This is amazing. The idea of converting units of multiple types in a hurry
when it matters with a slide or circular rule in imperial units is terrifying.
Somehow doing that in metric seems less so, but the fact that the system got
people to the moon relatively recently is still amazing.

------
jacobolus
In this particular case, they’re just using a standard double precision IEEE
754 floating point number. So I assume they do all of their arithmetic (“for
JPL's highest accuracy calculations”) using double precision floats.

------
tremguy
I think this is a bit of an oversimplification. You must consider compounding
when talking about rounding errors. A single matrix operation with hundreds of
rows and columns can easily have millions of multiplications. At every
multiplication the previous error gets multiplied. That's why I don't feel the
answer was exhaustive.

~~~
carlob
> At every multiplication the previous error gets multiplied

This is a bit of an oversimplification as well, it's not like you keep
multiplying pi with itself over and over again and it's not like the error you
introduce is random, if you've rounded pi once, you're gonna keep make a
slight error in the same direction.

If you were right there'd be no hope of ever getting sane results when
multiplying largish matrices of doubles regardless of the presence of pi.

I'm not saying that accumulation of error doesn't exist, I'm just saying that
it's not to the extremes you're describing.

~~~
marcosdumay
Pi is kind of a worst case, because you round it only once, every operation
will add errors on the same direction. Because of that you either use way to
many decimal places, or make sure you don't keep multiplying pi with itself as
you said. But both are optional, and must be designed into.

A matrix of measurements, by its turn, normally has unbiased errors, what
makes the resulting error grow much slower.

------
desdiv
>The primary purpose of the DATA statement is to give names to constants;
instead of referring to pi as 3.141592653589793 at every appearance, the
variable PI can be given that value with a DATA statement and used instead of
the longer form of the constant. This also simplifies modifying the program,
should the value of pi change.

Xerox Basic FORTRAN and Basic FORTRAN IV Manual[0], attributed to David H.
Owens.

[0]
[https://www.textfiles.com/bitsavers/pdf/sds/sigma/lang/90096...](https://www.textfiles.com/bitsavers/pdf/sds/sigma/lang/900967D_Sigma2_FORTRAN_Aug70.pdf)

------
brandmeyer
Not quite Pi, but something very closely related to Pi is retained to
extremely high precision in computers.

libm frequently contains 2/pi to very high precision. For example, Newlib's
math library contains 476 decimal digits of 2/pi as part of its routines for
calculating sine and cosine of numbers outside the range [-pi/4..pi/4].

See e_rem_pio2.c for more. Many of the open source math libraries are
ultimately descended from the same root: the Sunpro fdlibm, archived at
netlib: [http://www.netlib.org/fdlibm/](http://www.netlib.org/fdlibm/)

~~~
x4m
Here is an article how precision of Pi could affect trigonometry
[https://randomascii.wordpress.com/2014/10/09/intel-
underesti...](https://randomascii.wordpress.com/2014/10/09/intel-
underestimates-error-bounds-by-1-3-quintillion/)

------
gmuslera
Maybe for astronomy a few could be enough, but for computing all are needed
for the perfect filesystem
[https://github.com/philipl/pifs](https://github.com/philipl/pifs)

------
Houshalter
The best way of looking at problems like this, is that it's an exponential
process. The number of values you can represent with n digits increases
exponentially. Each additional digit increases your precision by a factor of
10. If you have 15 digits, well imagine multiplying 10 over and over again 15
times, it's pretty big.

The word "quadrillion" is rarely used in the English language. Because it's
very rare you need numbers that large. And when you do, being off by a few
digits doesn't matter. Calculators commonly only display up to 8-10 digits,
for example.

This applies to programming, since computers often only have a limited number
of bits. Programmers often complain about floating point. One of the things
about neural networks is that they don't actually need that many bits of
precision, since they are by nature very "fuzzy". We can build computers that
are bigger/cheaper by sacrificing a lot of bits.

But one of the problems is, when adding a bunch of small numbers together, it
rounds to the nearest whole number every time. And the inaccuracy builds up.
So to really take advantage of less precision, we need to somehow build
computers that can do _stochastic rounding_ , where they sometimes round up,
and sometimes round down, so the expected output is the same.

------
mabbo
I have heard, but never done the math the verify, that with 50-ish digits of
pi, one's error on a circle the size of the Universe would be smaller than a
plank length.

~~~
kurthr
Although this really should have been posted 4 days ago, 2pi x 3x10^8 x
40x10^10 / 1.6x10^-35 is just over 10^54 so that's about all the digits you
need to memorize. Unless you're looking for a really strong password, reciting
100,000 digits is probably more than necessary:
[http://blogs.scientificamerican.com/observations/how-much-
pi...](http://blogs.scientificamerican.com/observations/how-much-pi-do-you-
need/)

------
cnvogel
The ratio of the observable universe's circumference to a proton diameter may
be 10^-35, but that doesn't really say anything for the precision of Pi you'd
need in practice for any calculation involving these scales.

Because for everything involving real-world data, you'll have to measure
quantities, and this is hardly ever done to more than just a few decimal
digits. Whenever I want to state the circumfence of anything I know the
diameter of down to single numbers of proton diameters, I first have to
measure the diameter of to a precision of 1/3 proton diameter. Only when I
reach such an absurdly nonsensical precision, I'd introduce errors by using an
inadequately runded value for Pi.

More practically: I might know that I could line up 2.611*10^25 protons
(disregarding the fact that due to their charge they would repel each other)
around the earth, but to calculate that I only need 5 decimal digits of the
earth's diameter, and only 5 decimal places of Pi.

------
albertzeyer
Some other approximations:
[http://www.math.tamu.edu/~dallen/masters/alg_numtheory/pi.pd...](http://www.math.tamu.edu/~dallen/masters/alg_numtheory/pi.pdf)

And:
[https://en.wikipedia.org/wiki/Approximations_of_%CF%80](https://en.wikipedia.org/wiki/Approximations_of_%CF%80)

Babylons and early Chinese just used pi = 3.

Romans used pi = 3.125.

------
gaur
Non-metric units... sigh...

------
bbtn
Universal constants [1] have about 6-9 significant digits today. I wouldn't
use more than 10 digits of pi, if I am working on some physical calculations.

[1]
[http://physics.nist.gov/cuu/Constants/index.html](http://physics.nist.gov/cuu/Constants/index.html)

------
justifier
i wonder if interest in measuring error of previous calculations is what
encouraged this direction of computational rigor

respecting accuracy encourages a self awareness with an almost conscious stead
ignorant error

i am always intrigued when it is discussed how a calculation began and the
error of the initial values

the first known attempt at measuring the speed of light(o) had an ignorant
error of ~26%

the first known attempt at measuring the circumference of the earth(i) had an
ignorant error of ~15%

    
    
        > our planet Earth.. the circumference ..
        > .. would .. be if you used the limited version of pi above? 
        > It would be off by the size of a molecule. 
    

our conscious error is the size of a molecule, but what will our ignorant
error be? how will its significance manifest?

the ignorant error is a result of the tools of measure, in this case
observable measurements and numerical approximation

for those who calculated using pi equal to 22/7, for the circumference, their
error would only be ~.04% of the 15 digit rounded value

    
    
        >>>2*(22/7)*(7926/2)>>> 2*(22/7)*(7926/2)
         24910.285714285714
        >>> 2*(3.141592653589793)*(7926/2) #from the article
         24900.2633723527
        >>> 24910.285714285714/24900.2633723527
         1.0004024994347707
        >>> (1.0004024994347707-1)*100   
         0.04024994347706645
    
    

(o)
[https://en.wikipedia.org/wiki/Speed_of_light#First_measureme...](https://en.wikipedia.org/wiki/Speed_of_light#First_measurement_attempts)

(i)
[https://en.wikipedia.org/wiki/Eratosthenes#Measurement_of_th...](https://en.wikipedia.org/wiki/Eratosthenes#Measurement_of_the_Earth.27s_circumference)

.. edit, percentage error, left out the *100

~~~
eggy
That should be 0.04% not 0.0004%, no? You need to multiply by 100 for percent?

~~~
justifier
and the ever present undiscussed other..

add human error to the list

------
jstoja
I really thought that the reason would have been for technical reasons, like a
compromise between precision and how fast they can actually calculate with pi.
The answer is simply awesome.

------
sunstone
355/113 gets you more than you'll ever need.

------
rurban
So they are using simple and fast double, not long double. Which makes sense.

------
julie1
btw Pi = 4 (in taxicab geometry aka L1)
[http://math.stackexchange.com/questions/96835/are-there-
any-...](http://math.stackexchange.com/questions/96835/are-there-any-
geometries-spaces-where-pi-is-a-simple-or-at-least-rational-cons)

Euclidean geometry is not the only one and some physical problems are solved
using spaces in which pi is NOT 3.1459

;)

------
joss82
Tl;dr: 15

------
dang
Url changed from [http://kottke.org/16/03/how-many-digits-of-pi-does-nasa-
use](http://kottke.org/16/03/how-many-digits-of-pi-does-nasa-use), which
points to this.

------
oniMaker
We need all of them. Keep going until you reach the end.

------
brador
Miles and inches? Please learn and use standard international (SI) units. It's
important.

~~~
wtbob
He's an American, writing for an American audience, and thus he's using the
units Americans use. There's absolutely nothing more scientific about one set
of units or another (although different sets of units may be more convenient
in different situations).

~~~
brador
It prevents mistakes when we all use the same units and the SI are agreed by
an international committee of scientists and engineers. It's one less thing to
go wrong.

~~~
niccaluim
This isn't flight control software. It's a blog post. There aren't any
"mistakes" to prevent. The website is not going to crash into Mars.

Good writers write for their audience. His audience is accustomed to thinking
in miles.

~~~
lostlogin
It would be interesting to see the analytics - I'm not disagreeing and the
site is presumably funded by American taxes, but people like the site aren't
all American.

------
kordless
Maybe the new decimals are information from beyond this realm. Thanks, Sagan.

------
hzhou321
So it proves that the concept of irrational number is rather useless in
practice ...

------
ryanobjc
The real answer:

As many as it takes.

Also, what about the quest for finding the largest prime? #keepthedreamalive

