Message74702
"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) |
|
Date |
User |
Action |
Args |
2008-10-13 22:06:46 | vstinner | set | recipients:
+ vstinner, loewis, TD22057 |
2008-10-13 22:06:46 | vstinner | set | messageid: <1223935606.0.0.648463321048.issue4114@psf.upfronthosting.co.za> |
2008-10-13 22:06:45 | vstinner | link | issue4114 messages |
2008-10-13 22:06:45 | vstinner | create | |
|