HP Forums

Full Version: ISG/DSE behavior
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.