# HP Forums

Full Version: stack lift and change sign
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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.

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
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
I'd call this inconsistent behaviour of the 15C a bug. Congrats for finding it!
(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.
(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.
(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.
(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)
(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.
(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

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.
(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

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

- Pauli
(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

- Pauli

And of course, as my tagline implies, "left is right and right is wrong"
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
(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:-?
(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".
(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.)
(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...
(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.
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...

+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
HP30B gives only two values:

2 -7 * *
2 0 * *
(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.
(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.
Pages: 1 2 3
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :