Integer division always rounds down (towards negative infinity).
Plain or long integer division yields an integer of the same type; the result is that of mathematical division with the floor1 function applied to the result.
http://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations
This allows for the integer division and modulo (remainder, %
) operators to connect nicely through the identity x == (x/y)*y + (x%y)
.
1 floor(x) is the largest integer not greater than x.