round = function(f) -- apparently this is wrong for one floating point under 0.5 -- there's an alleged better way at https://stackoverflow.com/questions/18313171/lua-rounding-numbers-and-then-truncate/58411671#58411671 return math.floor(f+0.5) end