The Math Object

     

The Math Object

Table A.11. Math Methods and Attributes

Name

Method/Attribute

Format

Description

abs

M

Math.abs(x)

Computes the absolute value of x.

acos

M

Math.acos(x)

Computes the arccosine of x.

asin

M

Math.asin(x)

Computes the arcsine of x.

atan

M

Math.atan(x)

Computes the arctangent of x.

atan2

M

Math.atan2(y, x)

Computes the arctangent of the ratio y/x, that is, the angle from the positive x-axis to the point (x, y).

ceil

M

Math.ceil(x)

Rounds x up to the nearest integer.

cos

M

Math.cos(x)

Computes the cosine of x.

exp

M

Math.exp(x)

Computes Math.E to the power x.

floor

M

Math.floor(x)

Rounds x down to the nearest integer.

log

M

Math.log(x)

Computes the natural logarithm of x.

max

M

Math.max(x, y)

Returns the larger of integers x and y.

min

M

Math.min(x, y)

Returns the smaller of integers x and y.

pow

M

Math.pow(x, y)

Computes x raised to the power y.

random

M

Math.random()

Returns a pseudo-random number between 0 and 1.

round

M

Math.round(x)

Rounds x to the nearest integer.

sin

M

Math.sin(x)

Computes the sine of x.

sqrt

M

Math. sqrt(x)

Computes the square root of x.

tan

M

Math.tan(x)

Computes the tangent of x.

E

A

Math.E

Euler's constant and the base of natural logarithms (approximately 2.718), traditionally notated as e .

LN2

A

Math.LN2

The natural logarithm of 2 (approximately 0.693).

LOG2E

A

Math.LOG2E

The base 2 logarithm of Math.E (approximately 1.442).

LN10

A

Math.LN10

The natural logarithm of 10 (approximately 2.302).

LOG10E

A

Math.LOG10E

The base 10 logarithm of Math.E (approximately 0.434).

PI

A

Math.PI

The ratio of the circumference of a circle to its diameter (approximately 3.14159).

SQRT1_2

A

Math.SQRT1_2

The reciprocal of the square root of 2, that is, 1/Math.SQRT2 (approximately 0.707).

SQRT2

M

Math.SQRT2

The square root of 2 (approximately 1.414).




Using Macromedia Studio MX 2004
Special Edition Using Macromedia Studio MX 2004
ISBN: 0789730421
EAN: 2147483647
Year: N/A
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net