
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I cant get my loop to stop.
My loop is a circular equation that does interations.
When the "previous" answer only differs from the "new" by .0000001 as it goes through the loop over and over, then I want the program to stop.
Unfortuntly it keeps going repeating 1.40274 which is the correct answer but I want it stop. The correct answer given my current B1 and B2 stops on 1.40274 which is the correct answer.
I want it to stop though based on the difference of .0000001. (My B1, and B2 numbers may change in the future.)
Unfortuantly it just keeps printing the answer over and over.
Anyone know how I can make it stop given my specification? (if you test my code the way it is you have to hit esc to make it stop)
I should clarify though that the answer is repeating itself because it it continuing to interate. So I need to make stop that when my specification become true namely the difference of .0000001.
--Thanks
ResetMaxFile #noPrompt B1 = .205635 B2 = 1.2 B3 = 0 while B3 >= 0 do ( B3 = B2+(B1 * sin (B3 * 180/pi)) print B3 if B3 < .0000001 then exit )
Solved! Go to Solution.