PostgreSQL Math Functions
This page lists the mathematical functions in PostgreSQL.
-
abs
The PostgreSQLabs()function returns the absolute value of the specified number. -
acos
The PostgreSQLacos()function returns the arc cosine of a specified number in radians. -
acosd
The PostgreSQLacosd()function returns the arc cosine of the specified number in degrees. -
acosh
The PostgreSQLacosh()function returns the inverse hyperbolic cosine of the specified number. -
asin
The PostgreSQLasin()unction returns the arc sine of the specified number in radians. -
asind
The PostgreSQLasind()function returns the arc sine of the specified number in degrees. -
asinh
The PostgreSQLasinh()function returns the inverse hyperbolic sine of the specified value. -
atan
The PostgreSQLatan()function returns the arctangent of a specified number in radians. -
atan2
The PostgreSQLatan2()function returns the arc tangent of the result of dividing the specified two numbers, in radians. -
atan2d
The PostgreSQLatan2d()function returns the arc tangent of the result of the division of two specified numbers, in degrees. -
atand
The PostgreSQLatand()function returns the arctangent of a specified number in degrees. -
atanh
The PostgreSQLatanh()function returns the inverse hyperbolic tangent of the specified number. -
cbrt
The PostgreSQLcbrt()function returns the cube root of the specified number. -
ceil
The PostgreSQLceil()function returns the smallest integer value that is greater than or equal to the number specified by the argument. -
ceiling
The PostgreSQLceiling()function returns the smallest integer value that is greater than or equal to the number specified by the argument. -
cos
The PostgreSQLcos()function returns the cosine of the specified radian. -
cosd
The PostgreSQLcosd()function returns the cosine of the specified number in degrees. -
cosh
The PostgreSQLcosh()function returns the hyperbolic cosine of the specified number. -
cot
The PostgreSQLcot()function returns the cotangent of the specified radian. -
cotd
The PostgreSQLcotd()function returns the cotangent of the specified number in degrees. -
degrees
The PostgreSQLdegrees()function converts the specified radian value to a degree value and returns the result. -
div
The PostgreSQLdiv()function divides the specified two numbers and returns the integer quotient. -
exp
The PostgreSQLexp()function returns the natural constant e raised to the specified power. -
factorial
The PostgreSQLfactorial()function returns the factorial of a number. -
floor
The PostgreSQLfloor()function returns the largest integer value less than or equal to the number specified by the argument. -
gcd
The PostgreSQLgcd()unction returns the greatest common divisor of two specified numbers. -
lcm
The PostgreSQLlcm()function returns the least common multiple of two specified numbers. -
ln
The PostgreSQLln()function returns the natural logarithm of the number specified by the argument. -
log
The PostgreSQLlog()function returns the logarithm of the specified base of the number specified by the argument. -
log10
The PostgreSQLlog10()function returns the base 10 logarithm of the number specified by the argument. -
min_scale
The PostgreSQLmin_scale()function returns the minimum precision (number of decimal places) required to represent a given number accurately. -
mod
The PostgreSQLmod()function returns the remainder after dividing the specified two numbers. -
pi
The PostgreSQLpi()function returns an approximation of pi to 15 decimal places. -
power
The PostgreSQLpower()function returns a specified number raised to the specified power. For example,power(x, y)return the y-th power of x. -
radians
The PostgreSQLradians()function converts the specified value in degrees to radians and returns the result. -
random
The PostgreSQLrandom()function returns a random number between 0 (inclusive) and 1 (exclusive). -
round
The PostgreSQLround()function rounds the specified number to the specified precision and returns the result. -
scale
The PostgreSQLscale()function returns the number of decimal digits in the fractional part for a given number. -
setseed
The PostgreSQLsetseed()function set the seed for subsequentrandom()calls so that therandom()function produces a repeatable random sequence. -
sign
The PostgreSQLsign()function returns the sign (-1or0or+1) of a given number. -
sin
The PostgreSQLsin()function returns the sine of the specified radian. -
sind
The PostgreSQLsind()function returns the sine of the specified number of degrees. -
sinh
The PostgreSQLsinh()function returns the hyperbolic sine of the specified number. -
sqrt
The PostgreSQLsqrt()function returns the square root of a given number. -
tan
The PostgreSQLtan()function returns the tangent of the specified radian. -
tand
The PostgreSQLtand()function returns the tangent of the specified number of degrees. -
tanh
The PostgreSQLtanh()function returns the hyperbolic tangent of the specified number. -
trim_scale
The PostgreSQLtrim_scale()function removes trailing zeroes from the fractional part of a given number and returns the result. -
trunc
The PostgreSQLtrunc()function truncates the specified number to the specified precision and returns the result. -
width_bucket
The PostgreSQLwidth_bucket()function returns the position of a specified operand in some specified buckets.