613-518-1166 info@zimdatabases.com

Developing ZIM Applications

Rules of Precedence for Arithmetic Operators

< All Topics
Operator

Rule of Precedence

Unary + and

Positive (+) and negative (-) signs are evaluated first, e.g., +2 or -Salary.

^

Exponentiation (^) is performed next, e.g., x^y, that is x raised to the power of y.
Note: If x is negative, y must be an integer.

* and /

Multiplication (*) and division (/) are performed following exponentiation.

+ and

Addition (+) and subtraction (-) are performed last.

Notes:

  • Operators of equal precedence are evaluated from left to right in the expression.

  • Parentheses can be used to explicitly determine the order of evaluation, overriding the order described above. Each pair of parentheses can contain only one arithmetic expression. Use parentheses extensively in arithmetic expressions.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents