# Log

## Synopsis

```
Log(number)
```

### Arguments

The number argument can be any valid numeric expression greater than 0. Specifying 0 or a negative number results in a runtime error.

## Description

The natural logarithm is the logarithm to the base e. The constant e (Exp(1)) is approximately 2.718282.

You can calculate base-n logarithms for any number x by dividing the natural logarithm of x by the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)

## Examples

The following example uses the Log function to calculate the natural logarithm for each of the integers 1 through 10:

For x = 1 To 10 Println "Natural log of ",x," = ",Log(x) Next

The following example uses the Log function to calculate the base-10 logarithms for the numbers 10 through 100, counting by tens. For 100, it returns 2 (10 to the power of x = 100).

x = 10 For y = 1 To 10 Base10 = Log(x) / Log(10) Println "Base-10 log of ",x," = ",Base10 x = x + 10 Next

## See Also

Exp function