EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Cos (Math.cos Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Math 749
Returns
Number - An integer that is both closest to, and greater than or equal to, parameter x.
Example
The following code returns a value of 13:
Math.ceil(12.5);
See also
floor (Math.floor method), round (Math.round method)
cos (Math.cos method)
public static cos(x:Number) : Number
Computes and returns the cosine of the specified angle in radians. To calculate a radian, see
the description of the Math class entry.
Availability: ActionScript 1.0; 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.
Parameters
x:Number - A number that represents an angle measured in radians.
Returns
Number - A number from -1.0 to 1.0.
Example
The following example displays the cosine for several different angles.
trace (Math.cos(0)); // 0 degree angle. Output: 1
trace (Math.cos(Math.PI/2)); // 90 degree angle. Output: 6.12303176911189e-
17
trace (Math.cos(Math.PI)); // 180 degree angle. Output: -1
trace (Math.cos(Math.PI*2)); // 360 degree angle. Output: 1
Note: The cosine of a 90 degree angle is zero, but because of the inherent inaccuracy of
decimal calculations using binary numbers, Flash Player will report a number extremely close
to, but not exactly equal to, zero.

Table of Contents

Related product manuals