comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: loop limit ???
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: loop limit ??? [message #53579] Wed, 18 April 2007 15:28 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1176929681.182929.291930@q75g2000hsh.googlegroups.com>, kostis <kostiskaz@gmail.com> writes:
> i wouldnt expect that IDL has a limit for loops !!
> trying a loop of 50.000 steps i got the message:
>
> % Compiled module: TRAJECTORY.
> % Loop limit expression too large for loop variable type.
> <LONG ( 49999)>.
> % Execution halted at: TRAJECTORY 16 /home/kostis/PROJECT
> LARMOR/dipole/trajectory.pro
> % $MAIN$
>
> Why is this?
> This means i cant have bigger loops... or is there a trick??
>
You can have much larger loops, just be careful about the indexing.
In the expression

for i = a, b do ....

the type of the loop variable is determined by the type of a
(regardless of what b is). So, if you write

for i = 0, 50000

or even

for i = 0, 50000l

the loop variable will be a standard (aka "short") integer and these
are limited to 2^15 - 1, i.e. 32767. But if you'll write

for i = 0l, 50000

the loop variable is of type LONG and the limit is at 2^31 - 1, more
then 2 billion. If that's not enough you can use LONG64, at which
point it'll probably be the longevity of the computer that'll
determine the limit

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with the F-test. mpftest.pro in particular.
Next Topic: Re: Annoying ROIs

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 03:50:00 PDT 2025

Total time taken to generate the page: 2.08661 seconds