"%.1f" means to format the number as a string with just one floating decimal point. "%.0f" means to format the number with 0 decimal places. I have no idea why you are getting many trailing zeros.
Alternately, you can replace that line with this:
Lua Code:
if val<1000 then return math.floor(val)