[issue42788] Issue with Python’s Floor Division

Eric V. Smith report at bugs.python.org
Wed Dec 30 12:46:13 EST 2020


Eric V. Smith <eric at trueblade.com> added the comment:

Regular division (/) yields a float, so 1 / 1 is 1.0.

https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations says that for floor division, the arguments are first converted to a common type, which here would be float.

So, your examples are basically:

>>> 1 / 1
1.0
>>> 1.0 // 1
1.0

>>> 0 / 1
0.0
>>> 0.0 // 1
0.0

This is working as expected, and is not a bug.

----------
nosy: +eric.smith -rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42788>
_______________________________________


More information about the Python-bugs-list mailing list