Mark Dickinson added the comment:
See also http://docs.python.org/2/faq/programming.html#why-does-22-10-return-3
BTW, integer division does not use float division internally. That would fail
for integers too large to be exactly representable as floats. The
implementation can be seen in Objec
R. David Murray added the comment:
This is not an aspect of Python that can possibly change, I'm afraid, for
backward compatibility reasons.
--
nosy: +r.david.murray
resolution: -> duplicate
stage: -> committed/rejected
status: open -> closed
superseder: -> Integer division for negat
New submission from Vatroslav Suton:
integer division obviously uses float division with math.floor, which produces
invalid result when result is less than 0, simply try the following 5/2 versus
-5/2. Please use math.ceil function for results less than 0.
btw is there any way to patch that in _