Compatible with PostgreSQL, Hologres allows you to use standard PostgreSQL syntax for data development.

The following table describes the mathematical functions supported by Hologres. The functions supported by Hologres are only a subset of the PostgreSQL functions. For more information about how to use these functions, see Mathematical Functions and Operators in the PostgreSQL documentation.
Function Description Example Result
abs(bigint) Returns the absolute value of a number of the BIGINT data type, where the number can be a literal or an expression that evaluates to a number. abs(-17) 17
abs(int) Returns the absolute value of a number of the INT data type, where the number can be a literal or an expression that evaluates to a number. abs(-17) 17
abs(float8) Returns the absolute value of a number of the FLOAT8 data type, where the number can be a literal or an expression that evaluates to a number. abs(-17.4) 17.4
abs(float4) Returns the absolute value of a number of the FLOAT4 data type, where the number can be a literal or an expression that evaluates to a number. abs(-17.4) 17.4
abs(numeric) Returns the absolute value of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. abs(-17.4) 17.4
cbrt(dp) Returns the cube root of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. cbrt(27.0) 3
ceil(dp) Rounds a number of the DOUBLE PRECISION data type up to the nearest integer, where the number can be a literal or an expression that evaluates to a number. ceil(-42.8) -42
ceil(numeric) Rounds a number of the NUMERIC data type up to the nearest integer, where the number can be a literal or an expression that evaluates to a number. ceil(-42.8) -42
ceiling(dp) Rounds a number of the DOUBLE PRECISION data type up to the nearest integer, where the number can be a literal or an expression that evaluates to a number. ceil(-42.8) -42
ceiling(numeric) Rounds a number of the NUMERIC data type up to the nearest integer, where the number can be a literal or an expression that evaluates to a number. ceil(-42.8) -42
degrees(dp) Converts a number of the DOUBLE PRECISION data type from radians to degrees, where the number can be a literal or an expression that evaluates to a number. degrees(0.5) 28.6478897565412
exp(dp) Returns the result of constant e raised to the power of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. exp(1.0) 2.71828182845905
exp(numeric) Returns the result of constant e raised to the power of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. exp(1.0) 2.71828182845905
floor(dp) Rounds a number of the DOUBLE PRECISION data type down to the nearest integer, where the number can be a literal or an expression that evaluates to a number. floor(-42.8) -43
floor(numeric) Rounds a number of the NUMERIC data type down to the nearest integer, where the number can be a literal or an expression that evaluates to a number. floor(-42.8) -43
ln(dp) Returns the natural logarithm of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. ln(2.0) 0.693147180559945
ln(numeric) Returns the natural logarithm of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. ln(2.0) 0.693147180559945
log(dp) Returns the base 10 logarithm of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. log(100.0) 2
log(numeric) Returns the base 10 logarithm of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. log(100.0) 2
log(b numeric, x numeric) Returns the base b logarithm of x, where both b and x are numbers of the NUMERIC data type. The numbers can be literals or expressions that evaluate to numbers. log(2.0, 64.0) 6.0000000000
mod(bigint, x) Returns the remainder of a number of the BIGINT data type divided by number x. The numbers can be literals or expressions that evaluate to numbers. mod(9,4) 1
mod(int, x) Returns the remainder of a number of the INT data type divided by number x. The numbers can be literals or expressions that evaluate to numbers. mod(9,4) 1
pi() Returns the value of constant π to 14 decimal places. pi() 3.14159265358979
power(a dp, b dp) Returns the result of a raised to the power of b, where both a and b are numbers of the DOUBLE PRECISION data type. The numbers can be literals or expressions that evaluate to numbers. power(9.0, 3.0) 729
power(a numeric, b numeric) Returns the result of a raised to the power of b, where both a and b are numbers of the NUMERIC data type. The numbers can be literals or expressions that evaluate to numbers. power(9.0, 3.0) 729
radians(dp) Converts a number of the DOUBLE PRECISION data type from degrees to radians, where the number can be a literal or an expression that evaluates to a number. radians(45.0) 0.785398163397448
round(dp) Rounds a number of the DOUBLE PRECISION data type to the nearest integer, where the number can be a literal or an expression that evaluates to a number. round(42.4) 42
round(numeric) Rounds a number of the NUMERIC data type to the nearest integer, where the number can be a literal or an expression that evaluates to a number. round(42.4) 42
round(v numeric, s int) Rounds v to the nearest number with s decimal places of precision, where v is a number of the NUMERIC data type and s is a number of the INT data type. Number v can be a literal or an expression that evaluates to a number. round(42.4382, 2) 42.44
sign(dp) Returns the sign of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. If the specified number is greater than 0, the result of the function is 1. If the specified number is less than 0, the result of the function is -1. If the specified number is 0, the result of the function is 0. sign(-8.4) -1
sign(numeric) Returns the sign of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. If the specified number is greater than 0, the result of the function is 1. If the specified number is less than 0, the result of the function is -1. If the specified number is 0, the result of the function is 0. sign(-8.4) -1
sqrt(dp) Returns the square root of a number of the DOUBLE PRECISION data type, where the number can be a literal or an expression that evaluates to a number. sqrt(2.0) 1.4142135623731
sqrt(numeric) Returns the square root of a number of the NUMERIC data type, where the number can be a literal or an expression that evaluates to a number. sqrt(2.0) 1.4142135623731
trunc(dp) Truncates a number of the DOUBLE PRECISION data type to an integer, where the number can be a literal or an expression that evaluates to a number. trunc(42.8) 42
trunc(numeric) Truncates a number of the NUMERIC data type to an integer, where the number can be a literal or an expression that evaluates to a number. trunc(42.8) 42
trunc(v numeric, s int) Truncates v to s decimal places, where v is a number of the NUMERIC data type and s is a number of the INT data type. Number v can be a literal or an expression that evaluates to a number. trunc(42.4382, 2) 42.43
width_bucket(operand numeric, b1 numeric, ...) Divides a data set into buckets of equal width and returns the bucket number into which an operand falls. width_bucket(5.35, 0.024, 10.06, 5) 3
random() Returns a pseudo-random number in the range [0.0, 1.0). random() 0.476738295983523