arith_exp - arithmetic operators

The table shows the possible arithmetic operators arithmetic expressions, their priority, and the order of calculation. Within one set of parentheses (see below), calculations with operators of higher priority are performed before calculations with operators of a lower priority. For consecutive operators with the same priority, the calculation is performed in the order specified in the table. In the third column of the table, 3 indicates the highest priority and 1 the lowest.

Operator Calculation Priority Order
+ Addition of operands 1 from left to right
- Subtraction of the right from the left operand 1 left to right
* Multiplication of operands 2 from left to right
/ Division of the left by the right operand 2 from left to right
DIV Integer portion of the division of the left by the right operand 2 from left to right
MOD Integer remainder of the division of the left by the right operand 2 from left to right
** Exponentiation of the left with the right operand 3 from right to left

Division by the value 0 is undefined and leads to a treatable exception. An exception is not raised only if the dividend is 0 itself. In this case the result is set to 0.