Rules of Precedence for Arithmetic Operators

Rules of Precedence for Arithmetic Operators

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

Rules of Precedence for Arithmetic Operators

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?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese