Message175443
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). |
|
Date |
User |
Action |
Args |
2012-11-12 13:53:41 | tom.pohl | set | recipients:
+ tom.pohl, loewis, mark.dickinson, skrah, serhiy.storchaka |
2012-11-12 13:53:41 | tom.pohl | set | messageid: <1352728421.95.0.44557665826.issue16460@psf.upfronthosting.co.za> |
2012-11-12 13:53:41 | tom.pohl | link | issue16460 messages |
2012-11-12 13:53:41 | tom.pohl | create | |
|