Why is math.pi slightly wrong?

inhahe inhahe at gmail.com
Thu May 22 13:29:37 EDT 2008


"Dutton, Sam" <Sam.Dutton at itn.co.uk> wrote in message 
news:mailman.1476.1211475183.12834.python-list at python.org...
> I've noticed that the value of math.pi -- just entering it at the 
> interactive prompt -- is returned as 3.1415926535897931, whereas (as every 
> pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the 
> end.)

Another way of saying it is: 3.1415926535897932 is of course an 
approximation.  It's the closest approximation to pi given X digits in base 
10.  In base 2 the closest approximation to pi given Y digits is different.





More information about the Python-list mailing list