Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!nrl-cmf!cmcl2!brl-adm!adm!jrv%sdimax2@mitre-bedford.arpa From: jrv%sdimax2@mitre-bedford.arpa Newsgroups: comp.lang.c Subject: Re: How not to write a loop, revisited Message-ID: <16276@brl-adm.ARPA> Date: 23 Jun 88 19:43:02 GMT Sender: news@brl-adm.ARPA Lines: 17 > If this scares you, good! Floating-point can be a nasty nemesis of > the numerically naive. Claes' advice is sound: > USE INTEGERS FOR COUNTING. > > Peter Klausler @ Compiler Development, Cray Research, Inc. > ...!{ihnp4!cray,sun!tundra}!hall!pmk I suggest the revision Use integer values for counting. ^^^^^^ I believe that floating point arithmetic is exact as long as all the values are integers with not too many bits - and they typically allow more bits than a long would. If there are exceptions to this, I'd like to hear about them. - Jim Van Zandt