math.frexp

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

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

math.frexp
Function
Syntax
math.frexp(
  • num : number
)

Returns number mantissa, number exponent
API math
Source Lua (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.