Returns the absolute value of a number.
Examples
SELECT abs(-42);
| abs(-42) |
| -------- |
| 42       |
Overloads
Calculates the inverse cosine in radians.
Parameters
x:
double
The input value.
Calculates the inverse hyperbolic cosine.
Parameters
x:
double
The input value.
Calculates the inverse hyperbolic sine.
Parameters
x:
double
The input value.
Calculates the inverse hyperbolic tangent.
Parameters
x:
double
The input value.
Calculates the inverse sine in radians.
Parameters
x:
double
The input value.
Calculates the arctangent of a number in radians.
Parameters
x:
double
The input value.
Calculates the arctangent of y/x in radians, handling quadrant correctly.
Parameters
y:
double
The second input value.
x:
double
The input value.
Rounds a number using banker's rounding, optionally to a specified number of decimal places.
Examples
SELECT bankers_round(2.5);
| bankers_round(2.5) |
| ------------------ |
| 2.0                |
SELECT bankers_round(42.125, 2);
| bankers_round(42.125, 2) |
| ------------------------ |
| 42.12                    |
Calculates the cube root of a number.
Examples
SELECT cbrt(27);
| cbrt(27) |
| -------- |
| 3.0      |
Overloads
Alias for ceiling.
Examples
SELECT ceil(42.1);
| ceil(42.1) |
| ---------- |
| 43.0       |
Returns the smallest integer greater than or equal to the given number.
Examples
SELECT ceiling(42.1);
| ceiling(42.1) |
| ------------- |
| 43.0          |
Constrains a value to a minimum and maximum range.
Examples
SELECT clamp(12, 0, 10);
| clamp(12, 0, 10) |
| ---------------- |
| 10               |
Calculates the cosine of an angle in radians.
Parameters
x:
double
The input value.
Calculates the hyperbolic cosine of a number.
Parameters
x:
double
The input value.
Calculates the cotangent of an angle in radians.
Parameters
x:
double
The input value.
Converts radians to degrees.
Parameters
radians:
double
The angle in radians.
Examples
SELECT degrees(pi());
| degrees(pi()) |
| ------------- |
| 180.0         |
Returns the mathematical constant e (Euler's number).
Parameters
None
Calculates e raised to the power of a number.
Parameters
x:
double
The input value.
Returns the largest integer less than or equal to the given number.
Examples
SELECT floor(42.9);
| floor(42.9) |
| ----------- |
| 42.0        |
Checks if a floating-point number is finite (not NaN or infinite).
Parameters
value:
double
The input value.
Checks if a floating-point number is infinite.
Parameters
value:
double
The input value.
Checks if a floating-point number is NaN (Not a Number).
Parameters
value:
double
The input value.
Calculates the natural logarithm of a number.
Parameters
x:
double
The input value.
Calculates the logarithm of a number with a specified or default base.
Examples
SELECT log(10, 100);
| log(10, 100) |
| ------------ |
| 2.0          |
Overloads
Calculates the base-10 logarithm of a number.
Parameters
x:
double
The input value.
Calculates the natural logarithm of (1 + x), accurate for small x.
Parameters
x:
double
The input value.
Calculates the base-2 logarithm of a number.
Parameters
x:
double
The input value.
Returns a floating point NaN (Not a Number) value.
Parameters
None
Returns the negative value of a number.
Returns the mathematical constant π (pi).
Parameters
None
Raises a number to the power of another number.
Parameters
base:
double
The base value.
exponent:
double
The exponent to raise the base to.
Examples
SELECT pow(2.0, 8.0);
| pow(2.0, 8.0) |
| ------------- |
| 256.0         |
Raises the first number to the power of the second number.
Parameters
base:
double
The base value.
exponent:
double
The exponent to raise the base to.
Examples
SELECT power(2.0, 8.0);
| power(2.0, 8.0) |
| --------------- |
| 256.0           |
Converts degrees to radians.
Parameters
degrees:
double
The angle in degrees.
Examples
SELECT radians(180.0);
| radians(180.0)    |
| ----------------- |
| 3.141592653589793 |
Generates a random float between 0 and 1.
Parameters
None
Generates a pseudo-random float or integer.
Examples
SELECT random();
| random()                  |
| ------------------------- |
| <random double in [0, 1)> |
Rounds a floating point number, optionally to a specified number of decimal places.
Examples
SELECT round(42.5);
| round(42.5) |
| ----------- |
| 43.0        |
SELECT round(42.125, 2);
| round(42.125, 2) |
| ---------------- |
| 42.13            |
Rounds a number to n significant figures.
Parameters
value:
double
The input value.
digits:
int64
The number of significant digits to keep.
Returns the sign of a number as -1, 0, or 1.
Examples
SELECT sign(-42);
| sign(-42) |
| --------- |
| -1        |
Overloads
Calculates the sine of an angle in radians.
Parameters
x:
double
The input value.
Calculates the square root of a number.
Parameters
x:
double
The input value.
Examples
SELECT sqrt(144.0);
| sqrt(144.0) |
| ----------- |
| 12.0        |
Calculates the tangent of an angle in radians.
Parameters
x:
double
The input value.
Calculates the hyperbolic tangent of a number.
Parameters
x:
double
The input value.
Truncates a floating-point number, optionally to a specified number of decimal places.
Examples
SELECT truncate(42.987);
| truncate(42.987) |
| ---------------- |
| 42.0             |
SELECT truncate(42.987, 2);
| truncate(42.987, 2) |
| ------------------- |
| 42.98               |
Returns the remainder after dividing the first value by the second.
Examples
SELECT 7 % 3;
| 7 % 3 |
| ----- |
| 1     |
Overloads
Multiplies numeric values, or scales a duration by a numeric value.
Examples
SELECT 6 * 7;
| 6 * 7 |
| ----- |
| 42    |
basic binary ** operation
Parameters
x:
double
The input value.
y:
double
The second input value.
Adds numeric, temporal, or interval values.
Examples
SELECT 2 + 3;
| 2 + 3 |
| ----- |
| 5     |
Subtracts numeric, temporal, or interval values.
Examples
SELECT 7 - 3;
| 7 - 3 |
| ----- |
| 4     |
Negates a numeric or interval value.
Examples
SELECT -42;
| -42 |
| --- |
| -42 |
SELECT 7 - 3;
| 7 - 3 |
| ----- |
| 4     |
Overloads
Divides numeric values, or divides a duration by a numeric value.
Examples
SELECT 7.0 / 2.0;
| 7.0 / 2.0 |
| --------- |
| 3.5       |
Overloads
floor division
Overloads
Alias for pow.
Examples
SELECT pow(2.0, 8.0);
| pow(2.0, 8.0) |
| ------------- |
| 256.0         |