Post Reply 
Free42 NSTK ENTER behavior
03-19-2021, 04:43 PM
Post: #21
RE: Free42 NSTK ENTER behavior
(03-19-2021 01:40 PM)fqz Wrote:  Since the topic of emulating RPL behavior was mentioned, I'm curious, does anyone have an example off-hand of an RPL calculator that enters input directly onto the "1:" level of the stack instead of an intermediate, anonymous input buffer?

That's what NSTK does, which is already a sort of odd hybrid I think, but admittedly it is unlikely to cause any change in practical behavior as opposed to the [ENTER] mapping, especially on a calculator like Free42 that doesn't support program entry in the main mode.

What NSTK does, in terms of number entry, is really the same as what 4STK does, which in turn is the same as what all the HP RPN calculators do: numbers are entered directly into the X register. There is no separate input buffer, because the three kinds of things you can enter (numbers, ALPHA strings, and programs) each have their own dedicated storage areas and their own separate input modes.

The weird hybrid aspect comes from the fact that the way ENTER behaves on RPN calculators, designed to allow filling the stack easily, doesn't make sense with the dynamic stack. It makes more sense to have ENTER terminate number entry without duplicating X, leading to the same result as pressing ENTER to terminate number entry on an RPL calculator. And to complete the illusion, backspacing all the way executes DROP, so you're left with the stack in the same state it was in before, also like on an RPL calculator.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-15-2021, 06:01 PM (This post was last modified: 10-16-2021 02:17 AM by squid2.)
Post: #22
RE: Free42 NSTK ENTER behavior
Reviving an old thread, but I like the behaviour of ENTER in the NSTK mode and find it more intuitive than the standard HP42 4STK ENTER behaviour. ENTER completing data entry if in progress, or duplicating when no data entry is in progress is the behaviour I naturally expect. I'd love NSTK mode and its more intuitive ENTER behaviour to become the default, and 4STK can be renamed legacy compatibility / old curmudgeon mode Wink. I suppose that would break out-of-the-box HP-42S compatibility though. Would just be nice for NSTK mode to be more accessible to newcomers without having to dig deep through menus to enable sensible behaviour that ought to be the default if strict HP-42S compatibility weren’t the goal.

