Xref: utzoo comp.lang.modula2:1238 comp.lang.c:15885 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.modula2,comp.lang.c Subject: Re: "for" loops (was Re: C++ vs. Modula2) Message-ID: <1381@X.UUCP> Date: 30 Jan 89 06:57:00 GMT References: <739@jupiter.iis.UUCP> <19579@agate.BERKELEY.EDU> Organization: Servants of the Great White Frog Lines: 13 In article <19579@agate.BERKELEY.EDU>, bowles@eris.berkeley.edu (Jeff A. Bowles) writes: > If I had a nickel for every time, in Fortran, > that I needed a loop that ran from 0.0 to 1.0 by 0.1 (or the like) ...you'd be broke. You NEVER need a loop that runs from 0.0 to 1.0 by 0.1. 1/10 is a repeating fraction in binary, and thus .1+.1+.1+.1+.1+.1+.1+.1+.1+.1 does NOT equal 1.0. Read "The Elements of Programming Style" for more tidbits on this and other programming topics. -- John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101 ...!decvax!frog!john, john@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu Presumably this means that it is vital to get the wrong answers quickly. Kernighan and Plauger, The Elements of Programming Style