Post Reply 
stack lift and change sign
08-10-2014, 09:48 AM
Post: #1
stack lift and change sign
There was a recent thread where someone pointed to an exercise with the following recursive definition:
\[
u_1=\frac{3}{2} \\
u_{n+1}=\frac{n u_n + 1}{2(n+1)}
\]
For this sequence we can find a closed formula:
\[u_n=\frac{2^{-n}+1}{n}\]

This is the program I came up with:

ENTER
CHS
2
X<>Y
Y^X
1
+
X<>Y
/

Everything went fine with the HP-15c until I tried to calculate \(u_0\). My expectation was to get an error but alas I got different results. Thus I tried to find the reason: it appears that CHS doesn't enable the stack lift if the value in register X is 0.
Huh

All this lead me to the following test-case:

a
ENTER
CHS
b

For a and b I used different values:

a = 7, b = 2
\[\begin{matrix}
Model & X & Y & Z & T \\
35 & -2 & 7 & * & * \\
45 & 2 & 7 & * & * \\
15c & 2 & -7 & 7 & * \\
41c & 2 & -7 & 7 & * \\
\end{matrix}\]

a = 0, b = 2
\[\begin{matrix}
Model & X & Y & Z & T \\
35 & -2 & 0 & * & * \\
45 & 2 & 0 & * & * \\
15c & 2 & 0 & * & * \\
41c & 2 & 0 & 0 & * \\
\end{matrix}\]

It appears that this behavior changed over time in HP-calculators.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
08-10-2014, 11:44 AM
Post: #2
RE: stack lift and change sign
According to your test cases, WP 34S and WP 31S (surprise!) follow the HP-41C.

d:-)

If this post appears delayed, it's only partially my fault Wink
Find all posts by this user
Quote this message in a reply
08-10-2014, 12:14 PM
Post: #3
RE: stack lift and change sign
I'd call this inconsistent behaviour of the 15C a bug. Congrats for finding it!
Find all posts by this user
Quote this message in a reply
08-10-2014, 12:44 PM
Post: #4
RE: stack lift and change sign
(08-10-2014 12:14 PM)Thomas Radtke Wrote:  I'd call this inconsistent behaviour of the 15C a bug.
It's in the 34C as well. What astonishes me is that it was fixed in the 41C but is found in the Voyagers. Yet it is correct in the 12C.
Find all posts by this user
Quote this message in a reply
08-10-2014, 01:27 PM
Post: #5
RE: stack lift and change sign
(08-10-2014 12:44 PM)Thomas Klemm Wrote:  Yet it is correct in the 12C.

I tried your two test cases on a HP 12C Platinum (25th Anniversary Edition), but it turns out that it behaves like the 45, e.g. no stack lift at all and no sign change.
Find all posts by this user
Quote this message in a reply
08-10-2014, 01:50 PM (This post was last modified: 08-11-2014 01:47 AM by Katie Wasserman.)
Post: #6
RE: stack lift and change sign
(08-10-2014 12:44 PM)Thomas Klemm Wrote:  
(08-10-2014 12:14 PM)Thomas Radtke Wrote:  I'd call this inconsistent behaviour of the 15C a bug.
It's in the 34C as well. What astonishes me is that it was fixed in the 41C but is found in the Voyagers. Yet it is correct in the 12C.

It's correct on the 10C, broken on the 11C and correct on the 16C in integer mode but not in floating point mode. It's correct on the 32sii, broken on the 12C platinum 25th AE. I'm don't feel like spending the next hour testing more calculators, clearly there's not a point in time when this changed, rather something that was never tested nor thought about much.

The fact that it depends on the mode of the 16C I find particularly disturbing. This was an extremely carefully engineered calculator. To me this means that one should never count on the stack lift working (or not) after a CHS.

-katie

Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2014, 02:00 PM (This post was last modified: 08-10-2014 02:11 PM by Sylvain Cote.)
Post: #7
RE: stack lift and change sign
(08-10-2014 12:44 PM)Thomas Klemm Wrote:  
(08-10-2014 12:14 PM)Thomas Radtke Wrote:  I'd call this inconsistent behaviour of the 15C a bug.
It's in the 34C as well. What astonishes me is that it was fixed in the 41C but is found in the Voyagers. Yet it is correct in the 12C.

