Integer division, surprising results

Michael Cornelius michael at ninthorder.com
Mon May 10 09:59:08 EDT 2004


As an old C programmer, I'm surprised by some results I'm getting with
integer division. For example:

>>> -1/1000
-1
>>> -9/2
-5

I expect the results of these expressions to be 0 and -4,
respectively. 

I've looked at faqs and documentation, and nothing jumped out at me. Can
anyone explain the reasoning for this?

Thanks,
Michael Cornelius





More information about the Python-list mailing list