Thanks to all who helped.  As was previously pointed out, many other languages
use truncation rather than rounding for // division.

Getting the behavior you want may be as easy as replacing // with the int()
function....


>>> x = 9 ; y = 2

>>> x // y, -x // y, (-x) // y
(4, -5, -5)

>>> int(x / y), -int(x / y), int(-x / y)
(4, -4, -4)

Hope that helps.

Chris
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to