PostgreSQL Mathematical and Trigonometric functions
Mathematical and Trigonometric functions
A mathematical function operates on input values ( numeric ) which are provided as arguments and returns a numeric value as the output of that operation. Mathematical functions operate on numeric data.
List of Mathematical Functions
| Functions | Example | Output |
|---|---|---|
| abs ( ) | abs(-115.36) | 115.36 |
| cbrt( ) | cbrt ( 343) | 7 |
| ceil( ) | ceil(-53.7 ) | -53 |
| ceiling( ) | ceiling(-69.8 ) | -69 |
| degrees( ) | degrees( .45) | 25.783100780887 |
| div( ) | div( 19 , 3) | 6 |
| exp( ) | exp( 2.0 ) | 7.3890560989306502 |
| floor( ) | floor(-53.6 ) | -54 |
| ln( ) | ln( 3.0) | 1.0986122886681097 |
| log( ) | log(200.0 ) | 2.3010299956639812 |
| mod( ) | mod( 38,5) | 3 |
| pi( ) | pi( ) | 3.14159265358979 |
| power( ) | power(7,3 ) | 343 |
| radians( ) | radians(15.0 ) | 0.261799387799149 |
| random( ) | random( ) | |
| round( ) | round( 67.456) | 67 |
| sign( ) | sign(-14.321 ) | -1 |
| sqrt( ) | sqrt(225 ) | 15 |
| trunc( ) | trunc(67.456 ) | 67 |
List of Trigonometric Functions
| Functions | Syntax | Description |
|---|---|---|
| acos ( ) | acos(a) | Returns inverse cosine or arc cosine. |
| asin( ) | asin(a) | Returns inverse sine or arc sine. |
| atan( ) | atan(a) | Returns inverse tangent or arc tangent. |
| atan2( ) | atan2(b,a) | Returns inverse tangent of b/a. |
| cos( ) | cos(a) | Returns cosine. |
| cot( ) | cot(a) | Returns cotangent. |
| sin( ) | sin(a) | Returns sine. |
| tan( ) | tan(a) | Returns tangent. |
Previous: TRANSACTION_TIMESTAMP function
Next: ABS function
