FIX rounding error in percent labels

This commit is contained in:
Nathan Dwarshuis 2022-09-09 17:04:36 -04:00
parent 892ab4cf31
commit 2ddb317dd3
1 changed files with 7 additions and 1 deletions

View File

@ -121,8 +121,14 @@ return function(config)
) )
end end
-- a conventional rounding function that behaves the way most humans were
-- taught in preschool
local _round = function(x)
return math.floor(x + 0.5)
end
local _format_percent_label = function(_) local _format_percent_label = function(_)
return function(z) return __string_format('%i%%', math.floor(z * 100)) end return function(z) return __string_format('%i%%', _round(z * 100)) end
end end
local _format_percent_maybe = function(z) local _format_percent_maybe = function(z)