# Built-in math functions¶

Nebula Graph supports the following built-in math functions:

Function Description
double abs(double x) Returns absolute value of the argument.
double floor(double x) Returns the largest integer value smaller than or equal to the argument. (Rounds down)
double ceil(double x) Returns the smallest integer greater than or equal to the argument. (Rounds up)
double round(double x) Returns the integer value nearest to the argument. Returns a number farther away from 0 if the argument is in the middle.
double sqrt(double x) Returns the square root of the argument.
double cbrt(double x) Returns the cubic root of the argument.
double hypot(double x, double y) Returns the hypotenuse of a right-angled triangle.
double pow(double x, double y) Returns the result of x raised by the yth power.
double exp(double x) Returns the value of e raised to the x power.
double exp2(double x) Returns 2 raised to the argument.
double log(double x) Returns natural logarithm of the argument.
double log2(double x) Returns the base-2 logarithm of the argument.
double log10(double x) Returns the base-10 logarithm of the argument.
double sin(double x) Returns sine of the argument.
double asin(double x) Returns inverse sine of the argument.
double cos(double x) Returns cosine of the argument.
double acos(double x) Returns inverse cosine of the argument.
double tan(double x) Returns tangent of the argument.
double atan(double x) Returns inverse tangent the argument.
double rand() Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e.[0,1).
int rand32(int min, int max) Returns a random 32-bit integer in [min, max). If you set only one argument, it is parsed as max and min is default to 0. If you set no argument, the system returns a random signed 32-bit integer.
int rand64(int min, int max) Returns a random 64-bit integer in [min, max). If you set only one argument, it is parsed as max and min is default to 0. If you set no argument, the system returns a random signed 64-bit integer.
collect() Puts all the collected values to a list.
avg() Returns the average value of the argument.
count() Returns the number of records.
max() Returns the maximum value.
min() Returns the minimum value.
std() Returns the population standard deviation.
sum() Returns the sum value.
bit_and() Bitwise AND.
bit_or() Bitwise OR.
bit_xor() Bitwise exclusive OR (XOR).
int size() Returns the number of elements in a list or a map.
int range(int start, int end, int step) Returns a list of integers from start (inclusive) to end (inclusive) in the specified steps. step is optional and default to 1.
int sign(double x) Returns the signum of the given number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number.
double e() Returns the base of the natural logarithm, e (2.718281828459045).
double pi() Returns the mathematical constant pi (3.141592653589793).
double radians() Converts degrees to radians. radians(180) returns 3.141592653589793.

Note

If the argument is set to NULL, the output is undefined.

Last update: April 22, 2021