Quirrel4.41.0

math.log10

Defined in module "math"
from "math" import log10
pure fastcall log10(x: number): float

Returns the base-10 logarithm of x

Parameters

xnumberthe number to take the logarithm of

Return value

The base-10 logarithm of x, as a float.

Notes

The result is always a float, even when x is an integer: type(log10(100)) is "float".

log10(0) does not throw. It returns negative infinity. A negative x does not throw either; it returns NaN. Both print differently between compilers and platforms, so do not print them from portable code.

Example

examples/math/log10.nut
from "math" import log10

println("log10(100) =", log10(100))
println("log10(2) =", log10(2))

// the result is a float even when x is an integer
println("type(log10(100)) =", type(log10(100)))
Output:
log10(100) = 2
log10(2) = 0.30103
type(log10(100)) = float

See also

logReturns the natural logarithm of x
expReturns e raised to the power of x
powReturns x raised to the power y
mathmodule index