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 HP-34C/11C/15C/16C response is of an unintended type that H-P eliminated permanently with the Pioneer series. It slipped into the three aforementioned Voyager-series models after the HP-41 debuted, likely due to reuse of ROM code from the HP-34C 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 x-register:
calulator line CHS on post-CHS | CHS on post-CHS
result of zero stack lift | keyed-in zero stack lift
|
HP-34C/11C/15C/16C ignored unchanged | ignored disabled
HP-10C/12C ignored enabled | ignored disabled
HP-41 ignored enabled | ignored disabled
HP-32S/32SII/42S ignored enabled | accepted disabled
"ignored" means that the value is not changed and the negative sign is not displayed.
Regarding "keyed-in zero", one can enter [0][+/-][2][6] on any Pioneer-series 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 (re-enables stack push)
Here's an example for f(x) = xe1-x on the HP-34C/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 HP-15C SOLVE and INTEG, because those built-in functions load the stack with the input argument.
-- KS
Edited: 13 Feb 2007, 1:02 a.m. after one or more responses were posted
|