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

Home » Public Forums » archive » Re: endless loop problem
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: endless loop problem [message #68963 is a reply to message #68962] Sun, 06 December 2009 15:28 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Dec 6, 9:11 pm, Elkunn <wasit.weat...@gmail.com> wrote:
> Hi All,
> I would like to run iterations until a condition is met. But it runs
> non-stop. What is the problem with the following code? The problem is
> L reaches the value 1.2840277, but the loop still loops and gives
> 1.2840277 over and over. How to I stop it when it reaches to
> 1.2840277?
> Thanks
>
>     ;E1 = Unit vector, known
>     ; Z is  known matrix
>     REPEAT BEGIN
>         C = Z##E1
>         L = sqrt(EC[0]+EC[1])
>         E1 = EC/L
>         print,L
>         ;Keep going until nothing is moved.
>     ENDREP UNTIL L LT 1.2840277
>

L does not change because you are calculating the same thing over and
over again. L only depends on EC[0] and EC[1], and neither changes
when you go through the loop. So if L does not happen to be
<1.2840277, the loop will never end.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why doesn't IDL know the borders of Kazakhstan?
Next Topic: ASSOC vs SHMMAP vs POINT_LUNs vs READ_BINARY?

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

Current Time: Fri Oct 24 11:35:12 PDT 2025

Total time taken to generate the page: 2.32215 seconds