PostgreSQL tan() Function
The PostgreSQL tan()
function returns the tangent of the specified radian.
tan()
Syntax
This is the syntax of the PostgreSQL tan()
function:
tan(number)
Parameters
number
-
Required. The number used to calculate the tangent, in radians.
Return value
The PostgreSQL tan()
function returns the tangent of the specified radian.
If the parameter number
is NULL
, the tan()
function will return NULL
.
tan()
Examples
Here are a few examples of the tan()
function:
SELECT
tan(2.5) AS "tan(2.5)",
tan(0.2) AS "tan(0.2)",
tan(-0.5) AS "tan(-0.5)",
tan(-0.2) AS "tan(-0.2)",
tan(0) AS "tan(0)",
tan(pi()) AS "tan(pi())";
-[ RECORD 1 ]----------------------
tan(2.5) | -0.7470222972386602
tan(0.2) | 0.2027100355086725
tan(-0.5) | -0.5463024898437905
tan(-0.2) | -0.2027100355086725
tan(0) | 0
tan(pi()) | -1.2246467991473532e-16
Here, we used the pi()
function to obtain an approximation of pi.