我是靠谱客的博主 高贵蜡烛,这篇文章主要介绍Lua math.fmod使用时的小数问题,现在分享给大家,希望可以做个参考。

lua math.fmod使用注意小数:
--Returns the remainder of the division of x by y.
function math.fmod (x, y) end //取模运算

这里需要注意小数的问题,看下面两个例子:
1、
local x = math.fmod(15, 4)
print(x)

结果:4

2、
local x = math.fmod(15.3, 4)
print(x)

结果:3.3

3、
local x = math.fmod(15, 4.1)
print(x)

结果:2.7

最后

以上就是高贵蜡烛最近收集整理的关于Lua math.fmod使用时的小数问题的全部内容,更多相关Lua内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(248)

评论列表共有 0 条评论

立即
投稿
返回
顶部