User Guide

Math.cos() 427
Math.cos()
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the Math class are emulated using
approximations and might not be as accurate as the non-emulated math functions that Flash
Player 5 supports.
Usage
Math.cos(x:Number) : Number
Parameters
x
A number that represents an angle measured in radians.
Returns
A number from -1.0 to 1.0.
Description
Method; computes and returns the cosine of the specified angle in radians. To calculate a radian,
see “Description” on page 419 of the Math class entry.
Example
The following example displays the cosine for several different angles.
trace(Math.cos(0)); // output: 1
trace(Math.cos(90)); // output: -0.44807361612917
trace(Math.cos(180)); // output: -0.598460069057858
trace(Math.cos(360)); // output: -0.283691091486527
See also
Math.acos(), Math.asin(), Math.atan(), Math.atan2(), Math.sin(), Math.tan()