TAN() calculates a tangent using radians. Convert degree inputs with RADIANS() before calling it.
Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.
SELECT ROUND(TAN(RADIANS(45)), 2) AS tangent_value;| tangent_value |
|---|
| 1.00 |
TAN(X) returns the tangent of X, where X is in radians. Near angles where cosine approaches zero, floating-point results can become extremely large rather than representing mathematical infinity exactly.
SELECT ROUND(TAN(PI()), 2); -- Output: -0.00 (floating-point approximation)
SELECT TAN(PI() / 2); -- Very large finite floating-point value
SELECT ROUND(TAN(PI() / 3), 2); -- Output: 1.73
SELECT TAN(X);
RADIANS() converts degrees to radians.
SELECT TAN(RADIANS(0)); -- Output: 0
SELECT TAN(RADIANS(45)); -- Output: 1
SELECT TAN(RADIANS(90)); -- Very large finite floating-point value
SELECT ROUND(TAN(RADIANS(180)), 2); -- Output: -0.00
Near 90 degrees and similar angles, floating-point results can be extremely large because the tangent has a discontinuity.
Is TAN(RADIANS(90)) a reliable finite value?
No. The mathematical tangent is undefined at 90 degrees; floating-point calculations may return a very large finite approximation.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.