From: Kane Williams Date: 2011-09-11T18:05:24+09:00 Subject: How do I make output generate a float without an excess numbers of decimal places? For example, my current code is >def grow days > while days != 0 > growheight = rand(5) / 100.0 > @height = @height + growheight > days = days - 1 > end >end 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! -- Posted via http://www.ruby-forum.com/.