Math.<...>

Return to Introduction  Previous page  Next page

A collection of useful mathematical functions.

 

Methods

 

abs(value)

Calculates the absolute value or magnitude of a number.

acos(value)

Returns the arc cosine of the value provided in radians.

asin(value)

Returns the arc sine of the value provided in radians.

atan(value)

Returns the arc tangent of the value provided in radians.

atan2(x,y)

Returns the arc tangent of y/x, using the signs of the arguments to compute the quadrant of the return value.

ceil(value)

Returns the smallest integer no less than the value.

cos(value)

Returns the cosine of the value, where the value is an angle expressed in radians.

exp(value)

Returns e (2.7182818) raised to the 'value'th power.

floor(value)

Returns the largest integer no greater than the value.

log(value)

Returns the natural logarithm of the value.

max(value1,value2,value3...)

Returns the maximum value of any number of arguments.

min(value1,value2,value3...)

Returns the minimum value of any number of arguments.

pow(x,y)

Returns x raised to the y power.

random([seed])

Returns a random floating point number between 0 and 1.

round(value)

Returns the value rounded to the nearest integer.

sin(valuue)

Returns the sine of the value, where the value is an angle expressed in radians.

sqrt(value)

Returns the square root of the value.

tan(value)

Returns the tangent of the value, where the value is an angle expressed in radians.

       

Examples

 

var mynumber=-10;

var mag=Math.abs(mynumber);

print("Magnitude of "+mynumber+" is "+mag);

 

...which prints... "Magnitude of -10 is 10"

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home