math.ldexp
Compute a floating point number from the given mantissa and exponent. This is the inverse operation of math.frexp, and computes .
|
|||
Read a two lines from the user, and compute the floating point number represented by the given mantissa and exponent. | |||
Code | <nowiki>
local m = tonumber(read())
local e = tonumber(read())
print(math.ldexp(m, e))
</nowiki>
|
||
Output | Depends on what the user wrote. For instance, if they were to enter 0.625 and 3 , the number print would be 5 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
math.ldexp Function | |
---|---|
Syntax math.ldexp(
| |
Returns | number |
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.