math.modf
Return the integer and fractional parts of number.
|
|||
Read a single number from the user, then print its integral and fractional parts. | |||
Code | <nowiki>
print(math.modf(tonumber(read())))
</nowiki>
|
||
Output | Depends. If the user wrote 5.2 , the numbers printed will be 5 0.2 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
math.modf Function | |
---|---|
Syntax math.modf(
| |
Returns | number integral, number fractional |
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.