Modulo and integer division are infix binary operators indicated by
`
' and `
' respectively. Though their operands are usually
integers, they can be real as well. (Integer division is ``integer''
only in the sense that its result is an integer.) The `
' and
`
' operators are defined as follows.
(The ``floor'' of x,
, is the maximum integer i
such that i<x.)
Here we will present some examples of these operators applied to
integer operands. For positive n, if n/k is represented in
mixed-fraction form as i + j/k,
and
. For example, 10/7 = 1 + 3/7, which means that
and
. A slightly tricky thing about `
' and
`
' is how they behave when n is negative. For example, one
might think of (-3)/7 as 0 + -3/7, but, for the purposes of modulo
and integer division, it should be thought of as -1 + 4/7. In other
words, the integer part, not the remainder, must carry the sign. So
and
.