源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Lua math.fmod使用时的小数问题

  • 时间:2020-03-31 18:57 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要: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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部