Arithmetic operators

You can process numeric terms in comparison expressions using the arithmetic operators:

Operator
Meaning
+
Add
-
Minus
*
Multiply
/
Divide
%
Integer divide (divide and return the integer part of the result)
//
Remainder (divide and return the remainder--not modulo, because the result might be negative)
**
Power® (raise a number to a whole-number power)
Prefix -
Same as the subtraction: 0 - number
Prefix +
Same as the addition: 0 + number

You can use these operators to produce an intermediate result that you can compare with another term. For example, if the field #6 contains a numeric value representing an employee's annual salary, and the fields #15 and #23 contain numeric values representing the employee's annual travel allowance and annual bonus, respectively, you could use the following comparison to select records for employees with a combined annual payment of greater than $100,000:

(#6 + #15 + #23) > 100000

For another example, if field #45 contains the number of sick days an employee is entitled to annually, and the field #46 contains the number of sick days an employee has used in the current year, you could use the following comparison to select records for employees who have used 50% or more of their sick day entitlements:

(#46 / #45) >= .5
Note: In each of these examples, the arithmetic sub-expression is contained in parentheses. This ensures that the entire sub-expression is evaluated before the comparison operation.

The order of precedence of arithmetic operators is as follows (highest is at the top):

Operator
Meaning
+ - ¬ \
Prefix operators
**
Power®
* /
Multiply and divide
+ -
Add and subtract

For example, * (multiply) has a higher priority than + (add), so 3+2*5 evaluates as 13 (rather than the 25 that would result if strict left to right evaluation occurred). To force the addition to occur before the multiplication, you could rewrite the expression as (3+2)*5. Adding the parentheses makes the first three tokens a sub-expression.