math.frexp

From ComputerCraft
Jump to: navigation, search

math.frexp
Function
Syntax
math.frexp()
Returns number mantissa, number exponent
API math
Source Lua (source)

Return the mantissa and exponent of num, two numbers and such that

ExampleExampleDecompose user input input
Read a line from the user, then print the mantissa and exponent of the number they entered.
Code
print(math.frexp(tonumber(read())))
Output Depends on what the user wrote. For instance, if they were to enter 5, the numbers printed would be 0.625 3.