Calculating Pi [message #53253] |
Sun, 01 April 2007 10:07  |
Braedley
Messages: 57 Registered: September 2006
|
Member |
|
|
Does anyone have code that can calculate pi to an arbitrary
precision? This is purely an academic endeavour.
Actually that's a lie. This is just so that I can show others up.
|
|
|
Re: Calculating Pi [message #53328 is a reply to message #53253] |
Tue, 03 April 2007 00:44  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
jschwab@gmail.com wrote:
> On Apr 2, 4:09 am, Paolo Grigis <pgri...@astro.phys.ethz.ch> wrote:
>> The problem here is not one of method for computing Pi
>> (as remarked, plenty are available), but rather the lack
>> of an arbitrary precision library in IDL... (or has
>> anybody already written one?)
>>
>> Ciao,
>> Paolo
>
> There are a class of formulas called Bailey-Borwein-Plouffe (BBP) that
> let you find the nth digit, without having found the preceding ones.
> If you head to your library or Google around, I'm sure you can find
> out enough to show off to your heart's content. With double precision,
> I think that should let you get the first 10^7 digits or so.
>
> I Googled and found code examples here
> http://crd.lbl.gov/~dhbailey/expmath/bbp-codes/
>
> Cheers,
> Josiah
Yes, but these are hexadecimal digits, which you still have
to convert into decimal form... so you still need at least
one routine from the arbitrary precision library.
Ciao,
Paolo
>
|
|
|
Re: Calculating Pi [message #53331 is a reply to message #53253] |
Mon, 02 April 2007 15:04  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Sun, 01 Apr 2007 10:07:05 -0700, Braedley wrote:
> Does anyone have code that can calculate pi to an arbitrary
> precision? This is purely an academic endeavour.
>
> Actually that's a lie. This is just so that I can show others up.
I say invest in an industrial-sized box of toothpicks and lock
yourself in the tiled-floor bathroom:
http://en.wikipedia.org/wiki/Buffon's_needle
JD
|
|
|