From: Manu Sankala Date: 2010-02-22T03:19:21+09:00 Subject: Re: Yet another rounding issue Mohit Sindhwani wrote: > You could try: > a = 2.175 > b = a + 0.0005 > c = ((b * 100).round) / 100.0 Well this is basically same as my ((some_float_here*100).to_s+'9').to_f.round/100.0 except that in my version I don't need to know how many decimals the float originally has. "b = a + 0.0005" would fail if 'a' has mode than 3 decimals. Since ((float_here*100).to_s+'9').to_f.round/100.0 and (BigDecimal(float_here.to_s)*100).round.to_s.to_f/100 seem to be about as fast I think I'll go with bigfloat as it seems less like a hack. Thank you both for your quick answers - Manu S -- Posted via http://www.ruby-forum.com/.