Numerical Functions

PostgreSQL includes many functions that assist in performing numerical calculations. The following sections discuss the included numerical functions in PostgreSQL.

ABS

Description

The ABS function returns the absolute value of a supplied number.

Input
ABS(num) 
Examples
ABS(-7) → 7 
ABS(-7.234) → 7.234 
Notes

The ABS function’s return value is the same data type that it is passed.

ACOS

Description

The ACOS function returns an inverse cosine.

Input
ACOS(num) 

ASIN

Description

The ASIN function returns an inverse sine.

Input
ASIN(num) 

ATAN

Description

The ATAN function returns an inverse tangent.

Input
ATAN(num) 

ATAN2

Description

The ATAN2 function returns an inverse tangent of y/x.

Input
ATAN2(x,y

Get PostgreSQL Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.