My 12C’s and 10C’s gives me 3 values
My 11C’s and 15C’s gives me 2 values
My 16C's gives me 3 values in decimal mode and 2 values in float mode !!!

Sylvain

PS: sorry double post, Katie was faster than me.
PPS: I have only tested the 1980's Voyagers not the recent ones (12C's & 15C)
Find all posts by this user
Quote this message in a reply
08-11-2014, 01:41 AM
Post: #8
RE: stack lift and change sign
(08-10-2014 01:50 PM)Katie Wasserman Wrote:  The fact that it depends on the mode of the 16C I find particularly disturbing. This was an extremely carefully engendered calculator. To me this means that one should never count on the stack lift working (or not) after a CHS.

I suspect that CHS in integer mode on the 16C got a great deal of attention because of the differences between unsigned, one's complement (which has both +0 and -0) and two's complement notation. On the other hand, I expect that the floating point code for the 16C was simply grabbed from the other Voyagers.

--- Les
[http://www.lesbell.com.au]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-11-2014, 06:08 AM
Post: #9
RE: stack lift and change sign
(08-10-2014 11:44 AM)walter b Wrote:  According to your test cases, WP 34S and WP 31S (surprise!) follow the HP-41C.

d:-)

If this post appears delayed, it's only partially my fault Wink


No Walter; the delay in posting this is all your fault. We are all welcome guests here. We all need to remember that and talk civilly to and about the other folks here. All of them and each time. Winky smiley faces do not fix this problem.

BTW: I do not see where Thomas mentioned the WP 31s or the incredible WP 34s in his test cases. You are correcting him for something he didn't claim.
Find all posts by this user
Quote this message in a reply
08-11-2014, 06:21 AM (This post was last modified: 08-11-2014 06:22 AM by Paul Dale.)
Post: #10
RE: stack lift and change sign
(08-11-2014 06:08 AM)Den Belillo (Martinez Ca.) Wrote:  BTW: I do not see where Thomas mentioned the WP 31s or the incredible WP 34s in his test cases. You are correcting him for something he didn't claim.

There was no need to correct anything. The 31S and 34S get this right.

At least for some definition of right Big Grin

Oh, and stack lift is an abomination bred from miniscule memory sizes Smile


- Pauli
Find all posts by this user
Quote this message in a reply
08-11-2014, 06:23 AM
Post: #11
RE: stack lift and change sign
(08-11-2014 06:21 AM)Paul Dale Wrote:  
(08-11-2014 06:08 AM)Den Belillo (Martinez Ca.) Wrote:  BTW: I do not see where Thomas mentioned the WP 31s or the incredible WP 34s in his test cases. You are correcting him for something he didn't claim.

There was no need to correct anything. The 31S and 34S get this right.

At least for some definition of right Big Grin


- Pauli

And of course, as my tagline implies, "left is right and right is wrong"
Big Grin

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
08-11-2014, 06:44 AM
Post: #12
RE: stack lift and change sign
Seriously though, getting the stack lift behaviour sensible was a huge effort. I honestly wouldn't be surprised in Marcus and I missed something here.

With a command line input that doesn't destroy X, there really isn't any need to play stack lift games apart from backwards compatibility.


- Pauli
Find all posts by this user
Quote this message in a reply
08-27-2014, 11:30 AM
Post: #13
RE: stack lift and change sign
(08-11-2014 06:08 AM)Den Belillo (Martinez Ca.) Wrote:  
(08-10-2014 11:44 AM)walter b Wrote:  According to your test cases, WP 34S and WP 31S (...) follow the HP-41C.

I do not see where Thomas mentioned the WP 31s or the incredible WP 34s in his test cases. You are correcting him for something he didn't claim.

As you can read, I posted an additional information. I do not comprehend where you detected a correction.

d:-?
Find all posts by this user
Quote this message in a reply
08-27-2014, 02:32 PM
Post: #14
RE: stack lift and change sign
(08-27-2014 11:30 AM)walter b Wrote:  
(08-11-2014 06:08 AM)Den Belillo (Martinez Ca.) Wrote:  I do not see where Thomas mentioned the WP 31s or the incredible WP 34s in his test cases. You are correcting him for something he didn't claim.

As you can read, I posted an additional information. I do not comprehend where you detected a correction.

d:-?

Yes Walter; i can read. I can read that you have been getting agitated again.

