Re: a BUG or not a BUG in IDL ? [message #6631 is a reply to message #6629] |
Fri, 19 July 1996 00:00   |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
> I have a "warning in loops" for you guys...
<see original posting for routine>
> The first loop if OK, the second loop stops after the first
> iteration, but the last loop, just keeps going forever...
>
> Any comments ?
. With IDL 4.0.1 on DEC Alpha/OSF the first 2 loops work the same as on
your platform, but the third (setting counter to LONG) terminates
after 10 iterations.
. On Pentium/WinNT, the behaviour is the same as for Alpha/OSF, except that
a "floating point underflow" error gets reported.
. On SunOS 4.1.3, the behaviour is the same as on your platform, except that
the third loop actually terminates after 655361 iterations.
Something of a worry!
Are you using a "big-endian" machine by any chance?
Just a guess, but it would appear that FOR statements might be "compiled" in
such a way that there's no allowance for a change in the loop variables'
types. (Maybe for a little extra speed?) And, still guessing, if the loop
counter variable's type is changed within the loop, then just some of it
(e.g., the 16 bits at the lowest memory address for INT counters) is used
within the FOR statement. Finally, I'd guess that the FOR loop stores
something back into the actual loop-counter variable in a similarly weird
way. (This could account for FP loop-counters getting zapped into
denormals.)
Peter Mason
|
|
|