Inverse confusion about floating point precision
Skip Montanaro
skip at pobox.com
Mon May 9 14:36:53 EDT 2005
>> Why isn't the last result "958949.99999999996"? IOW, how'd I get
>> back the lost bits?
Dan> You were just lucky.
Thanks for the response (and to Tim as well).
Dan> The floating-point representation of 95.895 is exactly
Dan> 6748010722917089 * 2**-46.
I seem to recall seeing some way to extract/calculate fp representation from
Python but can't find it now. I didn't see anything obvious in the
distribution.
Thx,
Skip
More information about the Python-list
mailing list