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

PostgreSQL TANH() Function



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

tanh

where e is an Euler's number.

Syntax

TANH(x)

Parameters

x Required. Specify the value.

Return Value

Returns the hyperbolic tangent of a value.

Example 1:

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

SELECT TANH(0);
Result: 0

SELECT TANH(1);
Result: 0.7615941559557649

SELECT TANH(-1);
Result: -0.7615941559557649

SELECT TANH(2);
Result: 0.9640275800758169

SELECT TANH(-2);
Result: -0.9640275800758169

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 tangent of values of column x.

SELECT *, TANH(x) AS TANH_Value FROM Sample;

This will produce the result as shown below:

DataxTANH_Value
Data 100
Data 20.50.46211715726000974
Data 310.7615941559557649
Data 41.50.9051482536448664
Data 520.9640275800758169

❮ PostgreSQL Functions