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 elias
Recipients elias, jyasskin, mark.dickinson, rhettinger, serhiy.storchaka
Date 2018-03-16.04:12:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521173533.67.0.467229070634.issue32968@psf.upfronthosting.co.za>
In-reply-to
Content
Mark, I tried `Fraction(10**23) // 1e22`, and I got 10.

Your `10**23 // 1e22` example was strange, but then `int(1e23)` and got 99999999999999991611392. That is kind of unexpected but I think it is rare for anyone to do something like that with numbers that big.

I think the fact that floating-point rounding error sometimes causes strange results is not a reason to do really unexpected things like making 1.0 // 1/10 equal 9.0, if that can be reasonably avoided.

I updated my pull request with my change, which you suggested, to make __rfloordiv__ and __rmod__ return a float, but with a small change to _operator_fallbacks to avoid the rounding error, so 1.0 // 1/10 is 10.0. You can see it at https://github.com/python/cpython/pull/5956/commits/1020bb219c1a4fad575ee2309c930ce82a4777fb#diff-14d03bfb59581367725b00781e6f802fL391. What do you think?
History
Date User Action Args
2018-03-16 04:12:13eliassetrecipients: + elias, rhettinger, mark.dickinson, jyasskin, serhiy.storchaka
2018-03-16 04:12:13eliassetmessageid: <1521173533.67.0.467229070634.issue32968@psf.upfronthosting.co.za>
2018-03-16 04:12:13eliaslinkissue32968 messages
2018-03-16 04:12:13eliascreate