problem with the 'math' module in 2.5?

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Sun Oct 15 11:36:35 CEST 2006


On Sun, 15 Oct 2006 00:18:29 -0400, Carsten Haese <carsten at uniqsys.com> wrote:
...
> You're not getting *exactly* zero because you're not passing in *exactly* pi
> but a close approximation of pi.

That, plus the fact that floating-point math never is (in some sense)
precise. I am surprised noone brought up this one:

>>> .2
0.20000000000000001

The original poster should read more on the subject. The Wikipedia article
seems like a good place to start:

 http://en.wikipedia.org/wiki/Floating-point

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list