RE: BUG! Erratic for loop behavior

new topic     » goto parent     » topic index » view thread      » older message » newer message

for i = var1 to var 2 by var3 do
end for

how much should the vars be multiplied by?

Chris

Dan Moyer wrote:
> Andy,
> 
> Although I assume this is at least obvious, you could just do this:
> 
> for i = 10*31.1 to 10*34.2  do
>   ?i/10
> end for
> 
> Same for whatever max "level" of floating point you have, ie, if *any* 
> value
> goes out to .001,multiply all by 1000, then divide, etc.
> 
> Maybe there's some good reason that doesn't occur to me offhand why this
> won't work?
> 
> Dan Moyer
> 
> ----- Original Message -----
> From: "Andy Serpa" <renegade at earthling.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, March 23, 2002 11:19 AM
> Subject: BUG! Erratic for loop behavior
> 
> 
> > Hello,
> >
> >
> > The output of this loop:
> > ------------------------------
> > for i = 9.4 to 10.0 by .1 do
> >   ? i
> > end for
> > ------------------------------
> > stops at 10, as expected.
> >
> >
> > The output of this loop:
> > ------------------------------
> > for i = 31.1 to 34.2 by .1 do
> >   ? i
> > end for
> > ------------------------------
> > stops at 34.1 (!), NOT as expected.
> >
> >
> > The output of this loop:
> > ------------------------------
> > for i = 131.1 to 134.2 by .1 do
> >   ? i
> > end for
> > ------------------------------
> > stops at 134.2, as expected.
> >
> >
> > The output of this loop:
> > ------------------------------
> > for i = 60.0 to 64.5 by .1 do
> >   ? i
> > end for
> > ------------------------------
> > stops at 64.4, NOT as expected.
> >
> >
> > I've verified this on exw.exe & ex.exe, as well as translated to C.  It
> > looks like an outright bug to me.
> >
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu