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 mark.dickinson
Recipients Robert.Withrow, TD22057, loewis, mark.dickinson, vstinner
Date 2011-03-17.08:15:32
SpamBayes Score 0.00014099349
Marked as misclassified No
Message-id <1300349737.55.0.568380566789.issue4114@psf.upfronthosting.co.za>
In-reply-to
Content
[Robert]
> I have to disagree.  It seems entirely reasonable to expect that
> unpack should return the same value passed to pack.

Robert:  notice that a *Python* float (a *64-bit* C double internally) is here being stored as a *32-bit* float, losing precision.  So no, it's not at all reasonable to expect that unpack should return the same value passed to pack---it's mathematically impossible for it to do so.  There are (around) 2**64 distinct Python floats, and only 2**32 ways to pack them using '<f'.

When packing / unpacking using '<d', it *is* reasonable to expect the value to be recovered exactly, and as far as I know that's always what happens (barring peculiarities like NaN payloads not being reproduced exactly).
History
Date User Action Args
2011-03-17 08:15:37mark.dickinsonsetrecipients: + mark.dickinson, loewis, vstinner, TD22057, Robert.Withrow
2011-03-17 08:15:37mark.dickinsonsetmessageid: <1300349737.55.0.568380566789.issue4114@psf.upfronthosting.co.za>
2011-03-17 08:15:32mark.dickinsonlinkissue4114 messages
2011-03-17 08:15:32mark.dickinsoncreate