From: Hal Fulton Date: 2004-05-20T08:10:02+09:00 Subject: Re: bad maths Martin larsson wrote: > Hi > > i = 0 > 100.times { > p i += 0.6 > } > > results in: > 5.6 > 5.7 > 5.8 > 5.9 > 5.99999999999999 > 6.09999999999999 > 6.19999999999999 > > on my XP maching with ruby 1.8.1-13. I used rubyinstaller to install it > if that matters > > anyone more have this problem? anyway to fix it? Look for a thread about a week or so ago. :) I suggest you round off the numbers for output and/or for calculations. And use integer arithmetic wherever you can. Hal