?
Solved

WHILE loop freezes

Posted on 2003-03-14
3
Medium Priority
?
215 Views
Last Modified: 2010-05-18
Hi,
my while loop freezes for some reason unknown to me. I have tested the same loop in an excel spreadsheet and in VBA and it works. I am missing something, not sure why. The code (for an excel add-in) is below:

double dy = fabs(RGWci-RGWI-RGWD+RGWX);
     while (dy>RGWepsilon && (RGWHighS-RGWLowS)>RGWepsilon);
     {
          if((RGWci-RGWI-RGWD+RGWX)<0)
          {
               RGWHighS = RGWI;
          }
          else
          {
               RGWLowS = RGWI;
          }
          RGWI = (RGWHighS+RGWLowS)/2;
          RGWci = *ad_GBS("call","stock",RGWI,RGWX,RGWvol,RGWR,0,(RGWT-RGWt),"value");
          dy = fabs(RGWci-RGWI-RGWD+RGWX);
     }
Any help welcome, thanks.
0
Comment
Question by:decornez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 8135313
>> while (dy>RGWepsilon && (RGWHighS-RGWLowS)>RGWepsilon);

Remove the semi-colon at the end of this line!

Mayank.
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 200 total points
ID: 8135320
In continuity with my last comment - the condition is always remaining true as it is never entering the { .. } block after the while loop but is stopping at the ';' (null statement) and then looping forever as the variables are not being modified at all.

Mayank.
0
 

Author Comment

by:decornez
ID: 8135360
Yes, that was clearly the problem. Thanks a lot, can't believe I missed that ! ahahaha Always good to have another pair of eyes. Well done.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question