Previous PageNext Page

7.20 Math Object

The Math object is a built-in object that provides basic mathematics functionality and constants.
 

Methods

abs
 
Determines the absolute value of its numeric argument.
 
acos
 
Computes the arccosine of its numeric argument.
 
asin
 
Computes the arcsine of its numeric argument.
 
atan
 
Computes the arctangent of its numeric argument.
 
atan2
 
Returns the angle (in radians) from the X axis to a point.
 
ceil
 
Determines the smallest integer greater than or equal to its numeric argument.
 
cos
 
Computes the cosine of its numeric argument.
 
exp
 
Computes e to the power of the numeric argument.
 
floor
 
Determines the greatest integer that is less than or equal to its numeric argument.
 
log
 
Computes the natural logarithm of its numeric argument.
 
max
 
Returns the greater of two numeric expressions.
 
min
 
Returns the lesser of two numeric expressions.
 
pow
 
Returns the value of a base expression taken to a specified power.
 
random
 
Returns a pseudo-random number.
 
round
 
Rounds the supplied numeric expression to the nearest integer.
 
sin
 
Returns the sin of its numeric argument.
 
sqrt
 
Returns the square root of a number.
 
tan
 
Returns the tangent of its numeric argument.
 

Properties

E
 
Euler's constant
 
LN2
 
The natural logarithm of 2
 
LN10
 
The natural logarithm of 10
 
LOG2E
 
The base 2 logarithm of e.
 
LOG10E
 
The base 10 logarithm of e.
 
PI
 
The ratio of the circumference of a circle to its diameter.
 
SQRT1_2
 
The square root of 0.5, or one divided by the square root of two.
 
SQRT2
 
The square root of 2.
 

Syntax

Math[.{property | method}]

Arguments

property
Name of Math object property.
method
Name of Math object method.

Remarks

The Math object cannot be created using the new operator, and gives an error if you attempt to do so. It is created by the scripting engine when the engine is loaded. All of its methods and properties are available to your script at all times.
 

Copyright © 2000 Chili!Soft

Previous PageTop Of PageNext Page