Meaning of Float>>closeTo:

Damien Cassou damien.cassou at gmail.com
Fri Mar 2 14:06:03 UTC 2007


2007/3/2, Frank Shearar <frank.shearar at angband.za.org>:
> "Damien Cassou" <damien.cassou at gmail.com> wrote:
> > 2007/3/2, Bert Freudenberg <bert at freudenbergs.de>:
> > > On Mar 2, 2007, at 13:56 , Damien Cassou wrote:
> > > > 2007/3/2, Bert Freudenberg <bert at freudenbergs.de>:
> > > >> On Mar 2, 2007, at 12:55 , Damien Cassou wrote:
> > > >> > 999999 closeTo: 999899.00011.             => true
> > > >> > 999999 closeTo: 999899.0001.               => false
> > > >> >
> > > Huh? Should it answer "maybe"? There is a threshold, and you chose
> > > your numbers right at that threshold.
> >
> > I think the answer should be the same. Look at the differences:
> >
> > 999999 - 999899.00011.                          => 99.9998899999773
> > 999999 - 999899.0001.                            => 99.9999000000535
> >
> > It's nearly a hundred in both cases.
> >
> > 999999 closeTo: 999899.00011.            => true (with a difference of
> > nearly 100)
> > 2 closeTo: 1                                               => false
> > (with a difference of 1)
> >
> > So, what is the threshold ?
>
> 0.0001? ( According to Float>>closeTo: )

Ok, so if two numbers have nearly 100 of difference, #closeTo:
shouldn't answer true. Right ?

-- 
Damien Cassou



More information about the Squeak-dev mailing list