Skip to main content Link Search Menu Expand Document (external link)

tan() : Tangent Function


On this page

Summary

Calculate the tangent of an angle (in radians).

Signature

tan(angleInRadians)

Parameters

Parameter Type Required Description
angleInRadians Number Yes The angle in radians

Returns

Type: Double

The tangent of the angle.


Examples

Basic Tangent

<p>tan(0) = </p>
<p>tan(π/4) = </p>

Output:

<p>tan(0) = 0.000</p>
<p>tan(π/4) = 1.000</p>

Convert Degrees

<p>tan(45°) = </p>

Output:

<p>tan(45°) = 1.000</p>

Calculate Slope

<p>Slope: </p>

Data:

doc.Params["model"] = new {
    angle = Math.PI / 6  // 30 degrees
};

Output:

<p>Slope: 0.58</p>

Notes

  • Input must be in radians (not degrees)
  • Undefined at π/2, 3π/2, etc. (where cosine = 0)
  • For degrees, use: tan(radians(degrees))
  • tan(x) = sin(x) / cos(x)
  • Common values:
    • tan(0) = 0
    • tan(π/4) = 1
    • tan(π/6) ≈ 0.577

See Also