Re: CHS and Stack Lift with zero Message #3 Posted by Karl Schneider on 11 Feb 2007, 4:54 p.m., in response to message #1 by Les Wright
Hi, Les 
Interesting find! (Although I'm sure that it's been found before...)
I'd say that the HP34C/11C/15C/16C response is of an unintended type that HP eliminated permanently with the Pioneer series. It slipped into the three aforementioned Voyagerseries models after the HP41 debuted, likely due to reuse of ROM code from the HP34C for the "advanced" Voyagers. The original thinking may have been, "Ignore any command to negate zero", but such processing may sabotage a program that negates a value that might happen to equal zero.
On all HP RPN (not RPL)based calc's, ENTER disables stack lift. However, there is different behavior in various lines of calculators following CHS with zero in the xregister:
calulator line CHS on postCHS  CHS on postCHS
result of zero stack lift  keyedin zero stack lift

HP34C/11C/15C/16C ignored unchanged  ignored disabled
HP10C/12C ignored enabled  ignored disabled
HP41 ignored enabled  ignored disabled
HP32S/32SII/42S ignored enabled  accepted disabled
"ignored" means that the value is not changed and the negative sign is not displayed.
Regarding "keyedin zero", one can enter [0][+/][2][6] on any Pioneerseries model, and see "026", which is converted to 26.00. On the other ones listed, 26.00 is the result.
Another workaround for the "Spice and Voyager" models that does not disturb the stack is a conditional test:
ENTER
CHS
x=0?
ABS (reenables stack push)
Here's an example for f(x) = xe^{1x} on the HP34C/11C/15C:
program input x result  program input x result

LBL A 0 (erroneous)  LBL A 0 0.000
ENTER 1 1.000  ENTER 1 1.000
CHS 2 0.736  CHS 2 0.736
1  x=0?
+  ABS
e^x  1
*  +
RTN  e^x
 *
 RTN
"erroneous" means that the function will not be calculated properly, so the user cannot generally expect a correct result.
However, this user function will work properly without the workaround using the HP15C SOLVE and INTEG, because those builtin functions load the stack with the input argument.
 KS
Edited: 13 Feb 2007, 1:02 a.m. after one or more responses were posted
