Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!agate!ucbvax!decwrl!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.c Subject: Re: C is not superfluous (Re: "for" loops (was Re: C++ vs. Modula2)) Message-ID: <660028@hpclscu.HP.COM> Date: 7 Feb 89 00:48:50 GMT References: <1315@goofy.megatest.UUCP> Organization: Hewlett-Packard Calif. Language Lab Lines: 24 > I guess it is obvious to me, not to others: If the increment that the user > wrote was 0.1, with one digit to the right of the decimal point, the > compiler should obviously use 10 as the denominator because 0.1 = 1/10. If > the user wrote a loop that incremented by 0.127, the compiler writer should > use 1000 for the divisor, because the user had 3 digits to the right of the > decimal. Any increment the user can type into their program can be exactly What you want is BCD (blecchh!!). Be sure you want to ask for this. Because the programmer could just as well have written: float f = 1.27; /* LOTS OF STATEMENTS */ for (g = 0.0; g < 100.0; g += f) { /* ... */ } What? you want to treat *your* case specially, but not this more general one? Like: IF, in the for loop, the increment statement is a single statement of the form LOOP_INDEX += INCREMENT, and the INCREMENT is a floating-point constant, THEN do your special fiddling... Really! --- Shankar.