driver.love/0115-round

5 lines
250 B
Plaintext

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