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 rhettinger
Recipients Robert.Withrow, TD22057, loewis, mark.dickinson, rhettinger, vstinner
Date 2011-03-17.18:21:47
SpamBayes Score 2.4538014e-08
Marked as misclassified No
Message-id <1300386108.07.0.565990668245.issue4114@psf.upfronthosting.co.za>
In-reply-to
Content
The suggested examples are misleading because they use 6.24 which is not exactly representable in binary floating point.  Representation issues are orthogonal to the OP's issue which is really just a simple rounding example:

>>> x = float.fromhex('0x0.1234560000001')
>>> unpack('!f', pack('!f', x))[0].hex()
'0x1.2345600000000p-4'

Also, if something like the suggested note is adopted, it needs to be worded in a way that doesn't imply that the struct implementation is broken or misdesigned.  

A better note would focus on the basic (and obvious) fact that downgrading from double precision to single precision  
entails a loss of precision.
History
Date User Action Args
2011-03-17 18:21:48rhettingersetrecipients: + rhettinger, loewis, mark.dickinson, vstinner, TD22057, Robert.Withrow
2011-03-17 18:21:48rhettingersetmessageid: <1300386108.07.0.565990668245.issue4114@psf.upfronthosting.co.za>
2011-03-17 18:21:47rhettingerlinkissue4114 messages
2011-03-17 18:21:47rhettingercreate