Rules of Precedence for Arithmetic Operators
Welcome to our Knowledge Base
Documentation | Blog | Demos | Support
< All Topics
Print
Rules of Precedence for Arithmetic Operators
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
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.
Updated
ByJason Lee
Was this article helpful?
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
5