Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!exodus!exodus-bb!khb From: khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) Newsgroups: comp.lang.fortran Subject: Re: Fortran 90 status Message-ID: Date: 17 May 91 17:03:13 GMT References: <13372@exodus.Eng.Sun.COM> <23881@lanl.gov> <1991May16.195328.727@casbah.acns.nwu.edu> Sender: news@exodus.Eng.Sun.COM Distribution: comp Organization: Sun MegaSystems Lines: 35 In-reply-to: ravi@earth.ce.nwu.edu's message of 16 May 91 19:53:28 GMT In article <1991May16.195328.727@casbah.acns.nwu.edu> ravi@earth.ce.nwu.edu (Ravi Sinha) writes: Real DO control variables allow you to have loops like: DO r = 1,100000,0.1 ... ENDDO The replacement with integer DO control variable would be: rbegin = 1 rint = 0.1 DO i=1,1000000 r = rbegin + (i-1)*rint ... ENDDO Maybe someone can tell me why the second form is better from an optimization point of view, and why the first form should be disallowed. Try your codelet on a variety of machines (with radically different fp; say IBM S/360 family, VAX, IEEE, Univac, old Cyber, new Cyber). You will probably be surprised at what you get on some machines .... yet all of them will be working just fine .... Using fp for loop control is dangerous; you can't trivially predict how many times a loop will be executed (for extra points, construct an example where ieee gradual underflow causes your loop to get executed tons of times more than you expected). -- ---------------------------------------------------------------- Keith H. Bierman keith.bierman@Sun.COM| khb@chiba.Eng.Sun.COM SMI 2550 Garcia 12-33 | (415 336 2648) Mountain View, CA 94043