2007/8/29, dany <danzat at gmail.com>: > 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: l.mastrodomenico at gmail.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4