next up previous contents
Next: Comparison operators Up: Expressions Previous: Representing state machines using   Contents

Arithmetic operators

The arithmetic operators are

        +        addition
        -        subtraction and unary minus sign
        *        multiplication
        /        integer division
        mod      remainder of division
        <<       left shift
        >>       right shift
All results of arithmetic on integers are modulo $2^{32}$, in the range $-2^{31}\ldots (2^{31} - 1)$. 1

The operators ``*'', ``/'' and ``mod'' obey the law

        y * (x/y) + (x mod y) = x

The remainder is always positive.

The expression ``x « y'' is equivalent to ``x * $2^{y}$''. Similarly, ``x » y'' is equivalent to ``x / $2^{y}$''.



2002-10-28