Name

Math.tan( ) Method — compute the tangent of an angle

Availability

Flash 5; may be used when exporting Flash 4 movies

Synopsis

Math.tan(theta)

Arguments

theta

An angle, in radians (not degrees), in the range -π/2 to π/2.

Returns

The tangent of theta (the result is in the range -Infinity to Infinity).

Description

The tan( ) method returns the trigonometric tangent of an angle. In a right triangle, the tangent of an angle is the result of dividing the length of the side opposite the angle by the length of the side adjacent to the angle. This is also the same as the ratio Math.sin(theta)/Math.cos(theta), so as cos(theta) approaches zero, tan(theta) approaches Infinity. Therefore, tan(theta) is not calculable for the values -π/2, π/2, -3π/2, 3π/2, etc.

Example

trace (Math.tan(0));            // Displays: 0
trace (Math.tan(Math.PI/4));    // Displays: 1

See Also

Math.atan( ), Math.cos( ), Math.sin( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.