Math Functions

Math functions help you to implement different mathematical concepts in queries.

FunctionReturn TypeInput ArgumentsDescription
abs({x})Same as the input
  • x: Any data type
Returns the absolute value of x.
acos({angle})Double
  • angle: Any non-string value in radians
Returns the arc cosine of the input.
asin({angle})Double
  • angle: Any non-string value in radians
Returns the arc sine of the input.
atan({angle})Double
  • angle: Any non-string value in radians
Returns the arc tangent of the input.
beta_cdf({x}, {y}, {v})Double
  • x, y: Positive real numbers
  • v: A real value
Computes the Beta cdf with given x and y parameters: P(N < z; x, y).
cbrt({x})Same as input
  • x: Any non-string value
Returns the cube root of the input.
ceil({x})Same as input
  • x: Any non-string value
Returns the input argument rounded up to the nearest integer.
cos({angle})Double
  • angle: Any non-string value in radians
Returns the cosine of the input.
cosh({angle})Double
  • angle: Any non-string value in radians
Returns the hyperbolic cosine of the input.
cosine_similarity({x}, {y})Double
  • x, y: Vectors
Returns the cosine similarity between the input sparse vectors.
degrees({angle})Double
  • angle: Any non-string value in radians
Converts input angle in radians to degrees.
e()DoubleNoneReturns the constant Euler’s number.
exp({x})Double
  • x: Any non-string value
Returns Euler’s number raised to the power of x.
floor({x})Integer
  • x: Any non-string value
Returns the input value rounded down to the nearest integer.
from_base({string}, {radix})Bigint
  • string: String
  • radix: Integer
Returns the value of the string interpreted as a base-radix number.
infinity()DoubleNoneReturns the constant representing positive infinity.
inverse_beta_cdf({mean}, {standard_deviation}, {probability})Double
  • mean: A real value
  • standard_deviation: A real, positive value
  • probability: A real number from 0 to 1
Compute the inverse of the Beta cdf with given mean and standard_deviation for the cumulative probability (p): P(N < n). The mean is a real value and the standard deviation is a real and positive value. The probability p lies on the interval (0, 1).
inverse_normal_cdf({mean}, {standard_deviation}, {probability})Double
  • mean: A real value
  • standard_deviation: A real, positive value
  • probability: A real number from 0 to 1
Compute the inverse of the Normal cdf with given mean and standard_deviation for the cumulative probability (p): P(N < n). The mean is a real value and the standard deviation is a real and positive value. The probability p lies on the interval (0, 1).
is_finite({x})Boolean
  • x:
Returns true if the input value is finite, otherwise false.
is_nan({x})Boolean
  • x:
Returns true if the input value is not-a-number, otherwise false.
ln({x})Double
  • x:
Returns the natural logarithm of the input value.
log({base}, {x})Double
  • base:
  • x:
Returns the input base logarithm of the input value.
log2({x})Double
  • x:
Returns the base 2 logarithm of the input value.
log10({x})Double
  • x:
Returns the base 10 logarithm of the input value.
mod({x}, {y})Same as input
  • x, y: Any non-string values x and y, where x is the dividend and y is the divisor
Returns the modulus (remainder) of x divided by y.
nan()DoubleNoneReturns the constant representing not-a-number.
normal_cdf({mean}, {standard_deviation}, {v})Double
  • mean: A real value
  • standard_deviation: A real, positive value
  • v: A real value
Compute the Normal cdf with given mean and standard_deviation: P(N < v; mean, sd). The mean and value v are real values, and the standard_deviation is a real and positive value.
pi()DoubleNoneReturns the constant pi.
pow({x}, {y})Double
  • x, y: Any non-string values
Returns x raised to the power of y.
power({x}, {y})Double
  • x, y: Any non-string value
Returns x raised to the power of y.
radians({angle})Double
  • angle: Any non-string value in degrees
Converts the input angle in degrees to radians.
rand()DoubleNoneReturns a pseudo-random value in the range 0.0 <= x < 1.0.
random()DoubleNoneReturns a pseudo-random value in the range 0.0 <= x < 1.0.
round({x})Double
  • x:
Returns input value rounded to the nearest integer.
sign({x})Integer
  • x:
Returns the signum function of the input.
sin({angle})Double
  • angle: Any non-string value in radians
Returns the sine of the input.
sqrt({x})Same as input
  • x: Any non-string value
Returns the square root of the input argument.
tan({angle})Double
  • angle: Any non-string value in radians
Returns the tangent of the input.
tanh({angle})Double
  • angle: Any non-string value in radians
Returns the hyperbolic tangent of the input.
to_base({x}, {radix})Varchar
  • x: Any non-string value
  • r: Integer
Returns the base-radix representation of the input.
truncate({x})Double
  • x: Any real number
Returns input rounded to integer by dropping digits after the decimal point.
wilson_interval_lower({successes}, {trials}, {Z})Double
  • successes:
  • trials:
  • Z:
Returns the lower bound of the Wilson score interval of a Bernoulli trial process at a confidence specified by the z-score Z.
wilson_interval_upper({successes}, {trials}, {Z})Double
  • successes:
  • trials:
  • Z:
Returns the upper bound of the Wilson score interval of a Bernoulli trial process at a confidence specified by the z-score Z.