# llLog10

*LSL function*

```lsl
float float llLog10(float val);
```

- `float val`: Number to compute the logarithm of.

- Returns: `float`
- Energy: 10

To get the [natural logarithm](https://en.wikipedia.org/wiki/natural_logarithm) use [llLog](/functions/llLog/).

`llLog10` should only be used where the base 10 log is needed, all other applications should use [llLog](/functions/llLog/) instead.

Returns a [float](https://wiki.secondlife.com/wiki/float) that is the base 10 [logarithm](https://en.wikipedia.org/wiki/logarithm) of **val**.

If **val** &lt;= 0 return `zero` instead.

```lsl title="How to use" frame="terminal"
float result = llLog10(0.0);
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
  state_entry()
  {
    float num1 = llFrand(100.0);

    llOwnerSay("The base 10 logarithm of " + (string)num1 + " is " + (string)llLog10(num1));
  }
}
```

</details>

## Notes

There are only two log functions [llLog](/functions/llLog/) and [llLog10](/functions/llLog10/). Errors introduced as a result of floating-point arithmetic are most noticable when working with logarithms. [llLog](/functions/llLog/) should be used instead of [llLog10](/functions/llLog10/) when converting the base of the logarithm.

```lsl
float LogBaseN = llLog(value) / llLog(Base); //This technique introduces errors but is the only way
```

## See also

### Functions

- [llLog](/functions/llLog/)
- [llPow](/functions/llPow/)
- [llSqrt](/functions/llSqrt/)

### Articles

- [Logarithm](https://en.wikipedia.org/wiki/Logarithm)

---

*Source: [LlLog10](https://wiki.secondlife.com/wiki/LlLog10) on the Second Life Wiki. Content from the Second Life Wiki article LlLog10 (revision 1194350, 2015-01-22), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llLog10/
