Math Functions
Math functions work on numbers and can be used in any expression.
| Function | What it returns |
|---|---|
ROUND(x) or ROUND(x, digits) | The nearest whole number, or a set number of decimals. |
TRUNC(x) | The number with its decimals dropped. |
FLOOR(x) / CEIL(x) | The nearest whole number down / up. |
ABS(x) | The value without its sign. |
SIGN(x) | -1, 0, or 1, depending on the sign. |
MIN(a, b) / MAX(a, b) | The smaller / larger of two values. |
CLAMP(x, min, max) | x held within a range. |
MOD(a, b) | The remainder of a divided by b (also the % operator). |
POW(base, exponent) | A number raised to a power (there is no ^). |
SQRT(x) | The square root. |
EXP(x) | e raised to the power of x (not the exponential distribution). |
LN(x) / LOG10(x) | The natural log / the base-10 log. |
MIN and MAX take two values; for three, nest them, for example MAX(MAX(a, b), c).
Examples
Section titled “Examples”SET a_Price TO ROUND(a_Raw * 1.08, 2)SET a_Bounded TO CLAMP(a_Qty, 1, 100)
