Article View: alt.folklore.computers
Article #697Re: Problem in Turbo Pascal 4.0
From: jo... Douglas W. Jones201H MLH31...
Date: Wed, 03 Jan 1990 19:47
Date: Wed, 03 Jan 1990 19:47
35 lines
2413 bytes
2413 bytes
>From article <129...@sun.Eng.Sun.COM>, by lin...@adapt.Sun.COM (Peter van der Linden): > Kees Huizing - Eindhoven Univ of Techn - The Netherlands, wants to know: >> the equality operator "=" does not (do) on reals what it pretends to do. >> I accept that it cannot detect perfect equality of reals, but what it >> could do is detect equality up to some representation dependent accuracy. > > A very reasonable question Kees! A number of years ago, a gentleman by the > name of Dijkstra, ... had the very same thought ... > > The experiment was soon deemed a failure when it was found that this had > the inadvertent and unwanted side effect that comparison was no longer > transitive. I.e. if A equalled B, and B equalled C, a program could not > conclude that A = C ! It's worse than that! The PLATO system at the U. or Illinois implemented comparison this way. They had good motives: They didn't want to have to explain to non-numerically-literate users why, for example, 0.1*100.0 wasn't equal to 10.0. It avoided such complaints, but it produced awful results when you tried to code many standard numerical algorithms. For example: If the equality test is modified as above, but the > and < tests are unmodified, it is possible that two of A=B, A<B and A>B may be true at the same time (although only one of A<B or A>B may be true). This leads to a real mess. If you modify all comparison operators so that only one of A<B, A=B, or A>B will be true, comparisons are suddenly misleading. A<=B means (A<B or A=B) and it is consistent with not(A>B), but suddenly, there are values of A and B such that A<=B is reported as true, but in fact, A is slightly greater than B. As a result, there are values of A and B where A<=B is reported to be true, ((A-B)*10)>0 is also reported as true.
Technical Details
Message-ID:
<381@ns-mx.uiowa.edu>Path:
mbox-mo1.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!ns-mx!pyrite.cs.uiowa.eduReferences:
<129838@sun.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!ns-mx!pyrite.cs.uiowa.edu From: jo...@pyrite.cs.uiowa.edu (Douglas W. Jones,201H MLH,3193350740,3193382879) Newsgroups: comp.lang.pascal,alt.folklore.computers Subject: Re: Problem in Turbo Pascal 4.0 Message-ID: <381@ns-mx.uiowa.edu> Date: 3 Jan 90 19:47:19 GMT References: <129838@sun.Eng.Sun.COM> Sender: ne...@ns-mx.uiowa.edu Followup-To: comp.lang.pascal Lines: 35 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit