Summary
Break number into mantissa and exponent
Prototype
m, n = math.frexp (v)
Description
The frexp function breaks down the floating-point value (v) into a mantissa (m) and an exponent (n), such that the absolute value of m is greater than or equal to 0.5 and less than 1.0, and v = m * 2^n.
Note that math.ldexp is the inverse operation.
m, n = math.frexp (1.23456e24)
print (m) --> 0.51060204851673
print (n) --> 81
print ( 0.51060204851673 * 2^81 ) --> 1.23456e+024
See Also ...
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.huge - A huge value
math.ldexp - Compute m* 2^n
math.log - Natural log
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 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 PCRE regular expression functions
Lua script extensions
Lua string functions
Lua syntax
Lua table functions
Lua utilities
Scripting
Scripting callbacks - plugins
(Help topic: lua=math.frexp)