math.log
Natural log
Prototype
v = math.log (v)
Description
Natural log of v (that is, to the base e). Note that math.exp is the inverse operation.
math.log (123456) --> 11.723640096265
math.exp (math.log (123456)) --> 123456
You can get the log to any base by dividing the log of the number by the log of the desired base. For example:
-- calculate log of 16 to the base 2 (2^4 = 16)
math.log (16) / math.log (2) --> 4
-- calculate log of 666 to the base 10
math.log (666) / math.log (10) --> 2.8234742291703
-- alternative method using math.log10 gives same results
math.log10 (666) --> 2.8234742291703
Lua functions
- math.abs - Absolute value
- math.acos - Arc cosine
- math.asin - Arc sine
- math.atan - Arc tangent
- math.atan2 - Arc tangent of v1/v2
- math.ceil - Next higher integer value
- math.cos - Cosine
- math.cosh - Hyperbolic cosine
- math.deg - Convert from radians to degrees
- math.exp - Raises e to a power
- math.floor - Next smaller integer value
- math.fmod - The modulus (remainder) of doing: v1 / v2
- math.frexp - Break number into mantissa and exponent
- math.huge - A huge value
- math.ldexp - Compute m* 2^n
- math.log10 - Log to the base 10
- math.max - The highest of one or more numbers
- math.min - The lowest of one or more numbers
- math.modf - Returns the integral and fractional part of its argument
- math.pi - The value of pi
- math.pow - Raise a number to a power
- math.rad - Convert degrees to radians
- math.random - Generate a random number
- math.randomseed - Seeds the random number generator
- math.sin - Sine
- math.sinh - Hyperbolic sine
- math.sqrt - Square root
- math.tan - Tangent
- math.tanh - Hyperbolic tangent
Topics
- Lua PCRE regular expression functions
- Lua base functions
- Lua bc (big number) functions
- Lua bit manipulation functions
- Lua coroutine functions
- Lua debug functions
- Lua io functions
- Lua math functions
- Lua os functions
- Lua package functions
- Lua script extensions
- Lua string functions
- Lua syntax
- Lua table functions
- Lua utilities
- Scripting callbacks - plugins
- Scripting