All functions > MATH
All functions in the MATH category.
Arithmetic
| Function | DuckDB | Trino | Serving | Description |
|---|
+ [addition] | ✓ | ✓ | ✓ | Adds two numeric values, or adds an interval to a date or timestamp. |
UNARY_MINUS() | ✓ | ✓ | ✓ | Negates a numeric expression (unary minus). |
UNARY_PLUS() | ✓ | ✓ | ✓ | Explicit unary plus on an expression (no-op on the value). |
- [subtraction] | ✓ | ✓ | ✓ | Subtracts the right-hand value from the left-hand value (numeric, temporal, or interval forms). |
FACTORIAL() | ✓ | ✓ | ✓ | Returns the factorial of a non-negative integer (n!). |
CLAMP() | ✓ | ✓ | ✓ | Constrains a value to a closed interval: the result is the value limited to lie between low and... |
* [multiplication] | ✓ | ✓ | ✓ | Returns the product of two numbers, or scales an interval by an integer factor. |
/ [division] | ✓ | ✓ | ✓ | Divides the left-hand number by the right-hand number, producing a DOUBLE result. |
TRY_DIVIDE() | ✓ | ✓ | ✓ | Same as DIVIDE, but returns NULL if the divisor is zero. |
// [integer] | ✓ | ✓ | ✓ | Divides the left-hand number by the right-hand number while preserving the dividend's type (integer... |
TRY_DIVIDE_TYPE() | ✓ | ✓ | ✓ | Same as DIVIDE_TYPE, but returns NULL if the divisor is zero. |
% [remainder] | ✓ | ✓ | ✓ | Returns the remainder after dividing the left-hand number by the right-hand number. |
Rounding
| Function | DuckDB | Trino | Serving | Description |
|---|
ROUND() | ✓ | ✓ | ✓ | Rounds a number to the nearest integer or to a specified number of decimal places. |
TRUNCATE() | ✓ | ✓ | ✓ | Returns the integer part of a number by discarding the fractional part. |
FLOOR() | ✓ | ✓ | ✓ | Returns the largest integer less than or equal to the input. |
CEIL() | ✓ | ✓ | ✓ | Returns the smallest integer greater than or equal to the input. |
Sign And Absolute
| Function | DuckDB | Trino | Serving | Description |
|---|
ABS() | ✓ | ✓ | ✓ | Returns the absolute value of a number. |
SIGN() | ✓ | ✓ | ✓ | Returns the sign of a number: -1 for negative, 0 for zero, 1 for positive. |
Exponential
| Function | DuckDB | Trino | Serving | Description |
|---|
^ [exponentiation] | ✓ | ✓ | ✓ | Raises a number to a power (integer or floating-point operands of the same type). |
SQRT() | ✓ | ✓ | ✓ | Returns the square root of a number. |
CBRT() | ✓ | ✓ | ✓ | Returns the cube root of a number. |
EXP() | ✓ | ✓ | ✓ | Returns e raised to the power of the given number. |
LN() | ✓ | ✓ | ✓ | Returns the natural logarithm (base e) of a number. |
LOG() | ✓ | ✓ | ✓ | Returns the logarithm of a number to a specified base. |
Trigonometric
| Function | DuckDB | Trino | Serving | Description |
|---|
COS() | ✓ | ✓ | ✓ | Returns the cosine of an angle in radians. |
SIN() | ✓ | ✓ | ✓ | Returns the sine of an angle in radians. |
TAN() | ✓ | ✓ | ✓ | Returns the tangent of an angle in radians. |
ACOS() | ✓ | ✓ | ✓ | Returns the arccosine (inverse cosine) of a number, in radians. |
ASIN() | ✓ | ✓ | ✓ | Returns the arcsine (inverse sine) of a number, in radians. |
ATAN() | ✓ | ✓ | ✓ | Returns the arctangent (inverse tangent) of a number, in radians. |
ATAN2() | ✓ | ✓ | ✓ | Returns the arctangent of y/x, using the signs of both arguments to determine the quadrant. |
Hyperbolic
| Function | DuckDB | Trino | Serving | Description |
|---|
COSH() | ✓ | ✓ | ✓ | Returns the hyperbolic cosine of a number. |
SINH() | ✓ | ✓ | ✓ | Returns the hyperbolic sine of a number. |
TANH() | ✓ | ✓ | ✓ | Returns the hyperbolic tangent of a number. |
Angle Conversion
| Function | DuckDB | Trino | Serving | Description |
|---|
DEGREES() | ✓ | ✓ | ✓ | Converts an angle from radians to degrees. |
RADIANS() | ✓ | ✓ | ✓ | Converts an angle from degrees to radians. |
Base Conversion
| Function | DuckDB | Trino | Serving | Description |
|---|
FROM_BASE() | ✗ | ✓ | ✗ | Returns the decimal (base 10) equivalent of a number expressed in a specified base. |
TO_BASE() | ✓ | ✓ | ✓ | Returns the string representation of a decimal number in a specified base. |
Constant
| Function | DuckDB | Trino | Serving | Description |
|---|
E() | ✓ | ✓ | ✓ | Returns the mathematical constant e (Euler's number). |
PI() | ✓ | ✓ | ✓ | Returns the mathematical constant π (pi). |
INFINITY() | ✓ | ✓ | ✓ | Returns the floating-point representation of positive infinity. |
NAN() | ✓ | ✓ | ✓ | Returns the floating-point representation of NaN (Not a Number). |
Validation Math
| Function | DuckDB | Trino | Serving | Description |
|---|
IS_FINITE() | ✓ | ✓ | ✓ | Returns TRUE if a floating-point number is finite (neither infinite nor NaN). |
IS_INFINITE() | ✓ | ✓ | ✓ | Returns TRUE if a floating-point number is infinite (positive or negative). |
IS_NAN() | ✓ | ✓ | ✓ | Returns TRUE if a floating-point value is NaN (Not a Number). |
Bucketing
| Function | DuckDB | Trino | Serving | Description |
|---|
WIDTH_BUCKET_REGULAR() | ✗ | ✓ | ✗ | Returns the bucket number for a value in equally-spaced buckets within a range. |
WIDTH_BUCKET() | ✗ | ✓ | ✗ | Returns the bucket number for a value in a histogram with custom bin boundaries. |
Summary
Functions in this category: 47