The specific order of operation for TLCalc is defined as below:
- Brackets: (, [
- Negate (-)
- Angle (@), factorial (!) and Exponential (E)
- Power (^)
- Permutation (nPr) and combination (nCr)
- Multiplication (*), division (/) and modulus (%)
- Addition (+) and subtraction (-) (or negate if first term)
- Comparators (>, >=, <, <=)
- Equality (==, !=)
- AND (&&)
- OR (||), XOR (|^) and IMPLIES (=>)
Tip: Always use brackets if in doubt.
WARNING: The order of operation was drastically changed in V1.18.0. The changes were made to make TLCalc more closely reflect the order of operations used in other calculators and programming languages such as C and Java. Note that in all versions, BODMAS is always adhered to.
Technical extra for those that are curious:
You may notice that the minus sign (-) is located in 2 places in the order of operations list. The parse will parse the '-' sign with lowest priority first. For example:
-2^2 is interpreted as -(2^2) because negate has a lower priority (of 7) than power (4) while
--2^2 is interpreted as -((-2)^2) since the first minus is parsed under priority 7 (like before) and the second is parsed under priority 2. The second minus is applied only to the 2 because the second minus has higher priority than power so the second minus is applied before the power and the power is applied before the first minus. Confusing? Use brackets and you won't be.