Arithmetic Operators¶
Arithmetic Operators (1)¶
Arithmetic operators and their operands
Operator |
Meaning |
Operand type |
---|---|---|
|
multiplication |
integer, floatingpoint |
|
division |
integer, floatingpoint |
|
modulo |
integer |
|
addition |
integer, floatingpoint |
|
subtraction |
integer, floatingpoint |
Attention
Integer division truncates!
Arithmetic Operators (2)¶
Precedence rules
Multiplication, division, modulo precede addition, subtraction
Operators with same precedence are associated from left to right
|
|
precedence |
|
|
precedence |
|
|
left-associative |
|
|
left-associative |