Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!ubc-vision!ubc-cs!manis From: manis@ubc-cs.UUCP Newsgroups: comp.lang.c Subject: Re: float == Message-ID: <949@ubc-cs.UUCP> Date: Tue, 31-Mar-87 11:04:31 EST Article-I.D.: ubc-cs.949 Posted: Tue Mar 31 11:04:31 1987 Date-Received: Sat, 4-Apr-87 04:43:23 EST References: <6529@brl-adm.ARPA> Reply-To: manis@ubc-cs.UUCP (Vincent Manis) Organization: UBC Department of Computer Science Lines: 17 In article <6529@brl-adm.ARPA> gwyn@BRL.ARPA (VLD/VMB) writes: >I don't think at this stage X3J11 would really take my idea about >banishing floating == very seriously. It may very well be something >that "lint" should catch, though. Back in prehistory (about 1970) I used a Fortran compiler on a Univac 1108 running the Exec 2 operating system. This compiler would generate a warning when you compared floating point numbers for equality (or non-equality). I would go further than asking lint to catch it. This is a classic instance of something the compiler knows and can easily tell you. A non-fatal warning (which can be suppressed) is all that's really necessary. Something like "Warning: floating point equality tests are rarely correct" would do quite nicely. A compiler which generates this warning is only trivially non-compliant. A "flequal(a, b, fuzz)" function is a perfect candidate for a library routine (or even an inline expansion).