[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: % Loop limit expression too large for loop variable type.



hua Guo (gh75@usa.net) writes:
 
> I got this error message when I tried to run a program:
> 
> % Loop limit expression too large for loop variable type.
>   <LONG     (       54695)>.
> 
> What is wrong here? I am a beginner here.

Normally, any integer in IDL is a short (two byte)
integer, including integers in loop expressions.
You need your loop variables to be LONG (four byte) 
integers. You can set this up in one of two different ways.

The most common way is to force the loop expression
to be a long integer:

   FOR j=0L, n DO Whatever

The second is to make ALL integers in your program
be long integers. You do this by putting a COMPILE_OPT
statement in your program module:

   PRO JUNK
   Compile_Opt defint32

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155