Why is math.pi slightly wrong?

J. Cliff Dyer jcd at sdf.lonestar.org
Fri May 23 10:04:52 EDT 2008


On Thu, 2008-05-22 at 15:06 -0400, Dan Upton wrote:
> Who wants to verify that that's correct to that many digits? ;)

Verified.

I checked it against the million digits on piday.org, by putting each
into a string, stripping out spaces and newlines, and doing:

>>> piday[:len(clpy)] == clpy
False
>>> piday[:len(clpy)-1] == clpy[:-1]
True
>>> print piday[len(clpy)-10:len(clpy)+1]
44893330963
>>> print clpy[-10:]
4489333097
>>> 

So the last digit doesn't match, even accounting for rounding, but
that's probably because it was calculated to the bit, not to the digit.





More information about the Python-list mailing list