On May 21, 3:38 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote:
>>> a = 1e16-2.
> >>> a
> 9999999999999998.0
> >>> a+0.999     # gives expected result
> 9999999999999998.0
> >>> a+0.9999   # doesn't round correctly.
>
> 10000000000000000.0

 Notice that 1e16-1 doesn't exist in IEEE double precision:
 1e16-2 == 0x1.1c37937e07fffp+53
 1e16 == 0x1.1c37937e08p+53

 (that is, the hex representation ends with "7fff", then goes to
"8000").

 So, it's just rounding. It could go up, to 1e16, or down, to 1e16-2.
This is not a bug, it's a feature.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to