[comp.sys.mac.hypercard] little bug ??

vdaele@cstw35.prl.philips.nl (Marc van Daele) (11/14/89)

When doing some simple calculations , I discovered the following :

         put  3*0.05 - 2*0.05 = 0.05  yields true
         put  3*0.05 - 2*0.05 <= 0.05 yields false 

I know that 0.05 isn't exact representable in a binary system, and if you
take for example 0.25 (which IS exact representable) instead of 0.05,
everything works allright.

I suppose that, for the equality testing of representations of real numbers,
some margin of security is included (e.g. the last bit could be discarded).
But I think this should also be implemented in the less than and greater than
tests.

Why is this done ?
Is this fixed in later versions of Hypercard (hypertalk) ?
I am using a Mac SE and Hypercard 1.2.?

Up to now I only see two solutions : splitting the test into two parts
(less than or equal) or adding an small epsilon to
                x <= y + epsilon

I thought it was useful to post it.

_______________________________________________________________________________

Heaven knows I'm miserable now (The Smiths)

Marc Van Daele