PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL COSH() Function



The PostgreSQL COSH() function returns hyperbolic cosine of a value. The hyperbolic cosine of x is defined as:

cosh

where e is an Euler's number.

Syntax

COSH(x)

Parameters

x Required. Specify the value.

Return Value

Returns the hyperbolic cosine of a value.

Example 1:

The example below shows the usage of COSH() function.

SELECT COSH(0);
Result: 1

SELECT COSH(1);
Result: 1.5430806348152437

SELECT COSH(-1);
Result: 1.5430806348152437

SELECT COSH(2);
Result: 3.7621956910836314

SELECT COSH(-2);
Result: 3.7621956910836314

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 10
Data 20.5
Data 31
Data 41.5
Data 52

The statement given below can be used to calculate the hyperbolic cosine of values of column x.

SELECT *, COSH(x) AS COSH_Value FROM Sample;

This will produce the result as shown below:

DataxCOSH_Value
Data 101
Data 20.51.1276259652063807
Data 311.5430806348152437
Data 41.52.352409615243247
Data 523.7621956910836314

❮ PostgreSQL Functions