Operators

Arithmetic operator expressions allow computation of new values. Attributes are treated as pure values when used in an arithmetic operator expression.

Quick reference

Precedence Operator Name

1

^

exponentiation (power)

2

*

multiplication

2

/

division

2

%

modulo (remainder)

3

+

addition

3

-

subtraction

Parentheses (()) may be used to override the precedence. The sub-expressions in parentheses are always evaluated first.

(1 + 2) * 3 == 9

Built-in functions

TypeQL provides several built-in functions for common mathematical and list operations:

Mathematical functions

round(x)

Returns the provided numeric argument rounded to the nearest integer.

round(3.7) == 4
round(3.2) == 3
round(-3.7) == -4
ceil(x)

Returns the provided numeric argument rounded to the nearest greater integer (ceiling).

ceil(3.2) == 4
ceil(3.7) == 4
ceil(-3.2) == -3
floor(x)

Returns the provided numeric argument rounded to the nearest lesser integer (floor).

floor(3.2) == 3
floor(3.7) == 3
floor(-3.2) == -4
abs(x)

Returns the absolute value of the provided numeric argument.

abs(5) == 5
abs(-5) == 5
abs(0) == 0