[Newbies] Float comparsion
oscar.nierstrasz at gmail.com
Fri Feb 27 12:41:54 UTC 2009
Yes, we looked at that, but closeTo: uses a much larger epsilon than
Float's class variable Epsilon.
I suggested Camillo wrote an extension method similar to closeTo: but
using the existing Epsilon (or an arbitrary one as an additional
Is that the right thing to do?
On Feb 27, 2009, at 13:34, Lukas Renggli wrote:
> Hi Camillo ;-)
> Use the method #closeTo: instead of #=. Comparing floats with #=
> almost never works.
> Although "(Float halfPi / 2) tan" is printed as 1.0, it is not exactly
> 1.0 due to rounding errors in the calucaltaion and/or the internal
> (Float halfPi / 2) tan - 1.0 --> -1.110223024625156e-16
> Lukas Renggli
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners