From: Andrew Lewis Date: Fri, 2 Jun 2017 15:56:32 +0000 (+0200) Subject: [Minor] lua_util.round: don't round up X-Git-Tag: 1.6.0~70 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8b79e3c59f3675b6e1c417f8d0d65335de1a873;p=rspamd.git [Minor] lua_util.round: don't round up --- diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 81e4cb606..0a824dca1 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -27,7 +27,7 @@ end -- Robert Jay Gould http://lua-users.org/wiki/SimpleRound exports.round = function(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) - return math.floor(num * mult + 0.5) / mult + return math.floor(num * mult) / mult end return exports