!!! 2.1, 2.2, 2.2.1, PYTHON BUGS ????

Peter Hansen peter at engcorp.com
Thu May 30 22:01:51 EDT 2002


"David K. Trudgett" wrote:
> 
> On Thursday 2002-05-30 at 14:22:47 +0000, Michael Hudson wrote:
> 
> > Read this:
> >
> > http://www.python.org/doc/2.2.1/tut/node14.html
> >
> > (the fact that I can type this URL from memory should be some
> > indication that you could have answered your query yourself with a
> > little effort).
> 
> Obviously, something has changed since Python 1.5.2:

As mentioned in Andrew Kuchling's pages at http://www.amk.ca/python/2.0

"""Taking the repr() of a float now uses a different formatting precision 
than str(). repr() uses %.17g format string for C's sprintf(), while str() 
uses %.12g as before. The effect is that repr() may occasionally show more 
decimal places than str(), for certain numbers. For example, the number 8.1 
can't be represented exactly in binary, so repr(8.1) is '8.0999999999999996', 
while str(8.1) is '8.1'. """

-Peter



More information about the Python-list mailing list