From: thomas peklak Date: 2008-09-13T17:58:08+09:00 Subject: Re: float precision You are right, multiplying with 0.01 is even fast, see the benchmarks: require 'benchmark' times = 1000000 float = 9.234234765765765764 Benchmark.bm do |r| r.report('SPf :') { times.times do f1 = sprintf('%.2f' ,float).to_f end } r.report('*100 :') { times.times do f2 = (100 * float).round/100.0 end } r.report('*.01 :') { times.times do f3 = (100 * float).round*0.01 end } end user system total real SPf : 5.590000 0.050000 5.640000 ( 5.720373) *100 : 3.760000 0.040000 3.800000 ( 3.829771) *.01 : 1.770000 0.010000 1.780000 ( 1.811917) Thomas