From: Harry Kakueki Date: 2011-09-11T22:09:44+09:00 Subject: Re: How do I make output generate a float without an excess numbers of decimal places? > If days is a large number, say a year, it usually ends up with a number > like 7.4799999999999999984. Is there a way to fix this? Perhaps chopping > off after 2 decimal places in a string? Thanks in advance! > This is not as detailed but it may be worth a look. n = 7.4799999999999999984 p n.round(2) #> 7.48 p n.round(1) #> 7.5 http://www.ruby-doc.org/core/classes/Float.html#M000144 Harry