As an old C programmer, I'm surprised by some results I'm getting with
integer division. For example:
[color=blue][color=green][color=darkred]
>>> -1/1000[/color][/color][/color]
-1[color=blue][color=green][color=darkred]
>>> -9/2[/color][/color][/color]
-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
integer division. For example:
[color=blue][color=green][color=darkred]
>>> -1/1000[/color][/color][/color]
-1[color=blue][color=green][color=darkred]
>>> -9/2[/color][/color][/color]
-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
Comment