Mathematical Functions

This page covers mathematical operators and functions available in Rockset.

All functions accept arguments of types int and float. The return type is float, unless otherwise specified.

Note: A null argument to any mathematical function will result in a null return value

List of functions defined in this section:

FunctionDescription
ABS(x)Returns absolute value of x. Return type is the same as input.
ACOS(x)Computes the arc cosine of x.
ACOSH(x)Computes the inverse hyperbolic cosine of x.
ASIN(x)Computes the arc sine of x.
ASINH(x)Computes the inverse hyperbolic sine of x.
ATAN(x)Computes the arc tangent of x.
ATAN2(y, x)Computes the arc tangent of y / x, but with proper sign for quadrant correction. That is, correctly computes the angle ΞΈ when converting from the Cartesian coordinates (x, y) to the polar coordinates (r, ΞΈ).
ATANH(x)Computes the inverse hyperbolic tangent of x.
BITWISE_AND(x, y)Returns the bitwise AND of x and y in 2’s complement representation.
BITWISE_NOT(x)Returns the bitwise NOT of x in 2’s complement representation.
BITWISE_OR(x, y)Returns the bitwise OR of x and y in 2’s complement representation.
BITWISE_XOR(x, y)Returns the bitwise XOR of x and y in 2’s complement representation.
BIT_COUNT(x, bits)Count the number of bits set in x (treated as bits-bit signed integer) in 2’s complement representation.
CEIL(x)Returns the smallest integral value that is not less than x.
CEILING(x)Alias of CEIL.
ACOS(x)Computes the arc cosine of x.
ACOSH(x)Computes the inverse hyperbolic cosine of x.
EXP(x)Computes e to the power of x.
FLOOR(x)Returns the largest integral value that is not greater than x.
FROM_BASE(string, base)Returns the value of string interpreted as a number in base.
GREATEST(a, b, c, ...)Returns the argument that is greater than or equal to all other arguments.
HYPOT(x, y)Computes SQRT(x*x + y*y), that is, the length of the hypothenuse of a right-angled triangle with sides of lengths x and y. This is also the distance between the point at coordinates (x, y) and origin.
IS_NAN(x)Returns true if the input is a floating point Not-A-Number, for instance, due to dividing zero by zero or taking the square root of a negative number. Non-numeric inputs yield null.
LEAST(a, b, c, ...)Returns the argument that is less than or equal to all other arguments.
LN(x)Computes the natural logarithm of x.
LOG(x)Alias of LN.
LOG10(x)Computes the base-10 logarithm of x.
LOG2(x)Computes the base-2 logarithm of x.
POW(x, y)Computes x to the power of y.
POWER(x, y)Alias of POW.
RAND()Returns a pseudo-random value in the range [0.0, 1.0).
ROUND(x)Returns the integral value that is nearest to x, with halfway cases rounded away from zero.
SIGN(x)Returns sign of x as an integer: -1 if x is negative, 0 if x is zero, 1 if x is positive.
ASIN(x)Computes the arc sine of x.
ASINH(x)Computes the inverse hyperbolic sine of x.
SQRT(x)Computes the square root of x.
ATAN(x)Computes the arc tangent of x.
ATANH(x)Computes the inverse hyperbolic tangent of x.
TRUNC(x)Alias of TRUNCATE.
TRUNCATE(x)Rounds x toward zero, returning the nearest integral value that is not larger in magnitude than x.