
Math.log() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
608
|
ActionScript Language Reference
Math.log() Method
compute the natural logarithm of a number
Flash 5; can be used when exporting Flash 4 movies
Math.log(x)
Arguments
x A positive integer.
Returns
The natural logarithm of x.
Description
The log( ) method calculates the natural logarithm (i.e., the base-e logarithm) of a number.
See the following Example to calculate the base-10 logarithm.
Example
trace (Math.log(Math.E)); // Displays: 1
// Compute the base-10 logarithm of a number
function log10 (x) {
return (Math.log(x) / Math.log(10));
}
Math.LOG10E Property
base-10 logarithm of e, approximately 0.43429
Flash 5; can be used when exporting Flash 4 movies
Math.LOG10E
Description
The LOG10E property represents the common logarithm of e (the base-10 logarithm of e), a
constant equaling approximately 0.43429.
Math.LOG2E Property
base-2 logarithm of e, approximately 1.44270
Flash 5; can be used when exporting Flash 4 movies
Math.LOG2E
Description
The LOG2E property represents the base-2 logarithm of e (log2e), a constant equaling
approximately 1.44270.
Bugs
In Flash Player 5.0.30.0, LOG2E erroneously returns the value of Math.LN2 (0.69315). This is
fixed in Flash 6.
Math.max() Method
determine the larger of two numbers
Flash 5; can be used when exporting Flash 4 movies
Math.max(x, y)