HP50g small tips and trick
|
06-23-2018, 04:26 PM
Post: #39
|
|||
|
|||
RE: HP50g small tips and trick
(06-23-2018 03:15 PM)pier4r Wrote: Checking if the execution went in a loop. When you have no idea at all how long a program may run, it's usually best to include a counter to track the number of iterations and when it exceeds some threshold, exit with a diagnostic message, e.g. "Exceeded 10,000 iterations". Not all existing programs easily lend themselves to inserting such a counter and test after the fact, but I was taught (long ago) that if you can't track the iterations, the program probably is not written correctly, or at least not optimally. How many iterations to allow is hard to generalize about, as it obviously depends on the nature of your algorithm and data, but one usually has a sense for what should happen. And if not, just insert some number and when it errors out, you can examine the variables to look for convergence, or intermediate results, or whatever you are expecting. --Bob Prosperi |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: