Calculates the tangent of an angle (in radians).
tan(radians)
| Parameter | Type | Description |
|---|---|---|
radians |
Number/String | The angle in radians |
String - The tangent of the angle.
The tan function calculates the tangent of an angle, which equals sin(angle)/cos(angle). The input must be in radians. Use the rad() function to convert degrees to radians if needed.
Result = tan(0)
// Result: "0"
Result = tan(0.7853981633974483) // π/4 (45 degrees)
// Result: "1" (approximately)
// Tangent of 45 degrees
Result = tan(rad(45))
// Result: "1"
// Tangent of 30 degrees
Result = tan(rad(30))
// Result: "0.5773502691896257"
// Calculate slope from angle
Slope = tan(rad(AngleDegrees))
// Rise over run
Rise = Run * tan(Angle)
- Trigonometry: Slope and angle calculations
- Surveying: Elevation changes
- Physics: Incline problems
- Graphics: Perspective calculations
- Input must be in radians, not degrees
- Use
rad(degrees)to convert from degrees - Tangent is undefined at 90°, 270°, etc. (π/2, 3π/2, ...)
- Uses JavaScript's
Math.tan()internally