TAN function
Returns the tangent of a numeric expression, where the argument is an angle expressed in radians.
Syntax
TAN(expression)
Arguments
expression: A numeric expression representing an angle in radians.
Returns
A DOUBLE representing the tangent of the input angle.
Special Values
TAN(inf)returnsNaNTAN(-inf)returnsNaNTAN(NaN)returnsNaN
Examples
-- Example 1: Common angles (rounded for readability)
> SELECT ROUND(TAN(0), 2); -- 0 degrees
0
> SELECT ROUND(TAN(0.523599), 2); -- 30 degrees
0.58
> SELECT ROUND(TAN(1.0472), 2); -- 60 degrees
1.73
> SELECT ROUND(TAN(3.14159), 2); -- 180 degrees
0
-- Example 2: Special floating-point values return NaN
> SELECT TAN(CAST('inf' AS DOUBLE));
NaN
> SELECT TAN(CAST('-inf' AS DOUBLE));
NaN
> SELECT TAN(CAST('NaN' AS DOUBLE));
NaN
See Also
SIN function - Sine function
COS function - Cosine function