Message393104
[Stefan]
> I found it surprising that a comparison uses a different
> method of conversion than the (obvious) user-side
> conversion, with a different outcome. This seems to be
> implementation details leaking into the user side.
It's "spirit of 754", though, so any "principled" implementation would do the same. That is, part of the spirit of 754 is to deliver the infinitely price result _when_ the infinitely precise result is representable.
So, in particular,
> The net effect is that some integers will never equal
> a floating point value, even though the floating point
> value does its very best to represent that integer.
in fact for "almost no" Python ints `i` do i == float(i), because "almost all" unbounded ints `i` lose information when converted to finite-precision float (so with infinite precision they're not equal). |
|
Date |
User |
Action |
Args |
2021-05-06 16:10:34 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, scoder, christian.heimes, steven.daprano, PedanticHacker |
2021-05-06 16:10:34 | tim.peters | set | messageid: <1620317434.77.0.580688732771.issue44054@roundup.psfhosted.org> |
2021-05-06 16:10:34 | tim.peters | link | issue44054 messages |
2021-05-06 16:10:34 | tim.peters | create | |
|