Skip to main content
Version: 3.27.2

Math.tan()

The Math.tan() function returns the tangent of a number in radians.

Syntax

Math.tan(x)

Parameters

  • x
    • : A number representing an angle in radians.

Return value

The tangent of x. If x is Infinity, -Infinity, or NaN, returns NaN.

Note: Due to floating point precision, it's not possible to obtain the exact value π/2, so the result is always finite if not NaN.

Description

Because tan() is a static method of Math, you always use it as Math.tan(), rather than as a method of a Math object you created (Math is not a constructor).