×
Menu
Index

12.8. Formula Operators

The table below lists the operators that can be used in formula profiles. They include the common arithmetic operators and Parentheses ‘(' and ‘)’ can be used to define the order of evaluation. In general operator precedence is taken as the table below:
Operator
Precedence
Unary?
Usage
Description
-
1
Yes
-x
Unary minus operator
^
2
No
x ^ y
x raised to the power of y
*
3
No
x * y
Multiplication operator
/
3
No
x / y
Division operator
\
3
No
x \ y
Integer divide operator; divides the first operand by the second and rounds the result to an integer (rounding towards zero)
%
3
No
x % y
Modulo; find remainder of the division of x by y
+
4
No
x + y
Addition operator
-
4
Yes
x - y
Subtraction operator
5
No
x > y
“Is greater than” logical operator. Returns 1 if true, 0 if false.
5
No
x < y
“Is less than” logical operator. Returns 1 if true, 0 if false.
>=
5
No
x >= y
“Is greater than or equal to” logical operator. Returns 1 if true, 0 if false.
<=
5
No
x <= y
“Is less than or equal to” logical operator. Returns 1 if true, 0 if false.
!
6
Yes
!x
“Fuzzy NOT” logical operator. Returns 1-x, but subject to range [0,1].
&
7
No
x & y
“Fuzzy AND” logical operator. Returns min(x,y), but subject to range [0,1].
|
8
No
x | y
“Fuzzy OR” logical operator. Returns max(x,y), but subject to range [0,1].
 
Operators are processed in order of precedence. Operators of equal precedence are evaluated in left-to-right order. Brackets override the processing order, e.g., if ta=21, 3*ta-20=43, but 3*(ta-20)=3. If in doubt, use brackets.
Operators involving a test for equality (those containing the “=” sign) are for most practical purposes equivalent to the version of the operator without the equals sign.