+ 2
usage of floor division
print(20//6)=3 print(20.0//6)=3.0 print(20.15//6)=3.0 So the rounded decimal part can only be one bit at most, right?
1 Answer
+ 5
Hi!
Of course, you're correct. But, floor division and floating-point numbers simply are fundamentally incompatible and you should never use // on floats.
For that, you can use integers or math.floor() instead.
https://stackoverflow.com/questions/44681860/why-does-integer-division-return-float