Object | +-Math public class Math extends Object
The Math class is a top-level class whose methods and properties you can use without using a constructor.
Use the methods and properties of this class to access and manipulate mathematical constants and functions. All the properties and methods of the Math class are static and must be called using the syntax Math.method(parameter) or Math.constant. In ActionScript, constants are defined with the maximum precision of double-precision IEEE-754 floating-point numbers.
Several Math class methods use the measure of an angle in radians as a parameter.You can use the following equation to calculate radian values before calling the method and then provide the calculated value as the parameter, or you can provide the entire right side of the equation (with the angle's measure in degrees in place of degrees) as the radian parameter.
To calculate a radian value, use the following formula:
radians = degrees * Math.PI/180
The following is an example of passing the equation as a parameter to calculate the sine of a 45˚ angle:
Math.sin(45 * Math.PI/180) is the same as Math.sin(.7854)
|
Modifiers |
Property |
Description |
|---|---|---|
|
static |
A mathematical constant for the base of natural logarithms, expressed as e. |
|
|
static |
A mathematical constant for the natural logarithm of 10, expressed as loge10, with an approximate value of 2.302585092994046. |
|
|
static |
A mathematical constant for the natural logarithm of 2, expressed as loge2, with an approximate value of 0.6931471805599453. |
|
|
static |
A mathematical constant for the base-10 logarithm of the constant e (Math.E), expressed as log10e, with an approximate value of 0.4342944819032518. |
|
|
static |
A mathematical constant for the base-2 logarithm of the constant e (Math.E), expressed as log2e, with an approximate value of 1.442695040888963387. |
|
|
static |
A mathematical constant for the ratio of the circumference of a circle to its diameter, expressed as pi, with a value of 3.141592653589793. |
|
|
static |
A mathematical constant for the square root of one-half, with an approximate value of 0.7071067811865476. |
|
|
static |
A mathematical constant for the square root of 2, with an approximate value of 1.4142135623730951. |
Properties inherited from class Object
|
constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property) |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
static |
Computes and returns an absolute value for the number specified by the parameter x. |
|
|
static |
Computes and returns the arc cosine of the number specified in the parameter x, in radians. |
|
|
static |
Computes and returns the arc sine for the number specified in the parameter x, in radians. |
|
|
static |
Computes and returns the value, in radians, of the angle whose tangent is specified in the parameter tangent. |
|
|
static |
Computes and returns the angle of the point y/x in radians, when measured counterclockwise from a circle's x axis (where 0,0 represents the center of the circle). |
|
|
static |
Returns the ceiling of the specified number or expression. |
|
|
static |
Computes and returns the cosine of the specified angle in radians. |
|
|
static |
Returns the value of the base of the natural logarithm (e), to the power of the exponent specified in the parameter x. |
|
|
static |
Returns the floor of the number or expression specified in the parameter x. |
|
|
static |
Returns the natural logarithm of parameter x. |
|
|
static |
Evaluates x and y and returns the larger value. |
|
|
static |
Evaluates x and y and returns the smaller value. |
|
|
static |
Computes and returns x to the power of y. |
|
|
static |
Returns a pseudo-random number n, where 0 <= n < 1. |
|
|
static |
Rounds the value of the parameter x up or down to the nearest integer and returns the value. |
|
|
static |
Computes and returns the sine of the specified angle in radians. |
|
|
static |
Computes and returns the square root of the specified number. |
|
|
static |
Computes and returns the tangent of the specified angle. |
Methods inherited from class Object