ISG/DSE behavior


This is something that has bugged me for a long time, I believe since I bought my 16C back in the 1980’s. It has to do with the behavior of ISG and DSE. Consider the BASIC loop:

For I = 1 to 4

Next I

This corresponds to setting I to 1.004 (on a 33s and, presumably, 35s) and doing the ISG at the end of the loop. The loop executes exactly 4 times, as you would expect.

Now, consider this BASIC loop:

For I = 4 to 1 step –1

Next I

This corresponds to setting I to 4.000 and doing DSE at the end of the loop. You can’t make it 4.001 (which would be consistent with ISG) else it won’t do the last loop iteration you want.

I think that if DSE had been implemented as “DSL”, then ISG and DSL would be consistent and would work as in BASIC. But since DSL has another meaning these days, oh well.

Am I the only person in the world bothered by this? There are times when I wanted to loop down and have the final loop iteration be index 0, but that is not possible without manipulating the index within the loop, and the whole point of ISG/DSE is to not have to do that, right?


DSE evolved from the earlier DSZ, decrement and skip if zero. If the loop counter has no fractional part, then DSE's behavior is consistent with DSZ. ISG was always ISG, I believe. So the inconsistency was built in from the beginning. It doesn't bother me any more than any other primitive programming construct in an RPN calc. I actually enjoy those sort of things. 8)



I think the constructs are derived from assembly language on old minicomputers, not high-level languages like BASIC. Skip on condition code is a common instruction on many older systems. See the PDP-8 for an example.

Possibly Related Threads…
Thread Author Replies Views Last Post
  HP PRIME : strange behavior when trying user key capability Damien 12 3,935 11-03-2013, 11:02 AM
Last Post: Joe Horn
  Prime formatting behavior Camille 0 874 09-28-2013, 05:37 PM
Last Post: Camille
  wp-34s (Inconsistent Behavior) Barry Mead 2 1,349 07-23-2013, 02:54 AM
Last Post: Marcus von Cube, Germany
  HP-41C Tall Keys Strange ON Behavior aj04062 3 1,706 12-02-2012, 06:49 AM
Last Post: aj04062
  Weird behavior from lithium AAs Dave Britten 4 1,596 11-14-2012, 06:22 PM
Last Post: Lars Bergström
  HP15C strange complex number behavior Mike W 5 2,000 09-11-2012, 04:36 PM
Last Post: Mike W
  Curious SINPLOT behavior on HP71B Christoph Giesselink 4 1,696 07-12-2012, 03:12 PM
Last Post: J-F Garnier
  HP 67 and 97 odd behavior- HELP Fouad M. Kaadou 4 1,587 11-23-2011, 12:30 PM
Last Post: Fouad M. Kaadou
  OT weird cursor behavior Martin Pinckney 10 2,886 10-17-2011, 10:54 AM
Last Post: Paul Berger (Canada)
  15C LE - weird self-test behavior Katie Wasserman 0 797 09-19-2011, 11:52 PM
Last Post: Katie Wasserman

Forum Jump: