[issue26289] Optimize floor division for ints

Mark Dickinson report at bugs.python.org
Tue Feb 9 08:41:09 EST 2016


Mark Dickinson added the comment:

A slightly neater way to compute the result in the case that the signs differ is 

  div = ~((left - 1) / right)

That saves the extra multiplication and equality check.

----------

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


More information about the Python-bugs-list mailing list