I can read that two and a half weeks ago- you were trying to start your usual childish garbage with Thomas while taking a poke at me. Now you are dredging up the exact same finished thread. Again.
I have to work today. You have about 9 hours to rant and crow till i get home and sign in this evening. If you have taunted Massimo one more time, if you have tried to start a flame war with Thomas again, if there is one more thinly veiled troll from you towards anyone; you will be taking another "time out" from the board.

Way too many of your over one thousand posts contain little more than "nanny nanny nanny goat".
Find all posts by this user
Quote this message in a reply
08-27-2014, 03:57 PM (This post was last modified: 08-27-2014 04:05 PM by walter b.)
Post: #15
RE: stack lift and change sign
(08-27-2014 02:32 PM)Den Belillo (Martinez Ca.) Wrote:  I can read that you have been getting agitated again.

I can read that two and a half weeks ago- you were trying to start your usual childish garbage with Thomas while taking a poke at me. Now you are dredging up the exact same finished thread. Again.
I have to work today. You have about 9 hours to rant and crow till i get home and sign in this evening. If you have taunted Massimo one more time, if you have tried to start a flame war with Thomas again, if there is one more thinly veiled troll from you towards anyone; you will be taking another "time out" from the board.

Way too many of your over one thousand posts contain little more than "nanny nanny nanny goat".

??? ???

d:-?

(I thought I'd understand a little bit of English so far, but that's beyond my decoding limits. Sorry.)
Find all posts by this user
Quote this message in a reply
08-27-2014, 06:41 PM
Post: #16
RE: stack lift and change sign
(08-27-2014 02:32 PM)Den Belillo (Martinez Ca.) Wrote:  You have about 9 hours to rant and crow till i get home and sign in this evening. If you have taunted Massimo one more time, if you have tried to start a flame war with Thomas again, if there is one more thinly veiled troll from you towards anyone; you will be taking another "time out" from the board.

Come on Den, "taunted" is really too much. :)
We are only going on, teasing each other for our respective preferences, but no offence taken and - hopefully - given.

But I understand this is a little childish, so I will stop (at least for some time ;) ) if this can contribute to our peaceful life here.

All we are saying is give peace a chance...

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
08-27-2014, 07:40 PM
Post: #17
RE: stack lift and change sign
(08-27-2014 06:41 PM)Massimo Gnerucci Wrote:  
(08-27-2014 02:32 PM)Den Belillo (Martinez Ca.) Wrote:  You have about 9 hours to rant and crow till i get home and sign in this evening. If you have taunted Massimo one more time, if you have tried to start a flame war with Thomas again, if there is one more thinly veiled troll from you towards anyone; you will be taking another "time out" from the board.

Come on Den, "taunted" is really too much. Smile
We are only going on, teasing each other for our respective preferences, but no offence taken and - hopefully - given.

But I understand this is a little childish, so I will stop (at least for some time Wink ) if this can contribute to our peaceful life here.

All we are saying is give peace a chance...

+1 for peace ... Den, you didn't answer and regard my last PM to you. I'm fearing this is caused by misunderstanding some posts in this thread, maybe because of bad experiences in the past. Let's keep the spirit of this wonderful forum free.

Andreas
Find all posts by this user
Quote this message in a reply
08-28-2014, 12:18 PM
Post: #18
RE: stack lift and change sign
HP30B gives only two values:

2 -7 * *
2 0 * *
Find all posts by this user
Quote this message in a reply
08-28-2014, 02:21 PM
Post: #19
RE: stack lift and change sign
(08-28-2014 12:18 PM)ElectroDuende Wrote:  HP30B gives only two values:

2 -7 * *
2 0 * *
The 20b/30b calculators offer an additional entry line different from the x-register (like in the G-models) and so eliminate the need for fancy stack lifting tricks. Maybe this was a good move.
Find all posts by this user
Quote this message in a reply
08-28-2014, 08:07 PM
Post: #20
RE: stack lift and change sign
(08-28-2014 02:21 PM)Thomas Radtke Wrote:  The 20b/30b calculators offer an additional entry line different from the x-register (like in the G-models) and so eliminate the need for fancy stack lifting tricks. Maybe this was a good move.

We were discussing this here for the 34S ad nauseam. The majority of the forum members participating in the discussion wanted the "classic" behavior of ENTER, not the command line variant implemented by the 20b/30b and the RPL machines. I feel the latter to be more intuitive than the former.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: