Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hp4nl!phigate!prle!prles2!cstw35!vdaele From: vdaele@cstw35.prl.philips.nl (Marc van Daele) Newsgroups: comp.sys.mac.hypercard Subject: little bug ?? Message-ID: <780@prles2.UUCP> Date: 14 Nov 89 10:32:32 GMT Sender: nobody@prles2.UUCP Reply-To: vdaele@cstw35.prl.philips.nl (Marc Van Daele) Organization: Centre for Software Technology, Philips Eindhoven Lines: 29 References: 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