Erlang generally uses the underlying C runtime library of your chosen operating system to provide the various mathematical primitives, including the natural logarithm (ln, which is written log in Erlang). If you want logarithms in some other base you need to use the standard mathematical relation:

log(x)
log (x) = ---------
n log(n)

Example:

To find the base 10 logarithm of 1.82:

log(1.82)
log (1.82) = -----------
10 log(10)

3> math:log(1.82) / math:log(10).
0.260071

You may not be satisfied with five digits of precision. The Erlang command line interface makes a guess about what level of detail you want for display. You can override this via a call to format: