[issue4114] struct returns incorrect 4 byte float

Martin v. Löwis report at bugs.python.org
Mon Oct 13 23:46:00 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

I think the complaint is that presumably, when expanding the float to
double in unpacking, the result is not zero-padded. I cannot reproduce
the problem, though:

py>
hexlify(struct.pack(">d",struct.unpack(">f",struct.pack(">f",1.8183e-7))[0]))
'3e8867a1a0000000'

Seems to me that the zero-padding works just well.

TD22057, why do you say that 1.818300034983622e-07 is not the closest
number. AFAICT, this is not true: this *is* the closest number.

----------
nosy: +loewis

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


More information about the Python-bugs-list mailing list