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: 109d8a,c7637cfdf68e766 X-Google-Attributes: gid109d8a,public X-Google-Thread: f8362,c7637cfdf68e766 X-Google-Attributes: gidf8362,public X-Google-Thread: 103376,c7637cfdf68e766 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,c7637cfdf68e766 X-Google-Attributes: gidf43e6,public X-Google-Thread: 107079,c7637cfdf68e766 X-Google-Attributes: gid107079,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: floating point comparison Date: 1997/08/09 Message-ID: #1/1 X-Deja-AN: 263076339 References: <33E61497.33E2@pseserv3.fw.hac.com> <5sar4r$t7m$1@cnn.nas.nasa.gov> <5sbb90$qsc@redtail.cruzio.com> Organization: New York University Newsgroups: comp.lang.ada,sci.math.num-analysis,comp.software-eng,comp.theory,sci.math Date: 1997-08-09T00:00:00+00:00 List-Id: Gerhard says <> There are many other situations besides those that you mentioned, the following immediately come to mind: 1. A test for zero may be quite reasonable, even with signed zeroes, and infinities, the case of zero may require special handling which is not required for small non-zero values. 2. Careful analysis may show that an iterative algorithm converges to precise equality under the roudning regime being used. In such a case, it may be both more accurate and more efficient to check for precise convergence. 3. If you know that the values that are represented are all precisely represented (e.g. integersin a representable range), then exact equality is perfectly reasonable. 4. Precise equality comparisons with infinity are often perfectly appropriate (and indeed the idea of epsilon testing here is completely bogus) Plus many more ...