From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107079,c7637cfdf68e766 X-Google-Attributes: gid107079,public X-Google-Thread: 103376,c7637cfdf68e766 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,c7637cfdf68e766 X-Google-Attributes: gidf43e6,public X-Google-Thread: f8362,c7637cfdf68e766 X-Google-Attributes: gidf8362,public X-Google-Thread: 109d8a,c7637cfdf68e766 X-Google-Attributes: gid109d8a,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: floating point comparison Date: 1997/08/07 Message-ID: #1/1 X-Deja-AN: 262997658 Distribution: inet References: <33E61497.33E2@pseserv3.fw.hac.com> <5sar4r$t7m$1@cnn.nas.nasa.gov> <5sbb90$qsc@redtail.cruzio.com> <5scugs$jdc$1@cnn.nas.nasa.gov> Organization: New York University Newsgroups: comp.lang.ada,sci.math.num-analysis,comp.software-eng,comp.theory,sci.math Date: 1997-08-07T00:00:00+00:00 List-Id: << However, it is true that if you know what is going on, and know what you want that you might get away with it. But *I* would never write a code to go into a life-critical system that had the line if(a == b) return -1; Or the like, where a and b are floats.>> There is zero justification for this statement. The general rule is that you had better not write any floating-point operations in life critical systems that have not been extremely carefully analyzed by competent numerical analysis (many systems of rules for such systems eliminate the use of floating-point completely for this reason). If you are using floatingpoint in such a system, with proper analysis, then it is entirely possible that this analysis may indicate not only that an equality operation of the above type is acceptable, but it may be correct where some kind of attempt at apprixmate testing would be incorrect. I canot imagine that anyone would think that simple (and incorrect) rules such as the above would make it safe to employ floating-point calculations in life critical systems.