Operators
Operators are used to combine metrics to create new expressions.
The following types are operators can be used in expressions:
- Arithmetic operators
The most commonly used operators that are used to add, divide, subtract, and multiply metrics to create new expressions.
- Logic Operators
Used in conditional expressions to select the branches of an expression that is based on whether a condition is true or false.
- Applies To
- General Expressions.
- Description
- Operators are used in expressions for arithmetic or logical operations. The two types of
operators are unary and binary. Unary operators use one operand in the
format:
operand operator
Binary operators use two operands in the format:operand1 operator operand2
Unary operators are right associative; binary operators are left associative. The following expression must be read as the one that follows:a - b - c < -d
((a - b) - c) < (-d)
- Type Casting
- Some operators can, depending on their operands, cause conversion of the operand value from one type to another. This process is known as implicit casting. Most binary operators use a set of standard type conversions whereby if either operand is of type FLOAT, then the other operand is converted to a FLOAT. Any variation from this rule is described in the relevant operator section.
- Syntax
- The following table summarizes the precedence among operators. Each operator in a block shares
precedence and is evaluated from left to right. An operator in a higher block has a higher
precedence than operators in a lower block.For example,
a + b * c ==> a + (b * c)
Because
*
has a higher precedence than+
. Also,a + b - c ==> (a + b) - c
.Because
+
and-
have the same precedence and because+
is left associative.