tibia-client/modules/corelib/math.lua

11 lines
211 B
Lua
Raw Normal View History

2012-06-26 00:13:30 +02:00
-- @docclass math
function math.round(num, idp)
local mult = 10^(idp or 0)
if num >= 0 then
return math.floor(num * mult + 0.5) / mult
else
return math.ceil(num * mult - 0.5) / mult
end
end