The Museum of HP Calculators

HP Forum Archive 19

 Which calculator passes the first test?Message #1 Posted by Tommy on 1 Dec 2010, 2:15 p.m. First, (-) is the change sign key and (x2) is the square key. If you hit (-) 2 x (-) 2 = the answer is 4 on most calculators. But if you hit (-) 2 (x2) = you probably end up with negative 4. As far as I know, the only non-HP calculator that gives the correct answer is this Sharp . Do you know about any other non-HP, passing this test?What about the algebraic HP10s and SmartCalc300s?/Tommy

 Re: Which calculator passes the first test?Message #2 Posted by Jim Yohe on 1 Dec 2010, 2:34 p.m.,in response to message #1 by Tommy Are you suggesting that HP calculators handle that wrong or that they all do it correctly? My 32SII and 30B both return 4 not -4.

 Re: Which calculator passes the first test?Message #3 Posted by Mark Storkamp on 1 Dec 2010, 2:56 p.m.,in response to message #1 by Tommy I believe -22 is -4. Unless you mean (-2)2, which is 4. It's not clear from what you wrote, what you expect the correct answer to be.

 Re: Which calculator passes the first test?Message #4 Posted by Tommy on 1 Dec 2010, 4:22 p.m.,in response to message #3 by Mark Storkamp All my HP:s gives the correct answer 4, but most calcs gives the wrong answer -4. My question is: What other calcs gives the right answer. Negative 2 squared is +4. /Tommy

 Re: Which calculator passes the first test?Message #5 Posted by Tim Wessman on 1 Dec 2010, 4:40 p.m.,in response to message #4 by Tommy Both wolfram alpha and google disagree. . . Just saying. :-) TW

 Re: Which calculator passes the first test?Message #6 Posted by Tommy on 1 Dec 2010, 5:07 p.m.,in response to message #5 by Tim Wessman Do you suggest that all HP are faulty? :-) Of course, -2^2 is negative 4. But that is not the issue here. I want to know what calcs I can recommend to my students. They receive all kind of random answers when they use the (-) key on their calcs. The Sharp D.A.L is ok in this respect. HP is out of the question here in Sweden. /Tommy

 Re: Which calculator passes the first test?Message #7 Posted by DeboT on 2 Dec 2010, 6:14 a.m.,in response to message #5 by Tim Wessman But when entering on Wolfram Alpha, you use the minus key. Is there an equivalent "change sign"? When using the "change sign" on a calculator, are you not making the negative a part of the characteristic of the number? When using the minus sign, it is equivalent to "0 - number", in which case "0 - number^2" indeed results in a negative answer. Thus the Wolfram Alpha answer is correct, as you are entering a minus, not a "change sign".

 Re: Which calculator passes the first test?Message #8 Posted by Kiyoshi Akima on 1 Dec 2010, 4:58 p.m.,in response to message #4 by Tommy My HP 35s gives "Syntax Error" when I press +/- 2 x^2 ENTER in ALG mode. I can get either -4 or +4, depending on whether I calculate -SQ(2) or SQ(-2).

 Re: Which calculator passes the first test?Message #9 Posted by DeboT on 2 Dec 2010, 6:16 a.m.,in response to message #8 by Kiyoshi Akima Restricting the input to -SQ(2) or SQ(-2) seems a clever way to avoid the controversy :) The 33s in ALG mode: 5, +/-, x2, ENTER yields: ( -5)2= 25 and MINUS, 5, x2, ENTER yields: 0-52= -25 Exactly what I would expect ;) Edited: 2 Dec 2010, 9:41 a.m.

 Re: Which calculator passes the first test?Message #10 Posted by Martin Pinckney on 1 Dec 2010, 5:14 p.m.,in response to message #4 by Tommy Quote: First, (-) is the change sign key and (x2) is the square key. If you hit (-) 2 x (-) 2 = I am still not clear what you mean. Are you talking ALG or RPN calcs? Since you include the = key, I might assume ALG. But I don't understand your notation. You stated that (-) represents the CHS or +/- key. But then in your example, the CHS key precedes the argument, while to my knowledge it always follows the argument, whether ALG or RPN model. And does the "x" in your example represent the multiplication key, or the quantity x? I don't see the square appearing in your example.

 Re: Which calculator passes the first test?Message #11 Posted by Hal Bitton in Boise on 1 Dec 2010, 5:28 p.m.,in response to message #4 by Tommy 4 is the correct answer only if the expression is (-2)^2. -2^2 is (correctly) seen by most calculators as "the negative of 2 squared", or even "negative 1 times 2 squared", which is -4, as exponentiation takes precedence over multiplication, and there no parenthesis to dictate otherwise. On my 50G in algebraic mode, -2^2 = -4 (correct), and (-2)^2 = 4 (also correct), and finally, SQ(-2) = 4 (correct). I must go now and quickly change my 50G back to RPN mode!! Best regards, Hal.

 Re: Which calculator passes the first test?Message #12 Posted by Walter B on 1 Dec 2010, 5:56 p.m.,in response to message #4 by Tommy The good old math standard precedence is "exponentiation > multiplication > addition" (in German: "hoch vor Punkt vor Strich" - we're more concise here :) ), so -2^2 = -4 (if no parentheses are set) regardless of whether you see the unary minus as a multiplication by -1 or something like 0 - ... (-2)^2 is a different cup of tea :)

 Re: Which calculator passes the first test?Message #13 Posted by bill platt on 1 Dec 2010, 8:18 p.m.,in response to message #12 by Walter B English is even more concise: ``` P E M D A S Parenthesis Exponentiation Multiplication & Division Addition & Subtraction ``` I looked at this very problem in detail a few years ago. For most calculators and calculator users, the problem originates with a misunderstanding of the way each machine works and especially what the CHS or +/- key does, as compared to the - key. Some calculators parse a command line. Others operate and never parse. An RPN machine operates, an RPL machine parses. Some ALG or SemiALG machines parse some things but operate with others. **Edit: note that RPL parses when using an Algebraic Object delimited by single quotations. It operates on stack items or a valid command line object** The traditional "Alg" machine (which is better described as infix arithmetic with postfix functions) is an operator not a parser. DAL and SVPAM etc are parsers. Then there are machines which have documented features which may be confusing. The 32sii equation list recognizes a "unary minus" with precedence over exponentiation, but it has a bug when it is in the initial position! See Craig Finseth's HPDatabase. The 33s and 35s eliminated this confusing unary minus feature and they are correctly documented. Then there is the confusion of the fact that some machines have more than one mode, where one mode has a line interpreter but the other operates (e.g. 17bii, 27s, 32sii, 33s, 35s). Some machines will allow the +/- key to work as an operator only, while others allow it to function as a toggling character key. Some machines treat both the - and the +/- as the same thing, others as different things. And then some machines such as the 35s have a "high" minus sign when you push the +/- and a low one with the - even if there is no functional difference.... It is very confusing and totally MACHINE SPECIFIC. I haven't found any machines that are perfect except for the 48G series and descendants, and the pure RPN machines. I haven't looked at the latest Sharp/Casio/Ti so it may be the case that some of them are clearcut now. In RPN, there is never an issue, as there is NO PRECEDENCE because there is only operation, not line interpretation/parsing. [edit: small grammatical error and incorrect reference] Edited: 8 Dec 2010, 8:18 a.m. after one or more responses were posted

 Re: Which calculator passes the first test?Message #14 Posted by Tommy on 2 Dec 2010, 12:38 a.m.,in response to message #13 by bill platt Thank you, Bill, for straighten this out for me! So my question remains: are there any other clear cut non-RPN calcs out there? /Tommy

 Re: Which calculator passes the first test?Message #15 Posted by bill platt on 2 Dec 2010, 7:26 a.m.,in response to message #14 by Tommy Sure. The 20s is very clear cut. I expect that the old 21s and 22s were also clear. I can't speak to the non-hp because I don't have any modern ones in front of me at the moment. I find the 27s clear enough, even though it has two modes. The biggest problem is a lack of care in the use of the tools. When was the last time you saw a student follow RTFM41? Edited: 2 Dec 2010, 7:28 a.m.

 Re: Which calculator passes the first test?Message #16 Posted by Thomas Klemm on 2 Dec 2010, 8:14 a.m.,in response to message #13 by bill platt Quote: And then some machines such as the 35s have a "high" minus sign when you push the +/- and a low one with the - even if there is no functional difference.... In ALG mode I get a SYNTAX ERROR when using the minus-key: ```-2 ``` On the other hand I get the expected result with the +/- key: ```-2 ``` So to me there is a functional difference. Quote: In RPN, there is never an issue, as there is NO PRECEDENCE because there is only operation, not line interpretation/parsing. This is not quiet true as entering a number changes the behaviour of the CHS key. Just think of what happens after the EEX key. There's a peculiar behavior in the HP-35: when the key following the CHS is a number key the negative sign is considered part of this number. So the following example will give 3 instead of -3 what probably most of us would expext: ```5 ENTER CHS 2 + ``` In addition to that the stack doesn't contain 5 in the Y-register. So you could enter negative numbers as you read them. However I think it was a wise decision to change that in later models.

 Re: Which calculator passes the first test?Message #17 Posted by bill platt on 2 Dec 2010, 8:55 a.m.,in response to message #16 by Thomas Klemm Hi Thomas, Thanks for the reply. I don't have an original HP 35--maybe it is a good thing as that would confuse me! (I am a voyager and forward guy). I think I am mixing up the 32sii 33s and 35s wrt the high minus. Indeed the 35s is a completely different animal than even the 33s in how it handles entry and interpretation. As I remember, when in ALG mode, it is a parsing machine, whereas the 33s is an operation machine but with the added feature of a history reporting line that shows how it all comes together. (all three are of course parsers within the equation list mode). Later I'll pull the 33s out and have a look. Unfortunately one of my kids lost the 35s so I can't have a look at it! Edited: 2 Dec 2010, 8:58 a.m.

 Re: Which calculator passes the first test?Message #18 Posted by Walter B on 2 Dec 2010, 9:36 a.m.,in response to message #16 by Thomas Klemm I can confirm this "feature" of the original 35. So I looked what happened to it: HP-35: 5 ENTER CHS 2 + results in 3. HP-45: 5 ENTER CHS 2 + results in 7. So does 55, 65, 80, 21, 22. HP-91: 5 ENTER CHS 2 + results in -3. And so it stays until the 42S. And the "new" calcs including the RPL-machines keep it this way. Interesting :) Edited to add some Woodstocks and the HP-91 as first HP calculating the way we are expecting it today. Anybody having some more Woodstocks at hand for checking? Edited: 2 Dec 2010, 10:07 a.m.

 Re: Which calculator passes the first test?Message #19 Posted by Ken Shaw on 2 Dec 2010, 10:47 a.m.,in response to message #18 by Walter B Interesting. Is the behavior the same if the steps are programmed, rather than from the keyboard? (I know I'm being lazy, but I also don't have most of the models to try it out.)

 Re: Which calculator passes the first test?Message #20 Posted by Ron Ross on 2 Dec 2010, 11:22 a.m.,in response to message #19 by Ken Shaw None of the above calculators are programmable.

 Re: Which calculator passes the first test?Message #21 Posted by Walter B on 2 Dec 2010, 4:19 p.m.,in response to message #20 by Ron Ross Rubbish: the 55 and 65 are. But right now I don't have access to my calcs, so anyone may verify this instead d:-)

 Re: Which calculator passes the first test?Message #22 Posted by Ron Ross on 2 Dec 2010, 4:57 p.m.,in response to message #21 by Walter B I was talking about the three calculators listed, Hp35, Hp45 and the Hp 91. The calculators mentioned were not the focus of the thread that I responded to. Of course the mentioned Hp55, Hp65 and Hp42s are all programmable.

 Re: Which calculator passes the first test?Message #23 Posted by Thomas Klemm on 2 Dec 2010, 12:04 p.m.,in response to message #18 by Walter B Quote: HP-45: 5 ENTER CHS 2 + results in 7. So does 55, 65, 80, 21, 22. It seems the stack isn't lifted after CHS thus -5 is overwritten by the following 2. I consider that a bug: the negative sign shouldn't be silently ignored. Was this already known before?

 5 ENTER CHS 2 + results in 7Message #24 Posted by Walter B on 3 Dec 2010, 1:42 p.m.,in response to message #23 by Thomas Klemm Quote: It seems the stack isn't lifted after CHS thus -5 is overwritten by the following 2. That's my guess, too. Still I don't have any information about the history of this "feature" (see my previous post) beyond the fact that it was dropped apparently early in 1976. Anyone of the old experts knowing something about the circumstances?

 Re: 5 ENTER CHS 2 + results in 7Message #25 Posted by Thomas Okken on 3 Dec 2010, 1:58 p.m.,in response to message #24 by Walter B It is a bug. I remember reading about this ages and ages ago, and I thought I remembered seeing this behavior on the HP-25 as well. As luck would have it, I'm working from home at the moment, so I could get my HP-25 out of its drawer, and I confirmed, 5 ENTER CHS 2 + returns 7, both from the keyboard and in a program.

 Re: 5 ENTER CHS 2 + results in 7Message #26 Posted by Walter B on 3 Dec 2010, 4:25 p.m.,in response to message #25 by Thomas Okken Thanks, Thomas. Your result fits well in the line since the HP-25 was made before the HP-22 according to the museum. Does anybody have a working HP-27 for checking?

 Re: 5 ENTER CHS 2 + results in 7Message #27 Posted by Thomas Okken on 3 Dec 2010, 6:31 p.m.,in response to message #26 by Walter B You're welcome! For what it's worth, my HP-25 has a serial number that starts with 1605, i.e. made in February 1976.

 Re: 5 ENTER CHS 2 + results in 7Message #28 Posted by Walter B on 5 Dec 2010, 11:34 a.m.,in response to message #27 by Thomas Okken OK, I have the results of some more models now. So the updated table looks like this: HP-35 until and including V4: 5 ENTER CHS 2 + results in 3. So this looks like a prefix CHS being perfectly legal in numeric input of the mantissa. Checked by CLR CHS 5 ENTER CHS 2 + resulting in -7, q.e.d. In exponents, BTW, pre- and postfix CHS are allowed until today. HP-45: 5 ENTER CHS 2 + results in 7. So does 55, 65, 80, 21, 22, 25, 27, 25C. But 5 ENTER CHS + returns 0 as expected. Seems CHS is executed in any case but is undone if a *first digit* follows: ``` display on a 25C or a 32E (see below): CLX 0.0 0.0 CHS -0.0 0.0 1 1. 1. CHS -1. -1. 2 -12. -12. CHS 12. 12. 3 123. 123. ENTER 123.0 123.0 CHS -123.0 -123.0 4 4. 4. + 127.0 -119.0 ``` Please note CHS does not terminate the input sequence in either case. So the last CHS on the 25C belongs to the input of 4 and is thus undone when 4 is entered! HP-91: 5 ENTER CHS 2 + results in -3. So CHS is now recognized as an operation as soon as an input is completed (e.g. by ENTER) - thus it operates on 5 in X, turning it to -5, and 2 is added to this as we expect it. CHS will not work after CLX, it needs at least 1 digit put in but may be used arbitrary times during numeric input of one number as before. - The same result is returned by the 67, the Spices, Voyagers, and Pioneers. And also the "new" calcs including the RPL-machines keep it this way. For sake of completeness: Has anybody access to a working 29C and/or 19C? Could you please check it and report the results? I don't remember having read anything about this change of concepts here for some years - so let me ask: is this known for longer already? TIA for enlightenment(s). Edited: 5 Dec 2010, 11:39 a.m.

 Re: 5 ENTER CHS 2 + results in 7Message #29 Posted by Thomas Klemm on 5 Dec 2010, 3:01 p.m.,in response to message #28 by Walter B Quote: So the last CHS on the 25C belongs to the input of 4 and is thus undone when 4 is entered! I don't agree with you here: instead I assume that -123 is overwritten by 4 since CHS doesn't enable the stack lift. The CHS has two different modes of operation: either as part of the input of a number or to change the sign of the X-register. In the HP-35 it isn't clear which mode to use until after the next key-stroke. So first it changes the sign of X. But if the next key is a number, this change of X is reverted and instead the negative sign is considered part of the number. It is clear that CHS can't enable the stack lift. Otherwise the following two sequences leave a different number of elements on the stack: ```5 ENTER CHS 2 + Y: 5 X: 3 5 ENTER 2 + X: 7 ``` So I think this magic handling of the CHS was removed, but enabling the stack lift wasn't added. In addition to your tests I suggest the following variants: make sure the stack lift is enabled, e. g. by performing an operation like + use RCL instead of entering a number after CHS Store 2 in the register (2 STO) and make sure the stack is empty: ``` 5 5 5 5 + ENTER + ENTER CHS CHS CHS CHS RCL RCL 2 2 + + + + HP-35: -3 7 3 3 HP-45: -3 7 -3 7 HP-25: -3 -3 -3 7 HP-91: -3 -3 -3 -3 ``` I have verified these results only with online emulators of the HP-35/45/25. The results for the HP-91 are just my expectations. Best regards Thomas Added the results for the HP-25. Edited: 6 Dec 2010, 9:36 a.m. after one or more responses were posted

 Re: 5 ENTER CHS 2 + results in 7Message #30 Posted by Karl Schneider on 5 Dec 2010, 5:30 p.m.,in response to message #29 by Thomas Klemm From Walter's original statement: Quote: HP-35: 5 ENTER CHS 2 + results in 3. HP-45: 5 ENTER CHS 2 + results in 7. So does 55, 65, 80, 21, 22. HP-91: 5 ENTER CHS 2 + results in -3. And so it stays until the 42S. And the "new" calcs including the RPL-machines keep it this way. From Thomas' post: Quote: The CHS has two different (modes of operation): either as part of the input of a number or to change the sign of the X-register. Yes, that's the crux of the matter. I believe that HP, in those early years, was still working out the important nuances of the CHS function. Its implementations on the HP-35 and HP-45 were flawed, in that user input could sometimes get completely changed during data entry. Characteristics of proper CHS functionality in RPN: When CHS is utilized to input a negative number, prior entry of at least one digit or the radix point should be required. Saturn-processor calculators (not the handheld computers, such as the HP-71B) will accept 0 or the radix point as that initial entry; prior models will not. Upon using CHS to negate a final result left in the x-register by ENTER or other means, stack lift should always be (re-)enabled. The HP-91 and most subsequent models implemented CHS correctly. A few early models on the HP-45's software-development track retained its flawed CHS functionality. Also, a subtle bug got slipped into many (but not all) Spice-series and Voyager-series models: -- Karl Clarified several statements, based in part on new information. Edited: 6 Dec 2010, 10:29 p.m. after one or more responses were posted

 Re: 5 ENTER CHS 2 + results in 7Message #31 Posted by Walter B on 5 Dec 2010, 7:12 p.m.,in response to message #30 by Karl Schneider Quote: The HP-91 and subsequent models implemented CHS correctly Not quite. The timeline is as follows according to HPDATAbase: ```1975 1976 1977 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 22 .. .. .. .. .. .. .. 27 .. 25C (all these return 7) 91 .. .. .. 67 .. .. .. .. .. .. .. .. .. .. .. 29C etc. return -3 ``` So there was some overlap. Seems it took HP significantly more than 4 months to implement the new CHS-handling in new Woodstock models, though it was "only software". Edited: 7 Dec 2010, 12:45 p.m.

 Re: 5 ENTER CHS 2 + results in 7Message #32 Posted by Walter B on 9 Dec 2010, 2:00 a.m.,in response to message #29 by Thomas Klemm Thomas, FYI, I've checked your table using real calcs and almost everything met your expectations and emulator output, but the results on a real 25C are the same as on a 45, i.e. -3 7 -3 7.

 Re: 5 ENTER CHS 2 + results in 7Message #33 Posted by Thomas Klemm on 9 Dec 2010, 2:32 a.m.,in response to message #32 by Walter B Hi Walter Thanks for taking the time to check the results. I've used the HP-25 (Java) simulator written by Larry Leinweber. I should have realized that it's not an emulation. Cheers Thomas

 Re: 5 ENTER CHS 2 + results in 7Message #34 Posted by BobVA on 5 Dec 2010, 5:19 p.m.,in response to message #28 by Walter B -3 on an HP-19C and 29C Regards, Bob

 Re: 5 ENTER CHS 2 + results in 7Message #35 Posted by Walter B on 5 Dec 2010, 7:14 p.m.,in response to message #34 by BobVA Thank you, Bob :)

 Re: Which calculator passes the first test?Message #36 Posted by Ken Shaw on 2 Dec 2010, 10:31 a.m.,in response to message #12 by Walter B Ha ha. A rare example of concision in German? ;-))

 Re: Which calculator passes the first test?Message #37 Posted by Thomas Okken on 1 Dec 2010, 11:45 p.m.,in response to message #4 by Tommy Quote:All my HP:s gives the correct answer 4, but most calcs gives the wrong answer -4. The correct answer to what? -22=-4, and (-2)2=4. This is the convention that's universally used in mathematics textbooks, and yet you seem to imply that -22=-4 is "wrong". Given that you've also indicated that you actually teach this stuff, that makes me think that you really, really need to do your homework, before looking for calculators whose behavior matches your mis-informed idea of mathematical notation. BTW, as Hugh mentioned, this was discussed on this forum not too long ago. See here. If you really want to teach your students well, teach them how the notation works as it is used in textbooks, and, if this actually comes up in your course, also mention how certain calculators and programming languages differ from the textbook standard. Edited: 2 Dec 2010, 12:18 a.m.

 Re: Which calculator passes the first test?Message #38 Posted by Tommy on 2 Dec 2010, 7:21 a.m.,in response to message #37 by Thomas Okken Sorry,Thomas, but you did not understand my question. /Tommy

 Re: Which calculator passes the first test?Message #39 Posted by Martin Pinckney on 2 Dec 2010, 11:01 a.m.,in response to message #38 by Tommy Quote: Sorry,Thomas, but you did not understand my question. /Tommy I did not either. Perhaps several respondents did not. The way it was phrased makes it difficult to understand, IMO. Perhaps you could restate it?

 Re: Which calculator passes the first test?Message #40 Posted by DeboT on 2 Dec 2010, 5:34 a.m.,in response to message #3 by Mark Storkamp Quote: I believe -22 is -4. Unless you mean (-2)2, which is 4. It's not clear from what you wrote, what you expect the correct answer to be. I disagree, if I have -2 on the display, and square it, it is to be interpreted as (-2)^2, if I wanted -(2^2), I would enter 2^2, then (+/-). The negative is part of the number (I am talking about having used the change sign, not minus), I did not enter "0 - 2^2", in which case the 2 is separate of the minus. What calculator when squaring a real number only squares the fractional part?, or when given a proper fraction only squares the fractional part? By the way, now that your calculator has -4 as the answer for -2^2, press the ^2 again and see what you get. -16?, NO most will give 16 as they will do ANS^2 - so now it does see the negative as part of the number. A bit inconsistent I'd say. Further Edit: As far as I recall all my LED/VFD scientific calculators give + when squaring a negative number. Somewhere along the line when DAL, VPAM etc. calculators came out someone thought it "good" to let a negative number (entered with change sign) be the same as "0 - the number" and thus squaring it results in a negative answer. Now many people in the world are justifying this? Edited: 2 Dec 2010, 6:19 a.m.

 Re: Which calculator passes the first test?Message #41 Posted by Tommy on 2 Dec 2010, 7:14 a.m.,in response to message #40 by DeboT You are right, ANS^2 is positve 16. Intresting... /Tommy

 Re: Which calculator passes the first test?Message #42 Posted by Walter B on 2 Dec 2010, 7:22 a.m.,in response to message #41 by Tommy Quite logical, since the actual numeric value of the variable ANS is squared.

 Re: Which calculator passes the first test?Message #43 Posted by Tommy on 2 Dec 2010, 7:40 a.m.,in response to message #42 by Walter B That is logical. But the intresting part is that you can not rely on the results.

 Re: Which calculator passes the first test?Message #44 Posted by Walter B on 2 Dec 2010, 9:13 a.m.,in response to message #43 by Tommy Quote: But the intresting part is that you can not rely on the results. Why? You just have to know what you're doing. As Bill explained above, there are different ways calculators handle such problems. A major advantage of RPN is it acts in a very consistent way: number first, operation second - no need to care for precedences etc. So 17 +/- x^2 will always result in 289. OTOH 17 x^2 +/- equals -289. The world can be so simple ;) Exception (on my 42S): 17 +/- E +/- 2 will result in 0,17 as well as 17 +/- E 2 +/- while the second input is more in line with RPN principles. Side track: Remember STO12 being an operation in RPN, so 17 +/- STO12 will store -17 in register 12. IMHO one disadvantage of RPL is they got these things mixed up so you have to enter 17 +/- ENTER 12 STO to reach the same (if numeric registers were allowed). End of side track.

 Re: Which calculator passes the first test?Message #45 Posted by bill platt on 2 Dec 2010, 7:31 a.m.,in response to message #41 by Tommy Note my discussion of Operation versus Parse. Answer^2 is an operation on the answer.

 Re: Which calculator passes the first test?Message #46 Posted by DeboT on 2 Dec 2010, 8:46 a.m.,in response to message #45 by bill platt My point is exactly that a negative number created with a "change sign" should be operated on in it's entirety and not parsed.

 Re: Which calculator passes the first test?Message #47 Posted by bill platt on 2 Dec 2010, 8:52 a.m.,in response to message #46 by DeboT Yes, but this is of course machine specific. If the function of the +/- key is for entry of characters into the line, then it will be line interepreted. See for instance the 48G

 Re: Which calculator passes the first test?Message #48 Posted by bill platt on 2 Dec 2010, 7:36 a.m.,in response to message #40 by DeboT Quote: I disagree, if I have -2 on the display, and square it, it is to be interpreted as (-2)^2 Note my discussion of line interpreter/parser versus operation. If you have -2 on the display and you operate on it, of course you get +4. That is what an RPN machine will do, or an older "algebraic" because even the latter is postfix and operation-based (is the same as RPN). Newer machines line-line interpret *expressions* rather than operate on numerical entities. However, the "answer" function operates on the answer. This is always, first and foremost, a problem of not following RTFM41 rather than a machine defect or bug. However I do have opinions regarding good versus bad design, but even the "bad" designs work correctly if one bothers to learn how they work.

 Re: Which calculator passes the first test?Message #49 Posted by DeboT on 2 Dec 2010, 8:53 a.m.,in response to message #48 by bill platt Quote: ... but even the "bad" designs work correctly if one bothers to learn how they work. I would rather say that "bad" designs work as the designer intended, but not necessarily correctly. Of course correct being a bit subjective in the current topic :). Quote: This is always, first and foremost, a problem of not following RTFM41... A case of "know your enemy"? ;) Edited: 2 Dec 2010, 9:06 a.m.

 Re: Which calculator passes the first test?Message #50 Posted by bill platt on 2 Dec 2010, 3:16 p.m.,in response to message #49 by DeboT Yes, if you mean, "I've met the enemy, and he is me."

 Re: Which calculator passes the first test?Message #51 Posted by DeboT on 3 Dec 2010, 6:25 a.m.,in response to message #50 by bill platt I was thinking of "know what you're using", but we indeed can be our own worst enemy at times :).

 Re: Which calculator passes the first test?Message #52 Posted by DeboT on 3 Dec 2010, 6:34 a.m.,in response to message #40 by DeboT HA! Even Microsoft agrees with ME :P Try on Windows calculator: 2, +/-, x2 = ; the answer is +4 now try -, 2, x2 = the answer is -4 well, for whatever credit one can take from microsoft *grin*

 Re: Which calculator passes the first test?Message #53 Posted by hugh steers on 1 Dec 2010, 3:11 p.m.,in response to message #1 by Tommy this discussion came up a while back. it turns out that the operator precedence of unary minus is different for different manufacturers. we even found differences amongst different casio models. the problem is compounded when you allow two minus buttons, ie regular operator minus and (-).

 Re: Which calculator passes the first test?Message #54 Posted by Crawl on 1 Dec 2010, 11:10 p.m.,in response to message #1 by Tommy If you have a calculator, you should know how it works, so you can make it give you the answer you think it should. That's the only issue here. Let's put this a different way. Sin30 (in degrees) is 0.5. But do you have a calculator that lets you enter 30 Sin, you might get 0.5. But what's 30 Sin? That's 30 times the Sin of nothing! It's meaningless! That seems kind of like what you're saying.

 Re: Which calculator passes the first test?Message #55 Posted by bill platt on 2 Dec 2010, 7:43 a.m.,in response to message #54 by Crawl That's right. GIGO. 30 SIN is postfix. sin(30) is line interpreted. sin 30 = is used in an infix machine, for instance, the old SHARP EL 5020. Of course the manuals don't necessarily bother to explain the inner workings, especially the cheap Non-HP designed machines with little fold out manuals. Even HP manuals won't always discuss the parse versus operation aspect--but note that until recently, no calculator parsed expressions! By recently, I mean early 90s or late 80s. I am showing my age :-D Edited: 2 Dec 2010, 7:44 a.m.

 Re: Which calculator passes the first test?Message #56 Posted by Marcus von Cube, Germany on 2 Dec 2010, 9:28 a.m.,in response to message #1 by Tommy Manufacturers seem to disagree about the interpretation of (-)2^2 even within their own product range: Sharp: None of my algebraic Sharp calculators returns +4. I do have the EL-9200/9300/9600 and an EL-5120. Are you sure, the EL-520WBBK does? Casio: None of my algebraic Casio calculators returns 4. I tried with a BASIC computer (PC-1262), some newer algebraics, and various graphics machines (old and recent). The Canon F-300P returns +4. Likewise the TI Galaxy 67, while all the TI graphics calculators, including the CAS machines, and also the TI-34 multiview return -4. Now to HP: The 30s and the 9g both return -4. Same for the 38G. The RPL machines lack the postfix ^2 operator as has already been mentioned. -2^2 returns -4. Return -4 seems to be the rule, +4 the exception.

 Re: Which calculator passes the first test?Message #57 Posted by Walter B on 2 Dec 2010, 10:17 a.m.,in response to message #56 by Marcus von Cube, Germany Sorry, I disagree about the RPL-machines. You'll find x^2 on e.g. the HP-48SX easily (gold shifted square root). And it behaves mathematically correct, i.e. 2 +/- x^2 equals 4.

 Re: Which calculator passes the first test?Message #58 Posted by bill platt on 2 Dec 2010, 3:02 p.m.,in response to message #57 by Walter B I should have elaborated. When you do that, using the stack, it is an operation on the -2, which is in the command line. If you do this: '-2^2' ENTER EVAL Then it is parsed.

 Re: Which calculator passes the first test?Message #59 Posted by Tommy on 2 Dec 2010, 1:50 p.m.,in response to message #56 by Marcus von Cube, Germany Danke! This is what my question is all about I am not sure about the EL-520WBBK, but the EL-506WBBK does return +4. Both are D.A.L. (Direct Algebraic Logic). This one also returns +4: Karce KC-156 Sorry about all confusion I created. Hopefully HP returns with a cheap scientific RPN calculator in the future. /Tommy

 Re: Which calculator passes the first test?Message #60 Posted by Kiyoshi Akima on 2 Dec 2010, 12:56 p.m.,in response to message #1 by Tommy Tommy, why are you expecting RPN and non-RPN machines to give the same result for the same sequence of keystrokes? (-) 2 x^2 in algebraic is calculating the same result as 2 x^2 (-) in RPN. (-) 2 x^2 in RPN is ( (-) 2 ) x^2 in algebraic. I'll leave it to you to count the keystrokes and make any decisions about efficiency.

 Re: Which calculator passes the first test?Message #61 Posted by bill platt on 3 Dec 2010, 11:58 a.m.,in response to message #1 by Tommy Hi Tommy, Re-reading your question in light of all the commentary, please read the following. The algebraic expression -2^2 is equal to -4. This is a fact of uniform notation. If you think this is incorrect, then that would be a problem. However, what I think is leading you to believing that calculators are giving incorrect answers is that you are used to the older style of machines, where you *operate* on what is displayed. In this case, the problem you are actually trying to figure out is the following: ```(-2)^2 ``` An older machine such as a 1970s Ti SR70 or an HP 20s, or a 27s or an HP 33s set in ALG, or any RPN machine will work identically: This type of machine OPERATES on the x-register. A currently available HP is used in the example below: ```expression: (-2)^2 keystrokes display 33s ALG mode 2 2_ ...................................... +/- -2_ ...................................... (-2)^2 x^2 4 ...................................... [note how cool this machine is in ALG mode. It uses the old-style post-fix functions operating on numeric line entries, but it displays the proper complete algebraic notation in the upper line. Pretty damn cool!] ``` If you are using a more "modern" machine with a "textbook" type of interface, you will have to type in the expression correctly according to standard notation. (note however that there is variation from machine to machine even here--some allow implicit multiplication, some don't follow standard rules exactly etc [ex: equation list of 32sii which has a unary minus]. An example of a properly functioning PARSED LINE INTERPRETER is found in the currently available HP 33s Equation List: ``` ( ( - {or +/-} (- 2 ( 2_ ) (-2)_ y^x (-2)^_ 2 (-2)^ 2_ ENTER (-2)^2 ENTER 4 --or--- x^2 SQ(_ +/- {or -} SQ(-_ 2 SQ(- 2_ ENTER SQ(-2 ENTER 4 ``` [note that you don't have to close the parenthesis here because the line interpreter will implicitly close it. Some machines would error at this. Every machine is different and you have to Read the F\$#\$#\$#@ manual :-) ] I hope this helps you. Best regards, Bill ENTER Edited: 3 Dec 2010, 12:04 p.m.

 Re: Which calculator passes the first test?Message #62 Posted by Bart (UK) on 3 Dec 2010, 4:35 p.m.,in response to message #61 by bill platt Quote: Every machine is different and you have to Read the F\$#\$#\$#@ manual :-) Indeed. The Sharp EL-W506 Writeview manual states: Priority Levels in Calculation FractionsAngle prefix, Engineering prefixesFunctions preceded by argument (e.g. x-1, x2, n!, etc)yx, x/¯Implied multiplication of a memory value (2Y, etc.)Functions followed by their argument (sin, cos, (-), etc.)...Note: (-) = change sign.So one can see that as the x2 is defined as taking precedence over (-), thus entering: (-), 2, x2 will be evaluated as 2^2=4, (-), = -4.Whether we like it or not, it does what the manufacturer intended and specified.

 Re: Which calculator passes the first test?Message #63 Posted by Tommy on 3 Dec 2010, 7:27 p.m.,in response to message #62 by Bart (UK) Quote: Whether we like it or not, it does what the manufacturer intended and specified. or failed to implement and specified

 Re: Which calculator passes the first test?Message #65 Posted by bill platt on 3 Dec 2010, 9:01 p.m.,in response to message #64 by Tommy Hi Tommy: "The 35s would be ok, but it is a little bit too expensive (for the students)" I have to laugh at this. I guess it is priorities. IF you have to spend as little as it costs for one Hamburger and fries, then, yes, I guess \$45 bucks or so is too much. Same kid thinks nothing of blowing \$10 a week on iTunes. And people don't read the manuals because they are LAZY. I read my 11c manual cover to cover when I got it in 1982, and so did my brother even though it wasn't his. IT was fun to know how it worked. I think the 33s is a better choice than the 35s actually. It is more user friendly and has much better handling of rectangular to polar, and base arithmetic. And it is, as I showed, a postfix function/infix arithmetic and *operates* on the displayed number. The 35S does NOT do this the same way. The 35S is an infix machine (except for factorial.) You should download the manuals for the 33s and the 35s. Look at page C-1 in each one. I lost my 35s so I can't test it, but there is a "unary minus" ahead of multiplication on the 35S. I just don't remember how it works. All told, the 35s and 33s are totally different approaches in their Algebraic modes (as distinct from their equation modes, which are essentially identical (see p 6-13 through 6-15 of each manual. They have a unary minus ahead of multiplication, but this is to handle the issue such as -a X -b, which is I believe what is also the unary minus treatment in the 35s ALG mode). [The 32sii equation list had the unary minus given precedence over taking powers, which was the real problem there. Both the 33s and 35s have rectified this by moving the unary minus down.] Fortunately, I haven't much experience with current non-HP machines. I have 15 or 20 year old Sharps and a TI so that won't help you.... Edited: 3 Dec 2010, 10:05 p.m.

 Re: Which calculator passes the first test?Message #66 Posted by Tommy on 4 Dec 2010, 4:14 a.m.,in response to message #65 by bill platt I totally agree with you. I enjoy reading the manuals. But in the case of money, the 35s and 33 are in range of what a TI graphical calc costs. And you can not compete with TI there. I need a cheaper one. I am using Excel and GeoGebra. But TI is 99% mandatory in Sweden. All textbooks have “how to do this and that on your TI”. Sorry to say, HP has lost the battle, but I still fight for good calculators. Back to the main issue: (-)2^2=-2 that is negative 2 ^2 incorrect (-)2= ^2= 2 that is negative 2 = Ans ^2 correct The only difference is an extra =. In this case the = is an “almost equal sign” You cannot argue about an “equal sign”, or can you? ;-) Best regards /Tommy

 Equal pricingMessage #67 Posted by Walter B on 4 Dec 2010, 6:36 a.m.,in response to message #66 by Tommy Quote: You cannot argue about an “equal sign”, or can you? On calculators beyond trivial calculations, "equal" means always "almost equal" within the tolerance (or accuracy) of the calculator. Your example, however, counts to the mathematically trivial applications, so I agree "almost equal" being not necessary there. Our American friends tend to forget sometimes the price policy of HP in the countries beyond God's own. I hate to repeat this, but e.g. a new 35S sells for 50 € (Euro) in Germany at least - look here for Hewlett Packard and enjoy your location since 50 € "almost equal" 66 US\$ today :(

 Re: Equal pricingMessage #68 Posted by bill platt on 4 Dec 2010, 9:38 a.m.,in response to message #67 by Walter B and don't forget the eurotaxes. I wonder if there is a cost of doing business aspect to european pricing nowadays. All items that we can buy here, and there, are more in eurozone. All. but this was not the case in the past. My father bought a couple pairs of binoculars, a camera, and a Rolex in Germany in the 60s for significantly less. In 98, I found that the dollar being strong, made the Mark really inexpensive. Chocolate bars were only 60% of what I paid here. But now, it hardly matters what the currency does--the Eruo pricing is always high, or higher...

 Re: Equal pricingMessage #69 Posted by gene wright on 4 Dec 2010, 11:03 a.m.,in response to message #68 by bill platt In most cases, MSRPs in Euro are the numerical value of the MSRP in USD\$\$. At the current exchange rate, yes, that means Europeans pay more. That is an almost universal practice among retailers, who really tend to influence the MSRP, more than manufacturers.

 Re: Which calculator passes the first test?Message #70 Posted by Bill Platt on 4 Dec 2010, 9:49 a.m.,in response to message #66 by Tommy Hi Tommy, Your notation has me flummoxed. I thought I understood what you meant, but now I'm not so sure. The TI "maths cookbook" approach is also dominant here. That gets to another subject. Nobody can write cursive, and the teachers don't care. "Just use the computer, they say. Nobody can spell, and teachers don't care. "Just use spell-check" they say. Nobody can do arithmetic, and the teachers don't care. "Just use a calculator" they say. What's next? Nobody can think critically, "just google it." And the parents? I guess there must be an unspoken consensus among parents that this trend is good. And yet, Sweden is outperforming the US rather dramatically in Maths education. Only Massachusetts and Minnesota outrank Sweden. Evidently the calculators are only a minor issue...

 Re: Which calculator passes the first test?Message #71 Posted by Walter B on 4 Dec 2010, 12:49 p.m.,in response to message #70 by Bill Platt Quote: Nobody can write cursive, and the teachers don't care. "Just use the computer, they say. Nobody can spell, and teachers don't care. "Just use spell-check" they say. Nobody can do arithmetic, and the teachers don't care. "Just use a calculator" they say. What's next? Nobody can think critically, "just google it." And the parents? I guess there must be an unspoken consensus among parents that this trend is good. In principle, human beings are curious and lazy. Scientists tell 20% of the energy consumption of an average (wo)man is consumed by (her) his brain. People tend to become overweigh - emmh, horizontally challenged in modern societies. Now, let's add 1+1+1 and guess the result ... ;) OTOH, already Sokrates complained about the youth in Athenai, calling them incapable and good-for-nothing some 2300 years ago - and their successors discovered America ;)

 Re: Which calculator passes the first test?Message #72 Posted by bill platt on 4 Dec 2010, 2:02 p.m.,in response to message #71 by Walter B "OTOH, already Sokrates complained about the youth in Athenai, calling them incapable and good-for-nothing some 2300 years ago - and their successors discovered America ;) " Hahaha so true. Then again, somewhere along there, the Greeks lost to the Romans etc... What I find striking about the bible isn't the religious stuff, but the parables, the warnings of what can and does happen when decadence prevails. Never mind the god and hell stuff--the fact is that ancient cities perished because the youth were led astray... In the US, it is immigrants who keep us honest. They often show us the way when we lead ourselves astray. They show us that we shouldn't take our great society for granted--that freedom, liberty and justice do matter...

 Re: Which calculator passes the first test?Message #73 Posted by Chris Randle (UK) on 6 Dec 2010, 7:23 a.m.,in response to message #66 by Tommy Quote: But in the case of money, the 35s and 33 are in range of what a TI graphical calc costs. And you can not compete with TI there. I need a cheaper one. Is the HP 10s a possibility? Calculators don't come much cheaper than that, and I don't just mean the price ;-) There's no RPN option. The algebraic parsing of `- 2 ^ 2 =` returns `-4` and ```- 2 = Ans ^ 2 =``` returns `4` I've read all the posts and I'm still not 100% clear on whether or not this passes "the test", but I contend that its answers are correct, bearing in mind all that Bill Platt wrote about the critical difference between parsing an algebraic input string and the immediate operation of RPN on a stack.

 Re: Which calculator passes the first test?Message #74 Posted by Kiyoshi Akima on 6 Dec 2010, 12:49 p.m.,in response to message #64 by Tommy So, by your reasoning, you would expect an algebraic calculator to give the result 9 for the key sequence 1 + 2 x^2 = since the x^2 is to operate on the "1+2" in the display?

 Re: Which calculator passes the first test?Message #75 Posted by DeboT on 7 Dec 2010, 5:02 a.m.,in response to message #74 by Kiyoshi Akima I think that's exactly what Tommy's not saying (am I right Tommy?), but rather that which I stated previously. To quote myself: Quote: I disagree, if I have -2 on the display, and square it, it is to be interpreted as (-2)^2, if I wanted -(2^2), I would enter 2^2, then (+/-). The negative is part of the number (I am talking about having used the change sign, not minus), I did not enter "0 - 2^2", in which case the 2 is separate of the minus. And the 33s is a perfect example of this: Quote: The 33s in ALG mode: 5, +/-, x2, ENTER yields: ( -5)2= 25 and MINUS, 5, x2, ENTER yields: 0-52= -25 Thus the answer to your key sequence would be the normally expected 5.When Tommy mentions "the number on the display" I think he is indeed talking about a number, not an equation - his examples illustrate this. (Tommy - please correct me if I am wrong).

 Re: Which calculator passes the first test?Message #76 Posted by Palmer O. Hanson, Jr. on 7 Dec 2010, 8:45 p.m.,in response to message #74 by Kiyoshi Akima Quote: So, by your reasoning, you would expect an algebraic calculator to give the result 9 for the key sequence 1 + 2 x^2 = since the x^2 is to operate on the "1+2" in the display? That is exactly what happens when one uses the type of algebraic mnechanized in business machiines such as the HP-10B, HP-17BII and HP-19BII. It is NOT what happens with the algebraic mechanizations in the HP-10s, HP-33s or HP-35s.

 Re: Which calculator passes the first test?Message #77 Posted by Walter B on 7 Dec 2010, 11:22 p.m.,in response to message #76 by Palmer O. Hanson, Jr. ... which is the difference of "chain" and "algebraic" modes, having been discussed here not too far ago.

 Re: Which calculator passes the first test?Message #78 Posted by Palmer O. Hanson, Jr. on 8 Dec 2010, 9:29 p.m.,in response to message #77 by Walter B That isn't the only thing that has been discussed before in this forum. How many times have we discussed the silly idea that -22 = +4 ?

 Re: Which calculator passes the first test?Message #79 Posted by bill platt on 8 Dec 2010, 9:46 p.m.,in response to message #78 by Palmer O. Hanson, Jr. Once. But we discussed -3^2 = 9 :-D

 Re: Which calculator passes the first test?Message #80 Posted by Palmer O. Hanson, Jr. on 9 Dec 2010, 9:37 p.m.,in response to message #79 by bill platt Quote: Once. But we discussed -3^2 = 9 :-D But, it's the same silly idea.

Go back to the main exhibit hall