Next: Bitwise Operators, Previous: Relational Operators, Up: Integers [Contents][Index]

The following left-associative binary arithmetic operators are supported, in descending precedence order:

- Exponentiation
`**`

, multiplication`*`

, integer division`/`

, integer ceil-division`/^`

and modulus`%`

. - Addition
`+`

and subtraction`-`

.

In all the binary arithmetic operations automatic promotions (coercions) are performed in the operands as needed. The rules are:

- If one of the operands is unsigned and the other operand is signed, the second is converted to an unsigned value.
- If the size in bits of one of the operands is bigger than the size of the other operand, the second is converted to the same number of bits.

The following right-associative unary arithmetic operators are supported:

Finally, pre-increment, pre-decrement, post-increment and
post-decrement operators `++`

and `--`

are supported.