Math

A global object containing a set of math functions and constants.

Methods:

abs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, max, min, pow, random, round, sin, sqrt, tan

Property Listing

Name

Type

Access

Description

E

Number

readonly

Euler's constant and the base of natural logarithms.

LN10

Number

readonly

The natural logarithm of 10.

LN2

Number

readonly

The natural logarithm of 2.

LOG10E

Number

readonly

The base 10 logarithm of e.

LOG2E

Number

readonly

The base 2 logarithm of e.

PI

Number

readonly

The ratio of the circumference of a circle to its diameter.

SQRT1_2

Number

readonly

The reciprocal of the square root of 1/2.

SQRT2

Number

readonly

The square root of 2.

Method Listing

Number abs (x:Number)

Returns the absolute value of a number.

Parameter

Type

Description

x

Number

A number.

Number acos (x:Number)

Returns the arc cosine(in radians) of a number.

Parameter

Type

Description

x

Number

A number.

Number asin (x:Number)

Returns the arc sin(in radians) of a number.

Parameter

Type

Description

x

Number

A number.

Number atan (x:Number)

Returns the arc tangent(in radians) of a number.

Parameter

Type

Description

x

Number

A number.

Number atan2 (y:Number, x:Number)

Returns the arc tangent of the quotient of its arguments (y/x).

Parameter

Type

Description

y

Number

A number.

x

Number

A number.

Number ceil (x:Number)

Rounds the number up to the nearest integer.

Parameter

Type

Description

x

Number

A number.

Number cos (x:Number)

Returns the cosine of an angle provided in radians.

Parameter

Type

Description

x

Number

An angle, in radians.

Number exp (x:Number)

Returns Math.E raised to the power of a number.

Parameter

Type

Description

x

Number

A number.

Number floor (x:Number)

Rounds a number down to the nearest integer.

Parameter

Type

Description

x

Number

A number.

Number log (x:Number)

Returns the natural logarithm of a number.

Parameter

Type

Description

x

Number

A number.

Number max (value1, value2, ...:Number)

Returns the largest of zero or more numbers.

Parameter

Type

Description

value1, value2, ...

Number

Numbers.

Number min (value1, value2, ...:Number)

Returns the smallest of zero or more numbers.

Parameter

Type

Description

value1, value2, ...

Number

Numbers.

Number pow (x:Number, y:Number)

Returns x raised to the power of y.

Parameter

Type

Description

x

Number

Numbers.

y

Number

 

Number random ()

Returns a pseudo-random number from 0.0 up to but not including 1.0.

Number round (x:Number)

Rounds a number to the nearest integer.

Parameter

Type

Description

x

Number

A number.

Number sin (x:Number)

Returns the sine of an angle provided in radians.

Parameter

Type

Description

x

Number

An angle, in radians.

Number sqrt (x:Number)

Returns the square root of a number.

Parameter

Type

Description

x

Number

A number.

Number tan (x:Number)

Returns the tangent of an angle provided in radians.

Parameter

Type

Description

x

Number

An angle, in radians.