Numeric expressions
This section covers numeric expression evaluation rules.
A numeric expression evaluates to a decimal value of type DECIMAL
(or INTEGER
)
MAIN
DEFINE r, c DECIMAL(10,2)
LET c = 456.22
LET r = c * 2 + ( c / 4.55 )
END MAIN
The operands of a numeric expression can be one of:
- An integer literal.
- A decimal literal.
- A variable or constant of numeric data type.
- A function returning a single numeric value.
- A boolean expression.
- The result of a DATE subtraction, as a number of days.
If a number expression includes an operand whose value is not a numeric data type, the runtime system attempts to convert the value to a number following the data conversion rules.
If an element of a number expression is NULL
,
the expression is evaluated to NULL
.
Depending on the operators and the resulting values, the data type of a numeric expression will
be DECIMAL
or INTEGER
.