Closed
Description
PEP 238 states clearly that the result of x // y
is a float
, when x
and y
both have type float
.
For floating point inputs, the result is a float. For example:
3.5//2.0 == 1.0
And indeed this is the behaviour that's been in place since Python 2.2. However, we seem to be missing a clear statement of this in the official docs. It would be good to fix that.
Motivated by the thread https://discuss.python.org/t/make-float-floordiv-and-rfloordiv-return-an-int/24959, where it's been asserted that this behaviour is an 'implementation detail'.