Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: ANSI really does want you to == float values. Message-ID: <5756@brl-smoke.ARPA> Date: Tue, 14-Apr-87 02:52:43 EST Article-I.D.: brl-smok.5756 Posted: Tue Apr 14 02:52:43 1987 Date-Received: Wed, 15-Apr-87 04:47:54 EST References: <6909@watmath.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: comp Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 10 In article <6909@watmath.UUCP> rbutterworth@watmath.UUCP (Ray Butterworth) writes: >The ANSI standard defines functions such as strtod() that return >a double value, HUGE_VAL, upon failure. That seems to imply that >the following pieces of code all should do the comparison the same >way. As you point out, the exact equality comparison may fail on some systems. Therefore, you should not use it. Most functions returning HUGE_VAL also historically have some other error indicator as well. I wish X3J11 had adopted matherr(), which is a fairly good way to intercept such exceptions.