Anonymous

Module:CommonFunctions: Difference between revisions

From Elwiki
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 137: Line 137:
end
end


math.round = function(num)
function math.round(num, decimals)
return math.floor(num+.5)
    decimals = math.pow(10, decimals or 0)
    num = num * decimals
    if num >= 0 then num = math.floor(num + 0.5) else num = math.ceil(num - 0.5) end
    return num / decimals
end
end
ElEditors, Administrators
70,686

edits