#BEGENNER HELP" again!
11-Oct-95 17:02:16
Sb: #48455-#BEGENNER HELP" again!
Fm: Dan Namay 102062,3533
To: Douglas Hornal 72637,2714
Doug,
If you want to use a counter, it's best to use an integer instead of a
float. Change to:
int number
.
.
.
while (number >= 0)
.
(printf (%d\n", number);
.
This should work. As a matter of fact, I've got it running as I type this.
(I have the SAS C compiler.) It DOES take a little time to get through the
1,000,000 iterations, though.
The decimal comes from the "float" declaration. The imprecision comes from
the round-off error in the computer's designation of floating point numbers.
Others should be able to elaborate better than I. There is also a brief
description of this _somewhere_ in your book; I remember reading it within the
first five chapters.
Hope this helps.
Wolf Pup
– Howlin' at the Net, Six-Packin' & Diggin'