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 tom.pohl
Recipients loewis, mark.dickinson, serhiy.storchaka, skrah, tom.pohl
Date 2012-11-12.13:53:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352728421.95.0.44557665826.issue16460@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for all the explanations why Python's floor division (FD) works as specified. And I agree, it does work as specified, but still, I think this is not the behavior that most people would expect and is therefore dangerous to provide/use.

What do I expect from FD (x//y):
1. Perform a division (I don't care about the details here).
2. Return an integer value q (even if it's stored in a float).
3. The absolute difference between the mathematical division q'=x/y and the returned result q is less than 1, since it's just a floor operation, right?

1//0.1 = 9.0 violates my personal last expectation and I guess I'm not the only one.

My use case: I need to perform a division, but the method only accepts integer values, so what I used to do is FD. Since today I'm using int(x/y) or floor(x/y).
History
Date User Action Args
2012-11-12 13:53:41tom.pohlsetrecipients: + tom.pohl, loewis, mark.dickinson, skrah, serhiy.storchaka
2012-11-12 13:53:41tom.pohlsetmessageid: <1352728421.95.0.44557665826.issue16460@psf.upfronthosting.co.za>
2012-11-12 13:53:41tom.pohllinkissue16460 messages
2012-11-12 13:53:41tom.pohlcreate