From: David Kastrup Date: 2006-11-20T03:00:09+09:00 Subject: Re: format a float number with specific number of decimal point Oscar Lok writes: > Hi, > May I know that how to format a float number with specific number of > decimal point, please? > e.g :-- > 123.456789 to 123.4568 > 123.123321 to 123.1233 irb(main):039:0> print [123.456789, 123.123321].collect {|x| format("#{x} to %.4f\n",x)} 123.456789 to 123.4568 123.123321 to 123.1233 => nil irb(main):040:0> -- David Kastrup, Kriemhildstr. 15, 44793 Bochum