2007/8/29, dany <[EMAIL PROTECTED]>: > For some reason, the integer division behaves unexpectedly for negative > integers. > > Looking deeper in the python PEPs, I saw that division on integers is > defined as: idiv(a, b) = floor(fdiv(a, b)). > This non-quotient division leads to some odd results, e.g. Python seems > to think -3/2+3/2 = -1. This is clearly, and correct me if I'm mistaken > - wrong.
FAQ: Why does -22 / 10 return -3? http://www.python.org/doc/faq/programming/#why-does-22-10-return-3 Past discussion: <http://mail.python.org/pipermail/python-list/2005-February/thread.html#306577> Also, FYI, TCL and Ruby behave the same way. -- Lino Mastrodomenico E-mail: [EMAIL PROTECTED] _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com