[New-bugs-announce] [issue27463] Floor division is not the same as the floor of division

Izaak Weiss report at bugs.python.org
Thu Jul 7 12:07:27 EDT 2016


New submission from Izaak Weiss:

The floor division operator in Python 3 `x//y` acts differently than the floor of the division operator `math.floor(x/y)` in some edge cases due to floating point errors.

Consider `44//4.4` and `math.floor(44/4.4)`. These two expressions should, with infinite precision, evaluate to the same number. However, in practice `44//4.4` evaluates to `9.0`, but `math.floor(44/4.4)` evaluates to `10.0`.

This should either be changed, or made clear in the documentation that the two may not be equal due to floating point errors.

----------
messages: 269945
nosy: izaakweiss
priority: normal
severity: normal
status: open
title: Floor division is not the same as the floor of division
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27463>
_______________________________________


More information about the New-bugs-announce mailing list