As an example of why 4STK mode is a bad default (HP-42S compatibility aside), try evaluating (1+2)(3+4) + (5+6)(7+8) in 4STK mode. This looks like a very simple elementary school level calculation. You would enter 1 ENTER 2 + 3 ENTER 4 + * 5 ENTER 6 + 7 ENTER 8 + * +. You'd get the correct result of 186 in either 4STK or NSTK mode, but in 4STK mode, you'd have a leftover 21 on the stack due to running out of stack space and quirks of the 4STK ENTER behaviour. Situations needing more than 4 stack levels are also not uncommon (eg. see post 10 by Walter here: https://forum.swissmicros.com/viewtopic....1&start=10).
Find all posts by this user
Quote this message in a reply
10-16-2021, 08:24 AM
Post: #23
RE: Free42 NSTK ENTER behavior
(10-15-2021 06:01 PM)squid2 Wrote:  I'd love NSTK mode and its more intuitive ENTER behaviour to become the default, and 4STK can be renamed legacy compatibility / old curmudgeon mode Wink. I suppose that would break out-of-the-box HP-42S compatibility though.

It would break out-of-the-box 42S compatibility... and that's not acceptable as far as I'm concerned. There are people who use Free42 to run legacy HP-42S programs, and they would run into all sorts of problems if NSTK were the default. I've had bug reports from users like that over much smaller compatibility issues. And I don't mean people being fussy, but people getting outright wrong behavior and having no idea why.

It is debatable whether or not the "Allow Big Stack (NSTK) mode" setting in the app preferences is really necessary, but making NSTK the default would be a bridge too far, I think.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-16-2021, 08:32 AM
Post: #24
RE: Free42 NSTK ENTER behavior
(10-15-2021 06:01 PM)squid2 Wrote:  .. in 4STK mode, you'd have a leftover 21 on the stack due to running out of stack space and quirks of the 4STK ENTER behaviour.

That is no quirk but well documented, wanted and correct behaviour of RPN. It is based on the function of the T-register and is explained in almost every RPN documentation. You can find this explained in detail e.g. in the manual of the HP35 (from 1972) and in the manual of a brand new HP-12C Platinum from 2021.

My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C
Find all posts by this user
Quote this message in a reply
10-16-2021, 12:29 PM (This post was last modified: 10-16-2021 02:31 PM by squid2.)
Post: #25
RE: Free42 NSTK ENTER behavior
(10-16-2021 08:24 AM)Thomas Okken Wrote:  
(10-15-2021 06:01 PM)squid2 Wrote:  I'd love NSTK mode and its more intuitive ENTER behaviour to become the default, and 4STK can be renamed legacy compatibility / old curmudgeon mode Wink. I suppose that would break out-of-the-box HP-42S compatibility though.

It would break out-of-the-box 42S compatibility... and that's not acceptable as far as I'm concerned. There are people who use Free42 to run legacy HP-42S programs, and they would run into all sorts of problems if NSTK were the default. I've had bug reports from users like that over much smaller compatibility issues. And I don't mean people being fussy, but people getting outright wrong behavior and having no idea why.

It is debatable whether or not the "Allow Big Stack (NSTK) mode" setting in the app preferences is really necessary, but making NSTK the default would be a bridge too far, I think.

Understandable, since full out-of-the-box HP-42S compatibility is a goal of the project. As you mentioned, the option to hide NSTK mode is probably unnecessary, though on the other hand I discovered NSTK mode by seeing it mentioned in the settings (leading me to search for what it is and how to enable it).
Find all posts by this user
Quote this message in a reply
10-16-2021, 01:07 PM
Post: #26
RE: Free42 NSTK ENTER behavior
(10-16-2021 08:32 AM)Peet Wrote:  
(10-15-2021 06:01 PM)squid2 Wrote:  .. in 4STK mode, you'd have a leftover 21 on the stack due to running out of stack space and quirks of the 4STK ENTER behaviour.

That is no quirk but well documented, wanted and correct behaviour of RPN. It is based on the function of the T-register and is explained in almost every RPN documentation. You can find this explained in detail e.g. in the manual of the HP35 (from 1972) and in the manual of a brand new HP-12C Platinum from 2021.

Sure, the 4-element stack and duplication of the T register are documented in HP manuals, and programs could be written to expect and depend on this behaviour. It’s just not the behaviour you’d naturally expect when you are taught RPN as something based on a stack (without an explicit depth limit) rather than based on four named registers with duplication of the T register on drops. Situations needing a stack depth greater than 4 are quite commonplace and mundane; they can be dealt with using storage, but it’s extra cognitive burden to keep track of stack depth and know if it’s about to fill up. Likewise, duplication of the fourth element of the stack on drops is not something you’d expect from a stack, it’s rather a quirk/feature of HP’s four register notation.

I think the reason I feel this way (compared to old timers like Peet) is that I haven’t been using classic HP 4-register “stack” based calculators for 40+ years. HP switched to an “unlimited depth” (normal to me) stack in RPL machines years before I was born, and I was taught RPN as being based on a stack rather than four registers. I’ve been using Free42 for a few years, though the stack depth limit and T register behaviour has kept tripping me up once in a while when I need to calculate something requiring full or extra stack depth. I was really pleased to discover NSTK mode yesterday as it works the way (stack-based) RPN is supposed to work, 1970s hardware limitations aside.
Find all posts by this user
Quote this message in a reply
10-16-2021, 03:32 PM (This post was last modified: 10-16-2021 03:42 PM by Peet.)
Post: #27
RE: Free42 NSTK ENTER behavior
(10-16-2021 01:07 PM)squid2 Wrote:  I think the reason I feel this way (compared to old timers like Peet) is that I haven’t been using classic HP 4-register “stack” based calculators for 40+ years. HP switched to an “unlimited depth” (normal to me) stack in RPL machines years before I was born, and I was taught RPN as being based on a stack rather than four registers.

Not only an other argumentum ad hominem, also again fictitious facts. Not exactly a base for an objective discussion.
FYI: The first HP Calculator with "entry RPN" (big stack) was the HP-28c (1987). In the current Line-up HP has 4 RPN Calculators. 3 with "classic" and only one with "entry" RPN.

My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C
Find all posts by this user
Quote this message in a reply
10-16-2021, 04:03 PM (This post was last modified: 10-16-2021 04:06 PM by squid2.)
Post: #28
RE: Free42 NSTK ENTER behavior
(10-16-2021 03:32 PM)Peet Wrote:  
(10-16-2021 01:07 PM)squid2 Wrote:  I think the reason I feel this way (compared to old timers like Peet) is that I haven’t been using classic HP 4-register “stack” based calculators for 40+ years. HP switched to an “unlimited depth” (normal to me) stack in RPL machines years before I was born, and I was taught RPN as being based on a stack rather than four registers.

Wow, not only an other argumentum ad hominem, also fictitious facts. Not exactly a basis for factual discussions.

FYI: The first HP Calculator with "entry RPN" (big stack) was the HP-28c (1987). In the current Line-up HP has 4 RPN Calculators. 3 with "classic" and only one with "entry" RPN.

Sorry, this wasn’t meant to be an attack on you, just explaining my perspective on what I’m used to and what feels intuitive to me. Someone who has been using 4-level RPN for a long time would find the behaviour to be what they expect. I’ve been used to big stacks, and that’s what I learned RPN as.

My point was just that as someone who was taught RPN as something operating on a stack (that can be arbitrarily large) rather than 4STK, the behaviour of NSTK mode is much more intuitive. The original concept of RPN was also based on an arbitrarily deep (and variable depth) stack; the 3 or 4 register “stacks” were done due to hardware limitations of the 60s/70s. It’s easier to work with NSTK since you don’t need to keep track of stack depth and worry about overflowing it (as long as you aren’t being deliberately wasteful). Furthermore, with a big stack, programs and subroutines can freely use the stack without worrying about clobbering the caller’s stack.

I said HP switched to big stack entry RPN in RPL machines before I was born (I was born after 1987). Yes, they haven’t discontinued the 12C which predates 1987, and the 35S is a relatively recent model that still uses 4-level RPN to remain familiar to people used to old calculators, but neither of those are RPL machines.
Find all posts by this user
Quote this message in a reply
10-16-2021, 07:39 PM
Post: #29
RE: Free42 NSTK ENTER behavior
(10-16-2021 12:29 PM)squid2 Wrote:  As you mentioned, the option to hide NSTK mode is probably unnecessary, though on the other hand I discovered NSTK mode by seeing it mentioned in the settings (leading me to search for what it is and how to enable it).

In 3.0.6, I changed it so the "Allow Big Stack (NSTK) mode" switch merely disables the CATALOG -> STK submenu (and 4STK/NSTK in the MODES menu), instead of hiding it. This makes maintaining the menu logic a lot easier, and hopefully it also makes the functions easier to discover. Making people aware of new functionality is always a problem, merely mentioning it in the release notes and on my web site isn't always adequate, it's not reasonable to expect people to keep an eye on those places all the time, so discoverability is important!
Visit this user's website Find all posts by this user
Quote this message in a reply
10-16-2021, 09:09 PM
Post: #30
RE: Free42 NSTK ENTER behavior
(10-16-2021 03:32 PM)Peet Wrote:  
(10-16-2021 01:07 PM)squid2 Wrote:  I think the reason I feel this way (compared to old timers like Peet) is that I haven’t been using classic HP 4-register “stack” based calculators for 40+ years. HP switched to an “unlimited depth” (normal to me) stack in RPL machines years before I was born, and I was taught RPN as being based on a stack rather than four registers.

Not only an other argumentum ad hominem, also again fictitious facts. Not exactly a base for an objective discussion.
FYI: The first HP Calculator with "entry RPN" (big stack) was the HP-28c (1987). In the current Line-up HP has 4 RPN Calculators. 3 with "classic" and only one with "entry" RPN.

Where is he attacking you? The "old timers" comment was just a light-hearted phrase to emphasize that you're older than he is. He wasn't born until after 1987 when the big stack debuted so those of us who were (yes, me too) are old timers in comparison. You should be proud of having lived to old age (over 40). The alternative isn't too pleasant.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
10-16-2021, 09:57 PM
Post: #31
RE: Free42 NSTK ENTER behavior
In German, "Oldtimers" means "vintage cars."

Loanwords sometimes acquire meanings very different from the original ones... Big Grin
Visit this user's website Find all posts by this user
Quote this message in a reply
10-16-2021, 10:12 PM (This post was last modified: 10-16-2021 10:16 PM by Peet.)
Post: #32
RE: Free42 NSTK ENTER behavior
When referring to people in such context, Oldtimer means people who have lost touch with modern developments.

and

(10-15-2021 06:01 PM)squid2 Wrote:  ... 4STK can be renamed ... old curmudgeon mode

is even with a smilie no appropriate style in technical discussions.

But squid2 already said "Sorry, this wasn’t meant to be an attack..." - therefore this topic should be finished..

My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C
Find all posts by this user
Quote this message in a reply
10-17-2021, 08:37 AM
Post: #33
RE: Free42 NSTK ENTER behavior
(10-16-2021 10:12 PM)Peet Wrote:  When referring to people in such context, Oldtimer means people who have lost touch with modern developments.

and

(10-15-2021 06:01 PM)squid2 Wrote:  ... 4STK can be renamed ... old curmudgeon mode

is even with a smilie no appropriate style in technical discussions.

But squid2 already said "Sorry, this wasn’t meant to be an attack..." - therefore this topic should be finished..

In English, "old timer" simply means "old person," there is no negative connotation.
When the writer also uses the phrase "old curmudgeon," it really should be assumed they're writing with a humorous tone. What's inappropriate is for you to just go and assume you are being insulted, and to try to dictate how people should express themselves here. You're not a moderator, you don't get to decide what tone is allowed, nor when the topic you yourself saw fit to raise is finished.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-17-2021, 09:11 AM
Post: #34
RE: Free42 NSTK ENTER behavior
To me, the biggest limitation of the 4STK model is the silent errors introduced into the calculation if you are not aware that you have gone over the limit. You really need to be on your toes when dealing with a deeply nested expressions, planning in advance how to tackle it, and determining whether 4 stack registers is enough. Cheap Casio scientific calculators have a similar (though more generous) limit, but are gracious enough to signal an error when the limit is exceeded. That is impossible with the 4STK model because losing numbers off the top of the stack is part of the normal operation.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
10-17-2021, 03:25 PM
Post: #35
RE: Free42 NSTK ENTER behavior
(10-17-2021 09:11 AM)ijabbott Wrote:  That is impossible with the 4STK model because losing numbers off the top of the stack is part of the normal operation.

Hans Klever gave an excellent presentation at Allschwil 2018 showing how overflow on a 4-stack machine can be caught.

To back it up, he implemented his ideas on a modified HP-35 emulator which can be found here.
Find all posts by this user
Quote this message in a reply
10-17-2021, 07:01 PM
Post: #36
RE: Free42 NSTK ENTER behavior
(10-17-2021 03:25 PM)BruceH Wrote:  
(10-17-2021 09:11 AM)ijabbott Wrote:  That is impossible with the 4STK model because losing numbers off the top of the stack is part of the normal operation.

Hans Klever gave an excellent presentation at Allschwil 2018 showing how overflow on a 4-stack machine can be caught.

To back it up, he implemented his ideas on a modified HP-35 emulator which can be found here.

Nice! The function of the LED seems backward to me, however. I'd like to see a light when an error condition exists and not when everything is normal. I'd reverse the NO to read Overflow and illuminate it when the stack overflowed.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)