This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients TD22057, loewis, vstinner
Date 2008-10-13.22:06:45
SpamBayes Score 0.0011147067
Marked as misclassified No
Message-id <1223935606.0.0.648463321048.issue4114@psf.upfronthosting.co.za>
In-reply-to
Content
"Since 32 bit floats only have ~7 digits of precision, I expected to 
get the same thing back. Not 7 digits + garbage."

This problem is a well known problem of conversion from base 2 (IEEE 
float) to base 10 (Python unicode string). Search for any programming 
FAQ, eg.
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate

"Python is just reflecting what C is doing": the problem is deeper in 
the silicium. If you want a better precision, use an arbitrary 
precision float type like decimal.Decimal() or the GMP library 
(Python: gmpy)
History
Date User Action Args
2008-10-13 22:06:46vstinnersetrecipients: + vstinner, loewis, TD22057
2008-10-13 22:06:46vstinnersetmessageid: <1223935606.0.0.648463321048.issue4114@psf.upfronthosting.co.za>
2008-10-13 22:06:45vstinnerlinkissue4114 messages
2008-10-13 22:06:45vstinnercreate