Rules of Precedence for Arithmetic Operators


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.