Steven D'Aprano added the comment:
Although it often gets called "integer division", that's not actually what //
does, it is actually *floor* division, as documented here:
https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex
So the behaviour as given is correct: it
Serhiy Storchaka added the comment:
To get 20.45 use the true division operator /.
If float // int would return int, 1e300 // 2 would return a 300-digit integer.
It takee more memory and its creation is slower than 5e299. In addition it does
not make sense to provide such precision.
---
New submission from Douglas Feather :
40.9//2 give 20.0 as a result. I would have expected one of: 20.45 or 20. If
it is going to give an FP answer then it should do the division as FP and get
the right answer. If it is going to do an integer division then it should give
the division as an