PostgreSQL Math Functions

This page lists the mathematical functions in PostgreSQL.

  1. abs

    The PostgreSQL abs() function returns the absolute value of the specified number.
  2. acos

    The PostgreSQL acos() function returns the arc cosine of a specified number in radians.
  3. acosd

    The PostgreSQL acosd() function returns the arc cosine of the specified number in degrees.
  4. acosh

    The PostgreSQL acosh() function returns the inverse hyperbolic cosine of the specified number.
  5. asin

    The PostgreSQL asin() unction returns the arc sine of the specified number in radians.
  6. asind

    The PostgreSQL asind() function returns the arc sine of the specified number in degrees.
  7. asinh

    The PostgreSQL asinh() function returns the inverse hyperbolic sine of the specified value.
  8. atan

    The PostgreSQL atan() function returns the arctangent of a specified number in radians.
  9. atan2

    The PostgreSQL atan2() function returns the arc tangent of the result of dividing the specified two numbers, in radians.
  10. atan2d

    The PostgreSQL atan2d() function returns the arc tangent of the result of the division of two specified numbers, in degrees.
  11. atand

    The PostgreSQL atand() function returns the arctangent of a specified number in degrees.
  12. atanh

    The PostgreSQL atanh() function returns the inverse hyperbolic tangent of the specified number.
  13. cbrt

    The PostgreSQL cbrt() function returns the cube root of the specified number.
  14. ceil

    The PostgreSQL ceil() function returns the smallest integer value that is greater than or equal to the number specified by the argument.
  15. ceiling

    The PostgreSQL ceiling() function returns the smallest integer value that is greater than or equal to the number specified by the argument.
  16. cos

    The PostgreSQL cos() function returns the cosine of the specified radian.
  17. cosd

    The PostgreSQL cosd() function returns the cosine of the specified number in degrees.
  18. cosh

    The PostgreSQL cosh() function returns the hyperbolic cosine of the specified number.
  19. cot

    The PostgreSQL cot() function returns the cotangent of the specified radian.
  20. cotd

    The PostgreSQL cotd() function returns the cotangent of the specified number in degrees.
  21. degrees

    The PostgreSQL degrees() function converts the specified radian value to a degree value and returns the result.
  22. div

    The PostgreSQL div() function divides the specified two numbers and returns the integer quotient.
  23. exp

    The PostgreSQL exp() function returns the natural constant e raised to the specified power.
  24. factorial

    The PostgreSQL factorial() function returns the factorial of a number.
  25. floor

    The PostgreSQL floor() function returns the largest integer value less than or equal to the number specified by the argument.
  26. gcd

    The PostgreSQL gcd() unction returns the greatest common divisor of two specified numbers.
  27. lcm

    The PostgreSQL lcm() function returns the least common multiple of two specified numbers.
  28. ln

    The PostgreSQL ln() function returns the natural logarithm of the number specified by the argument.
  29. log

    The PostgreSQL log() function returns the logarithm of the specified base of the number specified by the argument.
  30. log10

    The PostgreSQL log10() function returns the base 10 logarithm of the number specified by the argument.
  31. min_scale

    The PostgreSQL min_scale() function returns the minimum precision (number of decimal places) required to represent a given number accurately.
  32. mod

    The PostgreSQL mod() function returns the remainder after dividing the specified two numbers.
  33. pi

    The PostgreSQL pi() function returns an approximation of pi to 15 decimal places.
  34. power

    The PostgreSQL power() function returns a specified number raised to the specified power. For example, power(x, y)return the y-th power of x.
  35. radians

    The PostgreSQL radians() function converts the specified value in degrees to radians and returns the result.
  36. random

    The PostgreSQL random() function returns a random number between 0 (inclusive) and 1 (exclusive).
  37. round

    The PostgreSQL round() function rounds the specified number to the specified precision and returns the result.
  38. scale

    The PostgreSQL scale() function returns the number of decimal digits in the fractional part for a given number.
  39. setseed

    The PostgreSQL setseed() function set the seed for subsequent random() calls so that the random() function produces a repeatable random sequence.
  40. sign

    The PostgreSQL sign() function returns the sign (-1 or 0 or +1) of a given number.
  41. sin

    The PostgreSQL sin() function returns the sine of the specified radian.
  42. sind

    The PostgreSQL sind() function returns the sine of the specified number of degrees.
  43. sinh

    The PostgreSQL sinh() function returns the hyperbolic sine of the specified number.
  44. sqrt

    The PostgreSQL sqrt() function returns the square root of a given number.
  45. tan

    The PostgreSQL tan() function returns the tangent of the specified radian.
  46. tand

    The PostgreSQL tand() function returns the tangent of the specified number of degrees.
  47. tanh

    The PostgreSQL tanh() function returns the hyperbolic tangent of the specified number.
  48. trim_scale

    The PostgreSQL trim_scale() function removes trailing zeroes from the fractional part of a given number and returns the result.
  49. trunc

    The PostgreSQL trunc() function truncates the specified number to the specified precision and returns the result.
  50. width_bucket

    The PostgreSQL width_bucket() function returns the position of a specified operand in some specified buckets.