[Back to

 previous page] [Next Page

 in Series]

Ken Ward's Java Script Tutorial ...

Long Numbers (Pi and the Universe)

This page isn't fundamentally about pi, etc, but about long numbers; that is, those which exceed the normal capacity of computers and calculators, in particular, with JavaScript.

So it is an introductory page to calculation with high precision and accuracy.

It is quite amazing that p was known only to a few decimal places until a hundred or so years ago. And it is only in the last 50 years, that its value has been calculated to significant accuracy and precision and beyond. A javascript program to compute pi is here (Calculating pi using the Machin formula).

On this page:

The Absurdity of Calculating Pi to Trillions of Digits

Rather jokingly, a mathematician has claimed that

"33) If one were to find the circumference of a circle the size of the known universe, requiring that the circumference be accurate to within the radius of one proton only 39 decimal places of Pi would be necessary."

I believe the true issue is that pi appears in many calculations where high accuracy and precision are required, so it is likely that pi (and other numbers) may be required for accurate calculations in such areas as meteorology and other sciences, especially where iterative calculations are performed. It is naive to conclude that we never need pi to greater accuracy than 39 decimals.

But is it true we need only 39 decimals to calculate to high accuracy and precision the circumference of the known universe?

The Circumference of the Known Universe

The accuracy of a figure for the diameter of the known universe (needed in the calculation) is not really that important as it is intended to show just how significant a certain degree of accuracy and precision is in certain calculations. Some suggest the diameter of the known universe might be 156 billion light years, although conventionally, it is taken to be 20 billion light years. I will take the smaller figure. I'll do this, because the quote might reasonably be assumed to refer to the conventional figure. Naturally, this, as expressed, might be taken as plus or minus half a billion, so we aren't really talking accuracy here!

What's 20 Billion light-years in Real Money?

I have this as the figure for the speed of light: 299,792,458 metres per second. Technically, it is a definition, as the metre is defined in terms of the speed of light.

Also a year is: 1 year = 365.242199 days

I assume 60 seconds in a minute, 60 minutes in an hour and 24 hours in a day.

One light year will, therefore be:

299,792,458x60x60x 24 x365.242199 metres

Or 394188683772726.5112x 24 =

9,460,528,410,545,436.2688 metres

The quoted figure is usually about: 9.46  1012 kilometres

Diameter Of The Universe (Calculation)

Of course, using the figure of 20 billion light-years plus 50 billion light-years and minus 1/2 billion is not a very accurate or precise figure. We will assume 20 billion is correct (but we don't really care because this is a demonstration of big numbers, not astronomy). So the diameter of the known universe is:

20,000,000,000 x 9,460,528,410,545,436.2688 metres

=189,210,568,210,908,725,376,000,000 metres

The Circumference

The circumference is p x diameter. But what is p? Note, we are looking for a fairly accurate figure here to required precision. It seems to me that a value a little better than 27 places would suffice, but I will take 200.

So I assume p is:


Hence, p x diameter (see multiplying long numbers)=

594,422,531,072,941,319,871,305,004.0192957772357048301009233485361306 396860339826689979076887669837745429225080415472467804780340405492 768685389100511845683080027512739106929579276934294046594476743765 9195366731123141000042461696 metres

Comparison of pi at 39 decimals with pi at 200

Pi, 39 decimals is:


So pi(39) x diameter=

594,422,531,072,941,319,871,305,004.019295777235672777948905003283072 metres

The difference between these diameters is (see subtracting long numbers):

0.0000000000000320521520183452530586396860339826689979076887669837745429 225080415472467804780340405492768685389100511845683080027512739106929579 2769342940465944767437659195366731123141000042461696 metres

The diameter of a proton is: 2 x 10-14 to 10-15 metres (I took the smallest figure).

Our calculation is approximately 3.205x10-14 for the difference between pi(200) and pi(39). This is a very small difference, indeed, but assuming accuracy throughout, it seems that this is more than half a proton's diameter, being between 1 1/2 to 30 times the diameter of a proton (depending on which figure is taken). However, the actual figure is so minute, it would be too small for the atoms to sneak through. Of course, different figures may have been used in the original calculation.

How Many Decimal Places Of p For Half a Proton?

Taking pi(40) as:


The circumference becomes :


which differs from the pi (200) calculation by:

0.000000000000005789961623836492016560313966017331002092311233016225457 0774919584527532195219659594507231314610899488154316919972487260893070 4207230657059534055232562340804633268876858999957538304

Or about 5.8x10-15. This could be half a proton's diameter using the 2x10-14 figure, but would be fivefold for the lower figure. So let's try pi(41)

Using pi (41)=3.14159265358979323846264338327950288419717

we get this difference:

0.0000000000000001136445775092302552803139660173310020923 112330162254570774919584527532195219659594507231314610899 4881543169199724872608930704207230657059534055232562340804 633268876858999957538304

Or 1.1x 5.8x10-16, which could be a tenth of a proton's diameter.

And using pi (42) or 3.141592653589793238462643383279502884197169, we get this difference:

0.00000000000000007556599070167847009568603398266899790768876698377 454292250804154724678047803404054927686853891005118456830800275127 391069295792769342940465944767437659195366731123141000042461696

Which is about  7.6x10-17, which is clearly less than the estimates of the of the proton's diameter.

It seems that taking pi to 41 decimal places, and assuming the accuracy of the other figures, then we could say that the error would certainly be less than half the diameter of a (small) proton.