From: Tim Pease Date: 2006-07-08T03:28:45+09:00 Subject: Re: Float#==. Legacy? Done. http://rcrchive.net/rcr/show/340 On 7/7/06, ara.t.howard@noaa.gov wrote: > On Sat, 8 Jul 2006, Tim Pease wrote: > > > Martin, I like the syntax. To make it more like Float#== > > > > class Float > > def =~( other ) > > epsilon_eql?(coerce(other), EPSILON) > > end > > > > def epsilon_eql?( other, epsilon ) > > return false unless other.instance_of? self.class > > ((other-self)/other).abs <= epsilon > > end > > end > > > > I think this gives the best of both worlds. A simple =~ syntax for > > using the default epsilon, and the slightly less elegant epsilon_eql? > > syntax when you want to sepcify your own. > > > > Blessings, > > TwP > > hi guys- > > i've written this at least 10 times - how bout an rcr? > > -a > -- > suffering increases your inner strength. also, the wishing for suffering > makes the suffering disappear. > - h.h. the 14th dali lama > >