Skip to main content
Version: 6.x

Arithmetic operators (+, -, *, ...)

Arithmetic operators create properties whose value is the result of an arithmetic operation. The arguments of these operators must be properties whose values are instances of number classes . The platform currently supports the following arithmetic operators:

OperatorNameDescriptionExampleResult
+SummationTakes two input operands and returns their sum3 + 58
-DifferenceAccepts two input operands and returns their difference
This operator also has a unary form, in which case the first operand is considered equal to 0
5 - 32
*MultiplicationAccepts two input operands and returns their product3 * 515
/RatioTakes two input operands and returns their ratio15 / 35

All of these operators return NULL if one of the operands is NULL . It is also possible to use a special form of summation and difference operators with brackets, in which case NULL will be equivalent to 0. The reverse is also true for these type of operators: if the result of an operator in such form is 0, then NULL is returned (e. g., 5 (-) 5 = NULL):

OperatorNameDescriptionExampleResult
(+)SummationTakes two input operands and returns their sum, treating NULL as 03 (+) 5
3 (+) NULL
8
3
(-)DifferenceTakes two input operands and returns their difference, treating NULL as 05 (-) 3
5 (-) NULL
5 (-) 5
2
5
NULL

Determining the result class

The result class is determined as:

OperatorResult
+, -Common ancestor ("Numbers" family)
*NUMERIC[p1.IntegerPart + p1.Precision + p2.IntegerPart + p2.Precision, p1.Precision + p2.Precision]
/NUMERIC[p1.IntegerPart + p1.Precision + p2.IntegerPart + p2.Precision, p1.Precision + p2.IntegerPart]

Language

Description of arithmetic operators.

Examples

sum(a, b) = a + b;
transform(a, b, c) = -a * (b (+) c);