A 12CP bug?


Sorry if this is old news but I've just noticed this strange behavior when entering negative numbers in the 12CP, for instance, the following keystrokes sequence returns 6 rather than -6 we would expect in the older 12C:

 Keystroke   Display

2 2.
ENTER 2.00
CHS -2.00
3 3.
* 6.00 ???

Ok, we can key in 2 CHS ENTER 3 * instead to get -6, but the manual states in page 17:

"To make a displayed number negative - either one that has just been keyed in or one that has resulted from a calculation - simply press CHS (change sign) _."
Well, they don't say anything about numbers that have just been entered...


Good catch, but there are several versions of the 12cp out there.

Can you tell us which version it is?

Arbitrary version numbers shown below (these are not HP versions, just my classifications):

Version 1: The 12cp without parentheses that takes forever to solve IRR problems and a long time for solving for the interest rate.

Version 2: The 12cp with parentheses that has the IRR and interest rate solving bugs fixed.

Version 3: The 12cp Prestige Brazilian edition.

Version 4: The 12cp 25th anniversary edition that has improved speed for solving TVM problems.

I can confirm it works in this unexpected way on version 3 and 4, which I have here at home.

What is the serial number of the 12cp showing this behavior?

Edited: 23 July 2006, 10:03 p.m.


Sorry, I should have provided some information:

That's the HP 12c 25th Anniversary Edition, serial # CNA 62005321.




Yep, that's the same as what I noticed.

I'll check versions 1 and 2 of the 12cp tomorrow and report back.

Good news as such is that this is unlikely IMO to show up in well written programs. In fact, I can't remember ever seeing a sequence like 2 ENTER CHS 3 x in a program before. :-)

Hope not!


In fact, I can't remember ever seeing a sequence like 2 ENTER CHS 3 x in a program before. :-)

Actually I did not observe this in a program. I was testing my trigs program below with negative arguments as I just had made a change so as ACOS worked in the range [-1..0]. ASIN and ACOS were ok but when I cheked ATAN I obtained wrong results. At first I thought it was a bug in my own program. However this had not shown up in an equivalent program I had written for the HP-15C. Besides I had made no changes in the ATAN routine. It took a while to find the problem. Fortunately, it was just another 12CP bug...

Do I apply for a replacement when they fix that or perhaps they just don't consider this a bug anyway? :-)

This is what I was testing:

Keystrokes          Display

1 EEX 7 1. 07
ENTER 10,000,000.00
CHS -10,000,000.00
g GTO 102 R/S 89.99999427 This was supposed to return atan(-10,000,000).
The calculator returns atan(10,000,000) instead.

In this case, the best sequence would be:
Keystrokes          Display

1 CHS EEX -1. 00
7 -1. 07
g GTO 102 R/S -89.99999427 Ok!

This requires one keystroke less and returns the right result. But the first method should be expected to work because the calculator is actually displaying a negative number just before running the program.

Best regards,



In fact, I can't remember ever seeing a sequence like 2 ENTER CHS 3 x in a program before. :-)

It turns up twice in an HP41 program I use all the time under HP42s or Free42.

The program computes the error function erf(x) and its complement erfc(x) = 1 - erf(x). It first computes one, then duplicates it with ENTER, then with CHS 1 + computes the other. This leaves the result and complement result in the X and Y registers to be viewed one or the other with X<>Y, or in the HP42S both are visible on the 2 line display.

This sequence wouldn't work on an HP12Cp given how CHS actually disables stack lift. Whether this is a feature or a bug is a matter of debate, I am sure.



For my last comment to make sense I should indicate that the "bug" affects not only directly entered input, but also a result left in the X register by virtue of a calculation, thus:

25 ENTER 100 / ENTER CHS 1 + gives 1.25, whereas I want 0.75.

I think the issue has to do with the fact that the hp12cp classifies CHS not as a unary operator, like most RPN calcs seem to when dealing with already-entered material in the X-register, but a digit entry key along with the decimal point, the digits, and EEX. My user's guide states in a footnote on p. 230, "although the stack lifts after ENTER is pressed, it does not lift after a number is entered after ENTER is pressed." I think the HP12cp regards the CHS as equivalent to digit entry--indeed at the top of that same page CHS is listed as a digit entry key.

How does the "classic" HP12c treat this issue? An where is Katie Wasserman or Tony(nz)? I am surprised they haven't sounded in on this one. ;)



With my "classic" 12C (and my 16C too, for that matter)

25 ENTER 100 / ENTER CHS 1 +
returns 0.75, as does
25 ENTER 100 / CHS 1 +
With the RPL models, CHS is the NEG command, invoked by the [+/-]
25 100 / NEG 1 + returns .75
What does your 12cp return for
25 ENTER 100 / CHS ENTER 1 +


It gives 0.75.


I think I have version 2--parentheses, does okay for IRR and INT solutions.

SN# 61201412

It's got the bug.



This excellent simulator does NOT have the bug:


For some reason in the culprit HP12Cp the CHS not followed by ENTER or something else disables stack lift, so the X register is merely overwritten. Grrrrrrrr....



Just for the fun of it I tried the program on my red LED models (25C, 31E, and 67) and the bug showed up of all places on the 25C!



I guess it is not a bug, but rather an unspecified keystroke sequence for RPN. I always thought of ENTER as "Enter terminates the number entry". So after the number is entered, there is the question which operand CHS takes: The number you just entered, or the next number you will enter? Since the latter might cause some confusion, HP could either ignore the CHS-keystroke, or make it execute on the last entered number.

An interesting question: what are the contents of LASTX?


Lastx is 3 as expected.


Correction. There is NO bug in the 25C on this issue. The Owner's Handbook clearly states on page 111 that a number keyed in following CHS does not affect the stack in other words it overwrites it.


Possibly Related Threads…
Thread Author Replies Views Last Post
  38E/C, 12C, 12CP date arithmetic bug Katie Wasserman 26 5,678 10-19-2011, 08:57 PM
Last Post: Miguel Toro
  12c+ vs 12cp Erturk Kocalar 7 2,209 03-08-2011, 11:32 AM
Last Post: Marcus von Cube, Germany
  10bII, 12c, 12cp, 17b2+ ... these are the ones I see...Poll...how about you? Gene Wright 23 5,042 05-30-2010, 09:14 AM
Last Post: Don Shepherd
  Gamma (and Factorial) for 12C/12CP Les Wright 9 2,747 02-02-2009, 06:18 PM
Last Post: Egan Ford
  Gamma and Factorial for 10C/12C/12CP (thread hijack) Les Wright 1 1,022 01-28-2009, 08:19 PM
Last Post: Egan Ford
  Received new 12CP Anniversary Edition today, but... Stephen Easterling 6 1,845 04-22-2008, 12:28 PM
Last Post: Stephen Easterling
  What will replace the 25th anniversary HP 12cp? mk 5 1,529 03-31-2007, 05:23 PM
Last Post: Namir
  12CP shortcomings? Jim Creybohm 5 1,654 01-23-2007, 08:05 AM
Last Post: Jeff O.
  Geometric mean and std. dev. on 12C or 12CP mk 2 1,139 12-12-2006, 11:02 PM
Last Post: Katie Wasserman
  Fast & Accurate Trigs (12CP) - Improved Version Gerson W. Barbosa 2 1,263 12-09-2006, 10:26 PM
Last Post: Gerson W. Barbosa

Forum Jump: