From: ara.t.howard@... Date: 2006-11-09T02:54:51+09:00 Subject: Re: Simple Math Problem On Thu, 9 Nov 2006, Tim Pease wrote: > Machine roundoff error. Floating point values are never precise on any > computer. > > The best way to compare two floating point values is to take there > difference and make sure it lies withing some acceptable error limit. > > v1 = 80.04 > v2 = 0.12 * 667 > diff = v1-v2 > diff.abs < Float::EPSILON > > That last line returns false, so you need to choose a different epsilon ... > > diff.abs < 1.0e-12 > > That will return true. boy, how bout an rcr for that behaviour if one write this 2.0 =~ 2.0 ?? -a -- my religion is very simple. my religion is kindness. -- the dalai lama