From: Robert Klemme Date: 2007-07-26T20:03:52+09:00 Subject: Re: How to truncate float number after dot? 2007/7/26, Marcin Tyman : > I didn't mean to truncate all. But i.e. to round to several places after > dot. Usually it's better to calculate with full precision and round when printing, e.g. using printf of irb(main):022:0> "%4.1f" % 1.0 => " 1.0" irb(main):023:0> "%4.1f" % 1.04 => " 1.0" irb(main):024:0> "%4.1f" % 1.05 => " 1.1" Kind regards robert