Math.tan(angle) Last updated: 24. Jan 2023

Returns the tangent of a number in radians

Parameters

Name Type Description
angle number A number representing an angle in radians.

Returns

A number, representing the tangent of a number in radians.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
function getTanFromDegrees(degrees) {
  return Math.tan(degrees * Math.PI / 180);
}

write(getTanFromDegrees(0));
write("\n");
/* Expected output: 0 */


write(getTanFromDegrees(45));
write("\n");
/* Expected output: 0.9999999999999999 */

write(getTanFromDegrees(90));
/* Expected output: 16331239353195370 */

Output

The JS code above produces the output shown below:
0
0.9999999999999999
3530114321217157.5