# HP Forums

Full Version: - number ^ power issue? HP Prime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I did not notice following with prior HP Prime firmware:

-3^2 yields -9 but
(-3)^2 yields +9

I hope I am missing something here, otherwise this is a problem.
(05-28-2014 04:58 PM)CR Haeger Wrote: [ -> ]-3^2 yields -9 but ...

I think this must due to precedence of operators. The Prime (now) thinks that unary negation is lower precedence than exponentiation.

By the way, when I do this in python I get the same thing:

>>> -3**2
-9
>>>
Both results appear to be correct.

1. how would you evaluate 0-3^2?

2. the square of a negative number is positive

I hope *I* have not missed anything here.
(05-28-2014 05:09 PM)Jonathan Cameron Wrote: [ -> ]I think this must due to precedence of operators. The Prime (now) thinks that unary negation is lower precedence than exponentiation.

http://en.wikipedia.org/wiki/Order_of_operations

In written or printed mathematics, the expression −3^2 is interpreted to mean −(3^2) = −9,[3] [...]

[3] Allen R. Angel, Elementary Algebra for College Students 8/E; Chapter 1, Section 9, Objective 3
48 and 50 do the same in an algebraic obj...
(05-28-2014 05:29 PM)DrD Wrote: [ -> ]http://www.wolframalpha.com/input/?i=-3^2

-ditto-
Same on Google, same on Bing.
Thanks all - yes the Prime (and other calculators) are doing this correctly.

My error.
(05-28-2014 06:11 PM)CR Haeger Wrote: [ -> ]Thanks all - yes the Prime (and other calculators) are doing this correctly.

Woohoo! I get to win for once!
(05-28-2014 07:05 PM)Tim Wessman Wrote: [ -> ]
(05-28-2014 06:11 PM)CR Haeger Wrote: [ -> ]Thanks all - yes the Prime (and other calculators) are doing this correctly.

Woohoo! I get to win for once!

Seriously, Tim. Thank you for all you do and for communicating information with us. Without you and Cyrille I suspect there would be no new RPN calculators from HP and certainly no RPN mode in the Prime.

Steve Simpkin
(05-28-2014 07:05 PM)Tim Wessman Wrote: [ -> ]
(05-28-2014 06:11 PM)CR Haeger Wrote: [ -> ]Thanks all - yes the Prime (and other calculators) are doing this correctly.

Woohoo! I get to win for once!
Ha ha ha thumbs up Tim
(05-28-2014 07:05 PM)Tim Wessman Wrote: [ -> ]
(05-28-2014 06:11 PM)CR Haeger Wrote: [ -> ]Thanks all - yes the Prime (and other calculators) are doing this correctly.

Woohoo! I get to win for once!

Don't worry, there are a lot more things the Prime can do correctly that I still wouldn't recognize as being correct. Blame my out of date firmware...
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :