Page 1 of 2

First Entry into Matrix Pushes Stack

Posted: Fri Mar 09, 2018 10:58 pm
by Epidiah
I'm not sure if this is the expected behavior or not, but when I open a matrix with EDIT or EDITN, if I try to key in a number before using the arrow menu keys, it pushes the old entry into the stack.

If I use an arrow menu key first to move to a neighboring entry, then key in the number just replaces the current one and nothing is pushed into the Y register.

For example, if I fill the stack with 2s, open the matrix menu, and press NEW, I get this:

T: 2
Z: 2
Y: 2
X: [ 2x2 Matrix ]

Then I press EDIT, it looks like this:

1:1=0
T: 2
Z: 2
Y: 2
X: 0

Which is to be expected. If I key in 42 for my first entry, the 0 in X is pushed to Y.

1:1=42
T: 2
Z: 2
Y: 0
X: 42

Then I right arrow over to 1:2, where there's another 0 waiting for me. I key in 17 there and the 0 is just overwritten, not pushed into the stack the previous one.

1:2=17
T: 2
Z: 2
Y: 0
X: 17

I see the same pushing behavior after I use the GOTO command within the matrix. Once I use an arrow to navigate the matrix, the pushing stops, but if I use GOTO it'll start again.

So I was just checking in to see if that's how it's supposed to behave. It seems odd to me changes like that, but I'm still trying to find my way around this machine.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 12:48 am
by Thomas Okken
Epidiah wrote:
Fri Mar 09, 2018 10:58 pm
So I was just checking in to see if that's how it's supposed to behave. It seems odd to me changes like that, but I'm still trying to find my way around this machine.
It is not supposed to behave like that; that's a bug. Or two bugs, actually. :D

Things are a bit chaotic around here because of the aftermath of the storm (seriously, America, put your power lines underground already!), but I'll fix that in the next release, when I can.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 1:54 am
by Epidiah
Two for one! Score!

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 9:07 am
by Thomas Okken
Fixed in 2.0.18, out now for Android, Windows, MacOS, and Linux. And for iOS today or tomorrow, if recent experience is anything to go by.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 5:01 pm
by whuyse
In the 42S, EDIT enables stack lift, GOTO disables it, as do the four arrow commands.
So there was only one bug, the GOTO behaviour?
Werner

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 5:37 pm
by Thomas Okken
whuyse wrote:
Sat Mar 10, 2018 5:01 pm
In the 42S, EDIT enables stack lift, GOTO disables it, as do the four arrow commands.
So there was only one bug, the GOTO behaviour?
Werner
Hmm, on closer inspection, EDIT enables stack lift, and EDITN disables it. I could have sworn when I checked this yesterday that they both disabled it. I guess I was hallucinating. :|

Update: no, wait, it's even weirder. EDIT preserves the existing stack lift status. Hmm, and that's exactly what my old code did.

So, in fixing EDITN, I introduced a bug in EDIT. Although I wonder if I should just leave it the way it is now, since it's the original calculator's behavior that's weird to the point of seeming buggy. I certainly can see no advantage to the way it behaves.

Further update: well, except I can't rule out that there might be programs that rely on this behavior, or work around it if you will, and would break with this more consistent behavior. I guess I should roll back the EDIT change, then. Aaargh.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 6:11 pm
by toml_12953
Thomas Okken wrote:
Sat Mar 10, 2018 5:37 pm
whuyse wrote:
Sat Mar 10, 2018 5:01 pm
In the 42S, EDIT enables stack lift, GOTO disables it, as do the four arrow commands.
So there was only one bug, the GOTO behaviour?
Werner
Hmm, on closer inspection, EDIT enables stack lift, and EDITN disables it. I could have sworn when I checked this yesterday that they both disabled it. I guess I was hallucinating. :|

Update: no, wait, it's even weirder. EDIT preserves the existing stack lift status. Hmm, and that's exactly what my old code did.

So, in fixing EDITN, I introduced a bug in EDIT. Although I wonder if I should just leave it the way it is now, since it's the original calculator's behavior that's weird to the point of seeming buggy. I certainly can see no advantage to the way it behaves.

Further update: well, except I can't rule out that there might be programs that rely on this behavior, or work around it if you will, and would break with this more consistent behavior. I guess I should roll back the EDIT change, then. Aaargh.
If you ask me (I know you didn't but that's never stopped me) when you have a choice, always go for the behavior of the original even if it's buggy.

Omnis Convenientiae! Kompatibilität über alles!

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 6:18 pm
by Thomas Okken
toml_12953 wrote:
Sat Mar 10, 2018 6:11 pm
If you ask me (I know you didn't but that's never stopped me) when you have a choice, always go for the behavior of the original even if it's buggy.
As a general rule, yes, although I have made exceptions, when there really doesn't seem to be any need for bug compatibility. Free42 does not have the 42S' PERM and COMB bugs, for example.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 6:54 pm
by Epidiah
Sorry to cause all this trouble. Unfortunately, I don't have 42S to compare it to. I had to depend on the kindness of you good strangers. :D

So, on the original 42S, the EDIT function is the odd one out? That is EDITN, GOTO and all the arrows disable attack lift, but EDIT preserves it?

Now I'm rather curious if it was deliberately designed that way, and for what reason. It seems easier to depend on trusty old ENTER to enable stack lift whenever you need it than to remember in this one specific case you need to rely on CLX or perhaps flag 30 to disable it if you don't want it. I mean, I'll commit it to heart either way. It's just not clear to me what the intention was.

Re: First Entry into Matrix Pushes Stack

Posted: Sat Mar 10, 2018 7:04 pm
by Thomas Okken
Epidiah wrote:
Sat Mar 10, 2018 6:54 pm
Now I'm rather curious if it was deliberately designed that way, and for what reason.
We'll probably never know for sure, but the way EDIT handles stack lift is so weird I'm sure it's a bug. And, while I generally don't reproduce bugs, this one can easily affect how programs are written, so this behavior should be the same in Free42.