# Math Functions and Operators¶

abs(number int|float)

Returns absolute value

Parameters: number – input number same as a parameter type
select abs(-9);
> 9
acos(number float)

Returns the arc cosine of number value

Parameters: number – input number as radian float8
select acos(0.3);
> 1.2661036727794992
asin(number float)

Returns the arc sine of number value

Parameters: number – input number as radian float8
select acos(0.8);
> 0.9272952180016123
atan(number float8)

Returns the arc tangent of number value

Parameters: number – input number as radian float8
select atan(0.8);
> 0.6747409422235527
atan2(y float, x float)

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta)

Parameters: y – the ordinate(y axis) coordinate x – the abscissa(x axis) coordinate float8
select atan2(2.7, 0.3);
> 1.460139105621001
cbrt(number float)

Returns the cube root of a number

Parameters: number – target real number float8
select cbrt(27.0);
> 3.0
ceil(number float)

Returns a smallest integer not less than argument

Parameters: number – target real number int8
select ceil(-42.8);
> -42
cos(number float)

Returns the cosine of a number

Parameters: number – target real number float8
select cos(0.7);
> 0.7648421872844885
degrees(number float)

Converts radians to degrees

Parameters: number – radian value float8
select degrees(0.8);
> 45.83662361046586
div(num1 int, num2 int)

Integer division truncates resut

Parameters: num1 – number to be divided num2 – number to divide int8
select div(8,3);
> 2
exp(number float)

Returns Euler’s number e raised to the power of a number

Parameters: number – input number float8
select exp(1.0);
> 2.718281828459045
floor(number float)

Returns a largest integer not greater than argument

Parameters: number – target real number int8
select floor(53.1);
> 53
mod(num1 int, num2 int)

Returns remainder of num1 / num2

Parameters: num1 – number to be divided num2 – number to divide int8
select mod(10,3);
> 1
pi()

Returns constant value of pi

Return type: float8
select pi();
> 3.141592653589793
pow(x float, y float)

Returns value of x raised to the power of y

Parameters: x – base number y – exponent float8
select pow(2.0, 10.0);
> 1024.0

Converts degrees to radians

Parameters: number – degree value float8
> 0.7853981633974483
round(number int|float)

Rounds to nearest integer

Parameters: number – target number int8
select round(5.1);
> 5
sign(number int|float)

Returns sign of argument as -1, 0, 1

Parameters: number – target number float8
select sign(-8.4);
> -1.0
sin(number float)

Returns the sine of number value

Parameters: number – target number float8
select sin(1.0);
> 0.8414709848078965
sqrt(number float8)

Returns the square root of a number

Parameters: number – target number float8
select sqrt(256.0);
> 16.0
tan(number float)

Returns the tangent of number value

Parameters: number – target number float8
select tan(0.2);
> 0.2027100355086725