thomas peklak wrote:
> You are right, multiplying with 0.01 is even fast, see the benchmarks:
> 

Thanks for the information.  It looks like multiplication is still twice 
as fast as division.  I am sure that with today's computers this only 
matters with large numbers of operations but on a IBM PC-1 it made a lot 
  of difference.


> 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