lua

lua 中的math.floor函数是向下取整函数。

math.floor(5.123)  – 5

math.floor(5.523)   – 5

用此特性实现四舍五入

math.floor(5.123 + 0.5)  – 5

math.floor(5.523 + 0.5)  – 6

也就是对math.floor函数的参数进行 “+ 0.5” 计算