New submission from David Jones <d...@pobox.com>: Consider: x//y != x//float(y) for some integer values of x and y.
For example, x = 2**54-1, and y = 2: >>> x=2**54-1 >>> y=2 >>> x//y 9007199254740991L >>> x//float(y) 9007199254740992.0 >>> _==x//y False I have no idea whether this should actually be a bug or not. The behaviour (above) _is_ the documented behaviour (because the operands are documented as being converted to a common type). But... I think there's a good case for computing the mathematically correct answer regardless of the types of the inputs. For one thing, one of the reasons behind introducing the // operator was to make division the same regardless of whether the inputs were floating point or int. Computing the mathematically correct answer (which since the answer is an integer is always exactly representable in Python) would be better, and simpler to document. ---------- components: Interpreter Core messages: 89915 nosy: drj severity: normal status: open title: floor division gives different result for int versus float. type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6387> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com