From: Jason DiCioccio Date: 2004-10-28T04:49:28+09:00 Subject: Re: Rounding error, (100.0 * 9.95).to_i == 994 Hello! --On Thursday, October 28, 2004 03:48:56 +0900 Jamis Buck wrote: > Bill Atkins wrote: >> OK, that would make sense if v's value was 994.5, but it seems to be >> 995.0. Why should to_i round down like that? > > But it isn't 995.0. It is 994.99999999883 or something. IRB displays it > as 995.0, rounding it. > > - Jamis I'm confused now.. 100.0 * 9.95 is clearly 995. So what exactly is the issue with floating point numbers is making this come out to 994.999999999983 (or wahtever ;))? If every language is plagued by this problem, then I'd be curious to know the history behind it.. Thanks! -JD-