| Math | NN 2 IE J1 ECMA 1 |
The Math object is used only in its static object form as a library of math constant values and (mostly trigonometric) operations. As a result, there is no constructor function. Invoking a Math object property or method adheres to the following syntax: Math.propertyName Math.method(param1[, param2]) Be sure to observe the uppercase "M" in the Math object in script statements. All expressions involving the Math object evaluate to or return a value. | |
| E | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns Euler's constant. | |
Examplevar num = Math.E | |
| Value 2.718281828459045 | |
| LN2 | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the natural logarithm of 2. | |
Examplevar num = Math.LN2 | |
| Value 0.6931471805599453 | |
| LN10 | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the natural logarithm of 10. | |
Examplevar num = Math.LN10 | |
| Value 2.302585092994046 | |
| LOG2E | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the log base-2 of E. | |
Examplevar num = Math.LOG2E | |
| Value 1.4426950408889634 | |
| LOG10E | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the log base-10 of E. | |
Examplevar num = Math.LOG10E | |
| Value 0.4342944819032518 | |
| PI | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the value of &pgr;. | |
Examplevar num = Math.PI | |
| Value 3.141592653589793 | |
| SQRT1_2 | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the square root of 0.5. | |
Examplevar num = Math.SQRT1_2 | |
| Value 0.7071067811865476 | |
| SQRT2 | NN 2 IE J1 ECMA 1 |
| Read-only | |
Returns the square root of 2. | |
Examplevar num = Math.SQRT2 | |
| Value 1.4142135623730951 | |
| abs() | NN 2 IE J1 ECMA 1 | ||
| abs(number) | |||
Returns the absolute value of the number passed as a parameter. | |||
| Returned Value Positive number or zero. | |||
Parameters
| |||
| acos() | NN 2 IE J1 ECMA 1 | ||
| acos(number) | |||
Returns the arc cosine (in radians) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| asin() | NN 2 IE J1 ECMA 1 | ||
| asin(number) | |||
Returns the arc sine (in radians) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| atan() | NN 2 IE J1 ECMA 1 | ||
| atan(number) | |||
Returns the arc tangent (in radians) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| atan2() | NN 2 IE J2 ECMA 1 | ||||
| atan2(x, y) | |||||
Returns the angle (in radians) of angle formed by a line to Cartesian point x, y. | |||||
| Returned Value Number between -&pgr; and &pgr;. | |||||
Parameters
| |||||
| ceil() | NN 2 IE J1 ECMA 1 | ||
| ceil(number) | |||
Returns the next higher integer that is greater than or equal to the number passed as a parameter. | |||
| Returned Value Integer. | |||
Parameters
| |||
| cos() | NN 2 IE J1 ECMA 1 | ||
| cos(number) | |||
Returns the cosine of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| exp() | NN 2 IE J1 ECMA 1 | ||
| exp(number) | |||
Returns the value of E to the power of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| floor() | NN 2 IE J1 ECMA 1 | ||
| floor(number) | |||
Returns the next lower integer that is less than or equal to the number passed as a parameter. | |||
| Returned Value Integer. | |||
Parameters
| |||
| log() | NN 2 IE J1 ECMA 1 | ||
| log(number) | |||
Returns the natural logarithm (base e) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| max() | NN 2 IE J1 ECMA 1 | ||||
| max(number1, number2) | |||||
Returns the greater value of the two parameters. | |||||
| Returned Value Number. | |||||
Parameters
| |||||
| min() | NN 2 IE J1 ECMA 1 | ||||
| min(number1, number2) | |||||
Returns the lesser value of the two parameters. | |||||
| Returned Value Number. | |||||
Parameters
| |||||
| pow() | NN 2 IE J1 ECMA 1 | ||||
| pow(number1, number2) | |||||
Returns the value of the first parameter raised to the power of the second parameter. | |||||
| Returned Value Number. | |||||
Parameters
| |||||
| random() | NN 2 IE J1 ECMA 1 |
Returns a random number between and 1. To calculate a random integer between zero and another maximum value, use the formula: Math.round(Math.random() * n)
where n is the top integer of the acceptable range. To calculate a random integer between a range starting with a number other than zero, use the formula: Math.round(Math.random() * n) + m where m is the lowest integer of the acceptable range and n+m equals the maximum value of the range. Note that the Math.random() method does not work in the Windows and Macintosh versions of Navigator 2. | |
| Returned Value Number from 0 through 1. | |
| Parameters None. | |
| round() | NN 2 IE J1 ECMA 1 | ||
| round(number) | |||
Returns an integer that follows rounding rules. If the value of the passed parameter is greater than or equal to x.5, the returned value is x + 1; otherwise, the returned value is x. | |||
| Returned Value Integer. | |||
Parameters
| |||
| sin() | NN 2 IE J1 ECMA 1 | ||
| sin(number) | |||
Returns the sine (in radians) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| sqrt() | NN 2 IE J1 ECMA 1 | ||
| sqrt(number) | |||
Returns the square root of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||
| tan() | NN 2 IE J1 ECMA 1 | ||
| tan(number) | |||
Returns the tangent (in radians) of the number passed as a parameter. | |||
| Returned Value Number. | |||
Parameters
| |||