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