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 Robert.Withrow
Recipients Robert.Withrow, TD22057, loewis, vstinner
Date 2011-03-16.23:25:16
SpamBayes Score 2.1634061e-10
Marked as misclassified No
Message-id <1300317916.65.0.123857807563.issue4114@psf.upfronthosting.co.za>
In-reply-to
Content
I have to disagree.  It seems entirely reasonable to expect that unpack should return the same value passed to pack.  That it doesn't (as of 2.6.5 at least) is completely unexpected and undocumented.  And yes I understand the limitations of floating point numbers.

I suggest that struct should be fixed so that struct.unpack(fmt,struct.pack(fmt,v)) == v and format is something like '!f'.

This can be done in C code (I do it) for IEEE 754 floats.

At the very list this unexpected behavior should be documented in struct.
History
Date User Action Args
2011-03-16 23:25:16Robert.Withrowsetrecipients: + Robert.Withrow, loewis, vstinner, TD22057
2011-03-16 23:25:16Robert.Withrowsetmessageid: <1300317916.65.0.123857807563.issue4114@psf.upfronthosting.co.za>
2011-03-16 23:25:16Robert.Withrowlinkissue4114 messages
2011-03-16 23:25:16Robert.Withrowcreate