[Python-ideas] division oddness
Xavier Ho
contact at xavierho.com
Fri May 7 01:32:18 EDT 2010
On Fri, May 7, 2010 at 12:14 PM, Chris Rebert <clp2 at rebertia.com> wrote:
> Personally, I find the following the most unintuitive:
> divmod(-11, 3) == (-4, 1)
>
> So, we overshoot -11 and then add 1 to go back to the right place?
> That violates my intuitive thought that abs((n//d)*d) <= abs(n) ought to
> hold.
>
Haha, really? *gives it a try* Oh wow...
Yeah. I don't like that either.
Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100507/fc092fa9/attachment-0001.html>
More information about the Python-list
mailing list