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 tim.peters
Recipients PedanticHacker, christian.heimes, mark.dickinson, rhettinger, scoder, steven.daprano, tim.peters
Date 2021-05-06.16:10:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620317434.77.0.580688732771.issue44054@roundup.psfhosted.org>
In-reply-to
Content
[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).
History
Date User Action Args
2021-05-06 16:10:34tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, scoder, christian.heimes, steven.daprano, PedanticHacker
2021-05-06 16:10:34tim.peterssetmessageid: <1620317434.77.0.580688732771.issue44054@roundup.psfhosted.org>
2021-05-06 16:10:34tim.peterslinkissue44054 messages
2021-05-06 16:10:34tim.peterscreate