[issue4114] struct returns incorrect 4 byte float

TD22057 report at bugs.python.org
Mon Oct 13 23:59:23 CEST 2008


TD22057 <ted.drain at jpl.nasa.gov> added the comment:

Martin is correct.  I expected (naively) that struct would zero pad the
digits beyond the significant digits of a float.  As to whether it's
exact or not, see my first message:
>>> v=1.8183e-7
>>> v
1.8183000000000001e-07

Since 32 bit floats only have ~7 digits of precision, I expected to get
the same thing back.  Not 7 digits + garbage.

Like I said, you can mark this bug as invalid since Python is just
reflecting what C is doing.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4114>
_______________________________________


More information about the Python-bugs-list mailing list