Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
Closed
Description
PEP 238states clearly that the result ofx // y
is afloat
, whenx
andy
both have typefloat
.
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 threadhttps://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'.