Math
QuickLinks
Properties
Property | Type | Access | Description |
---|---|---|---|
E | number | readonly | Euler's constant and the base of natural logarithms. (default: 2.7182818284590452354) |
LN10 | number | readonly | The natural logarithm of 10. (default: 2.302585092994046) |
LN2 | number | readonly | The natural logarithm of 2. (default: 0.6931471805599453) |
LOG10E | number | readonly | The base 10 logarithm of e. (default: 0.4342944819032518) |
LOG2E | number | readonly | The base 2 logarithm of e. (default: 1.4426950408886934) |
PI | number | readonly | The ratio of the circumference of a circle to its diameter. (default: 3.14159265358979323846) |
SQRT1_2 | number | readonly | The reciprocal of the square root of 1/2. (default: 0.7071067811865476) |
SQRT2 | number | readonly | The square root of 2. (default: 1.4142135623730951) |
Methods
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 (x:number, y:number)
Returns the maximum of two numbers.
Parameter | Type | Description |
---|---|---|
x | number | |
y | number |
number min (x:number, y:number)
Returns the minimum of two numbers.
Parameter | Type | Description |
---|---|---|
x | number | Numbers. |
y | number |
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. |