比如保留一位小数f = 6.33333puts (f*10).round/10.to_f
这样比较麻烦,谁有比较好的方法 啊?
[code="java"]f=6.3333format("%.2f",f).to_f[/code]
f=6.3333.round(2)
f=6.3333.round(1)