# Log
{: .no_toc }

Returns a **Double** specifying the natural logarithm of a number.

Syntax: **Log(** *number* **)**

*number*
: *required* A **Double** or any valid numeric expression greater than zero.

The natural logarithm is the logarithm to the base *e*. The constant *e* is approximately 2.718282.

Base-*n* logarithms for any number *x* can be calculated by dividing the natural logarithm of *x* by the natural logarithm of *n* as follows:

Log<sub>*n*</sub>(*x*) = **Log(** *x* **)** / **Log(** *n* **)**

The following example illustrates a custom **Function** that calculates base-10 logarithms:

```tb check_build
Static Function Log10(X)
    Log10 = Log(X) / Log(10#)
End Function
```

### Common Errors

| Error | When |
|---|---|
| [5 (`&H5`)](/Reference/Run-time-Errors.md#5), *Invalid procedure call or argument* | *number* is zero or negative (**Empty** included) |
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *number* is **Null** |

### Example

This example uses the **Log** function to return the natural logarithm of a number.

```tb check_build
Dim MyAngle, MyLog
' Define angle in radians.
MyAngle = 1.3
' Calculate inverse hyperbolic sine.
MyLog = Log(MyAngle + Sqr(MyAngle * MyAngle + 1))
```

### See Also

- [Exp](/tB/Modules/Math/Exp.md) function
- [Sqr](/tB/Modules/Math/Sqr.md) function
