Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!ihnp4!inuxc!pur-ee!uiucdcs!parsec!ctvax!uokvax!andree From: andree@uokvax.UUCP Newsgroups: net.lang Subject: Re: Superstition in Programmers - (nf) Message-ID: <4814@uiucdcs.UUCP> Date: Sat, 7-Jan-84 22:51:34 EST Article-I.D.: uiucdcs.4814 Posted: Sat Jan 7 22:51:34 1984 Date-Received: Sun, 8-Jan-84 21:22:51 EST Lines: 23 #R:abnjh:-34800:uokvax:9000014:000:622 uokvax!andree Jan 6 21:26:00 1984 /***** uokvax:net.lang / decvax!minow / 8:31 pm Jan 4, 1984 */ My favorite superstition (in my own programming) is to never use an equality test where a magnitude test could be used. Martin Minow decvax!minow /* ---------- */ This is not a superstition. Consider the following: float iter; for (iter = 0.0; iter != 1.0; iter += 0.1) stuff(iter) ; On almost every computer around, this code WILL NOT TERMINATE. Something about most floating point systems not realizing that 10 * .1 = 1. Or maybe it has to do with the fact that you can't represent .1 in binary (or hex, for those of you on IBM hardware).