WP-34s: Strange programming/stack BUG



#7

Dear WP-34s development team:

I ran into a very strange programming/stack bug in a little program that I was writing. I have tried to boil it down to a simple example. First, the "control" (works as expected) example; enter the following little program:

LBL 'AAA'
ENTER^
END

Now, set your stack to a 4-level stack (I haven't tried it with an 8-level), and do the following:

0
FILL // To fill stack with zeros.
2
XEQ 'AAA'

Then examine the stack using "Rv" (roll-down), to see the expected result:

0  // t
0 // z
2 // y
2 // x

Now, add two extra keystrokes to the problem, which should not change the result at all:

LBL 'AAA'
ENTER^
1 // ADDED STEP: Digit: one.
x // ADDED STEP: Multiplication operator.
END

This *should* yield the same result, in that the value in the 'x' register will be duplicated by the "ENTER^" statement, the values in the 'x' and 'y' will be temporarily moved up to the 'y' and 'z' registers when the "1" is entered, then the multiplication will be performed, and the values will move back down to the 'x' and 'y' registers. *BUT*, that is not what happens!:

0
FILL // To fill stack with zeros.
2
XEQ 'AAA'

And look at the stack using "Rv" (roll-down), to find:

0  // t
0 // z
0 // y <---This register should contain "2"!
2 // x

Thanks for your attention,

Bruce.


#8

That is not a bug, it is correct. My HP-15C and HP-35s do exactly the same (and the 42S probably too). If you do it manually you will get the same (i.e. "2 ENTER" will have 2 in both X and Y, but "2 ENTER 1 x" will have 2 in just X). From this page: "The ENTER key (and CLx which clears the X register) leave the stack in state where it won't automatically lift when the next number is entered. In this case, when the next number is entered it will replace the X register".

The WP-34s also uses this kind of behaviour.

-B


Edit: I was used to RPL calculators (HP-28/48/50 series) when I first got the HP-35s, and it took some getting used to ;-)


Edited: 30 Apr 2012, 3:07 p.m.

#9

Quote:
LBL 'AAA'
ENTER^
1 // ADDED STEP: Digit: one.
x // ADDED STEP: Multiplication operator.
END

ENTER^ disables stack lift so that after ENTER^ 1 the second 2 (in x) is replaced by 1. The multiplication drops the stack so that only the result of the multiplication remains.


#10

Bart and Marcus (and the whole 34s team):

Doh; I'm sorry for the false alarm! Truly embarrassing! <:-/

If the RPL calculators behave differently, then that must be why this seemed wrong to me... But I should have known better. I new about stack-lift disable! I will go and wear a dunce cap in the corner for an hour. ;-)

So sorry,

Bruce.

Edited: 30 Apr 2012, 3:51 p.m.


#11

Quote:
If the RPL calculators behave differently...

Oh YES. And let me not state which is my favourite & why, lest I start an RPB (reverse polish battle) ;-).

#12

No reason to battle about it. RPL is clearly better.

TW


#13

Says the man who fathered* no less than two algebraic-only calculators :-)))

(* he has been known to refer to them as "my baby" ;-))


#14

So, do you mean that there might be a TI mole in the HP calculator group with the aim of depriving us of our beloved RPN calcs? ;)


#15

I read about it back then, but I don't remember the specs. Anyway, I think the HP 50 (not the HP 50g) was RPL.

Gerson.

Edited: 30 Apr 2012, 6:52 p.m.

#16

I second, third and forth that! :-)

Gerson.


#17

Nice! :-)

TW

#18

Please IGNORE this thread! Just my STUPID mistake!


#19

We all solely swore to help each other and anyone else willing to be helped (didn't you? So should you!), and there are moments we need support as well. Don't you think you have already helped many others that will not get into this now, just because of you?

So, thank you for letting us know about this all.

Cheers.

Luiz (Brazil)

Edited: 30 Apr 2012, 5:10 p.m.

#20

No, not stupid at all. Let me tell you that you had the guts to ask when I did not, at the time I started with the 35s three years ago. I just put in extra ENTERs to make copies of a number on the stack, because that's what made it work - only several months later did I get to understand why.


#21

Luiz and Bart:

Thanks, guys! :-)

Bruce.


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34S] Unfortunate key damage with update to V3 :( svisvanatha 5 1,007 12-10-2013, 11:37 PM
Last Post: Les Bell
  WP-34S (Emulator Program Load/Save) Barry Mead 1 553 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  Strange HP 25 Problem (Repair) Onur Ilkorur 5 963 12-06-2013, 05:13 PM
Last Post: Onur Ilkorur
  Strange Battery Icon during updaate of Prime Firmware. Harold A Climer 7 1,232 12-05-2013, 04:40 PM
Last Post: Michael de Estrada
  DIY HP 30b WP 34s serial flash/programming cable Richard Wahl 2 798 12-04-2013, 11:14 AM
Last Post: Barry Mead
  HP 50g - select characters on the stack, copy/paste Sean Freeman 7 997 11-20-2013, 07:11 AM
Last Post: Sean Freeman
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 743 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  emu48 - copy stack doesn't work (as expected) Thomas Radtke 2 745 11-11-2013, 02:19 PM
Last Post: Thomas Radtke
  WP 34S/43 ?'s Richard Berler 3 711 11-10-2013, 02:27 AM
Last Post: Walter B
  My FrankenCulator (wp-34s) FORTIN Pascal 4 735 11-09-2013, 06:18 PM
Last Post: FORTIN Pascal

Forum Jump: