Why does -2^2 compute to -4 on my HP Prime?
|
02-08-2024, 04:56 AM
Post: #1
|
|||
|
|||
Why does -2^2 compute to -4 on my HP Prime?
If I ask my prime to give me the answer to -2 squared it says the answer is -4 ?
Why is this happening? procedure ====== press +/- press 2 press x^2 press Enter result shows as -4 Both Home & CAS modes provide same result Why? |
|||
02-08-2024, 01:43 PM
Post: #2
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
02-08-2024, 02:17 PM
Post: #3
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
Awesome! Thanks for the explanation
OK ..note to self.. (-2)^2=4 properly. Whew! Now I know Lol! |
|||
02-08-2024, 02:22 PM
Post: #4
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
What happens if you press +/- *after* entering 2?
|
|||
02-08-2024, 03:28 PM
Post: #5
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
02-08-2024, 04:12 PM
Post: #6
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
(02-08-2024 03:28 PM)KenL Wrote: Apparently HP considers the +/- key as an operation rather than a declaration HP does the correct way to parse a number. Negative sign is not part of number. Do it the other way, we get into weird parsing situation. (note: this is a Prolog bug) (12-23-2020 03:14 AM)robve Wrote: Parsers should not consider the - to be part of the number to avoid this flaw. |
|||
02-08-2024, 05:08 PM
Post: #7
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
02-08-2024, 05:30 PM
Post: #8
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
02-08-2024, 05:53 PM
Post: #9
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
1) What is the result of the expression 0-2^2?
Answer: -4 (nobody doubts that). Now we will remove the zero, because, as you know, it is completely useless there: 2) What is the result of the expression -2^2? Expecting a positive result is somewhat contrary to point 1). Prime G2, 15C CE |
|||
02-08-2024, 05:59 PM
Post: #10
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
However, and I seem to be the one that always points this out:
Prime has *two* minus operators. There is unary negation which should yield (-2)^2 and the minus operator which should yield -(2^2) I don't have my Prime with me, so I can't tell which is being used in this case. If you look in the algebraic view, the unary minus is tinier and shifted up a bit, while the other is larger and justified to the middle of the number. |
|||
02-08-2024, 06:45 PM
Post: #11
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
In general, this is a problem with our common notation. "-" has at least three different meanings in math:
None of this confusion would exist if we had separate symbols for all three operations. In the meantime, I think it's useful to recognize the cause. |
|||
02-08-2024, 08:35 PM
Post: #12
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
(02-08-2024 03:28 PM)KenL Wrote:(02-08-2024 02:22 PM)KeithB Wrote: What happens if you press +/- *after* entering 2? Wolfram Alpha agrees with HP: https://www.wolframalpha.com/input?i=-2%5E2 <0|ɸ|0> -Joe- |
|||
02-08-2024, 09:12 PM
Post: #13
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
02-08-2024, 09:15 PM
Post: #14
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
I must concede.
The graph of -x^2 is indeed upside down Lol! |
|||
02-08-2024, 09:58 PM
Post: #15
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
(02-08-2024 09:12 PM)Albert Chan Wrote:(02-08-2024 05:59 PM)KeithB Wrote: However, and I seem to be the one that always points this out: No, I don't have my prime here, but this is in the catalog section of the manual: |
|||
02-08-2024, 10:00 PM
(This post was last modified: 02-08-2024 10:00 PM by KeithB.)
Post: #16
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
And I seem to have been bit by it here:
https://www.hpmuseum.org/forum/thread-12460.html |
|||
02-08-2024, 11:40 PM
Post: #17
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
The order of precedence used by algebraic scientific calculators has changed over the years. Early Texas instruments (TI) models like the SR-50 (Sum of Products logic) and TI-52/TI-30/TI-57/TI-58/TI-59, etc (AOS logic) would square the number in the display immediately after pressing the X^2 key (like RPN calculators). This would treat the sign of the number as an integral part of the number so -2^2 would equal 4. This is identical to the way HP RPN models calculated this type of problem.
For Texas Instruments, the change in logic occured around 1990 with the TI-81 (EOS logic). Theses and later models would treat the - as a negation operator with a lower precedence than the ^2 function so -2^2 would equal -4 on these models. This is described in more detail on the Datamath site: http://www.datamath.org/Sci/WEDGE/SR-52_...ing_System: |
|||
02-09-2024, 01:34 AM
Post: #18
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
The Prime is inconsistent with how it applies precedence for - and ^. Or maybe better said, when it imposes parentheses.
- 2 ^ 2 => -4 - 2 enter ^ 2 => 4 - 2 enter (copy from history) ^ 2 => -4 ANS seems to imply parentheses. I've learned to be generous with the use of explicit parentheses when working on the Prime. It really isn't worse than other algebraic or textbook calculators, but I can do much more complex things with the Prime, so I get into subtler problems. Having a truly usable RPN mode would be nice. 513016415223221833242338122322514610315 |
|||
02-09-2024, 01:30 PM
Post: #19
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime?
(02-08-2024 05:53 PM)chromos Wrote: 1) What is the result of the expression 0-2^2? If we add MOD operator to the mix, zero make a difference. Unary minus has higher precedence than binary minus, with MOD in-between. >>> 0-10%7, -10%7 (-3, 4) lua> 0-10%7, -10%7 -3 4 (02-09-2024 01:34 AM)john gustaf stebbins Wrote: I've learned to be generous with the use of explicit parentheses when working on the Prime. That's a good advice! For clarity, -10%7 should really be written as (-10)%7 Practical C Programming preface Wrote:This book stresses simple, practical rules. |
|||
02-09-2024, 03:23 PM
Post: #20
|
|||
|
|||
RE: Why does -2^2 compute to -4 on my HP Prime? | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)