Fortran (Was: The "does Python have variables?" debate)

Chris Angelico rosuav at gmail.com
Sun May 11 14:59:41 EDT 2014


On Mon, May 12, 2014 at 4:54 AM, Mark H Harris <harrismh777 at gmail.com> wrote:
> The following code will produce over 100,000 digits of π (pi) in less than 2
> seconds on a low-end processor, like my mac mini dual core 2Ghz:
>
>>julia> prec=524288
>>524288
>
>>julia> with_bigfloat_precision(prec) do
>>         println(atan(BigFloat(1)/5)*16 - atan(BigFloat(1)/239)*4)
>>       end

Would it be quicker (and no less accurate) to represent pi as
atan(BigFloat(1))*4 instead? That's how I originally met a
pi-calculation (as opposed to "PI = 3.14" extended to however much
accuracy someone cared to do).

ChrisA



More information about the Python-list mailing list