Table of Contents

Math.log( ) Method Flash 5; can be used when exporting Flash 4 movies

compute the natural logarithm of a number
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));
}

Table of Contents