Tom Pohl added the comment:

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 

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 

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 


Python tracker <>
Python-bugs-list mailing list

Reply via email to