This site is supported by donations to The OEIS Foundation.

# Template:Log 10

The {{log_10}} mathematical function template returns the common logarithm of ${\displaystyle \scriptstyle x\,}$, where ${\displaystyle \scriptstyle x\,}$ is a positive real number.

## Usage

{{log_10|a positive real number}}

## Valid input

A positive real number as argument.

## Examples

Examples with valid input

Code Result
{{log_10|0.1}} -1
{{log_10|1}} 0
{{log_10|1.5}} 0.17609125905568
{{log_10|10}} 1
{{log_10|150}} 2.1760912590557
{{log_10|1000}} 3
{{log_10|10^40}} 40
{{log_10|10^25 * 10^40}} 65

Examples with invalid input (returns an error message)

Code Result
{{log_10|i}} Log_10 error: Argument must be a positive real number
{{log_10|-1}} Log_10 error: Argument must be a positive real number
{{log_10|0}} Log_10 error: Argument must be a positive real number

## Code

```
{{ifnum| {{{1|not a number}}}
| {{#ifexpr: ({{{1}}}) > 0
| {{#expr: ln ({{{1}}}) / ln 10 }}
| {{error| Log_10 error: Argument must be a positive real number }}
}}
| {{error| Log_10 error: Argument must be a positive real number }}
}}

```