Name

Math Object — access to mathematical functions and constants

Availability

Flash 5

Synopsis

Math.propertyName
Math.methodName( )

Properties

E

The constant e, the base of natural logarithms, approximately 2.71828.

LN10

The natural logarithm of 10 (loge10), approximately 2.30259.

LN2

The natural logarithm of 2 (loge2), approximately 0.69315.

LOG10E

The base-10 logarithm of e, approximately 0.43429.

LOG2E

The base-2 logarithm of e, approximately 1.44270. See bug noted in detailed listing.

PI

The ratio of a circle’s circumference to its diameter, approximately 3.14159.

SQRT1_2

The reciprocal of the square root of 2, approximately 0.70711.

SQRT2

Square root of 2, approximately 1.41421.

Methods

abs( )

Compute the absolute value of a number.

acos( )

Compute the arc cosine of a number.

asin( )

Compute the arc sine of a number.

atan( )

Compute the arc tangent of a number.

atan2( )

Compute the angle of a point, relative to the x-axis.

ceil( )

Round a number up to the next integer.

cos( )

Compute the cosine of an angle.

exp( )

Raise e to a specified power.

floor( )

Return the closest integer less than or equal to the input.

log( )

Compute the natural logarithm of a number.

max( )

Determine the larger of two numbers.

min( )

Determine the smaller of two numbers.

pow( )

Raise a number to a specified power.

random( )

Retrieve a random floating-point number between 0 and 1.

round( )

Calculate the closest integer to a number.

sin( )

Compute the sine of an angle.

sqrt( )

Compute the square root of a number.

tan( )

Compute the tangent ...

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.