HP Forums
- number ^ power issue? HP Prime - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: - number ^ power issue? HP Prime (/thread-1435.html)



- number ^ power issue? HP Prime - CR Haeger - 05-28-2014 04:58 PM

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.


RE: - number ^ power issue? HP Prime - Jonathan Cameron - 05-28-2014 05:09 PM

(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
>>>



RE: - number ^ power issue? HP Prime - Thomas Radtke - 05-28-2014 05:09 PM

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.


RE: - number ^ power issue? HP Prime - Thomas Radtke - 05-28-2014 05:15 PM

(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.
Please have a look here:

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


RE: - number ^ power issue? HP Prime - Tim Wessman - 05-28-2014 05:25 PM

48 and 50 do the same in an algebraic obj...


RE: - number ^ power issue? HP Prime - DrD - 05-28-2014 05:29 PM

http://www.wolframalpha.com/input/?i=-3^2

-ditto-


RE: - number ^ power issue? HP Prime - Tugdual - 05-28-2014 06:01 PM

(05-28-2014 05:29 PM)DrD Wrote:  http://www.wolframalpha.com/input/?i=-3^2

-ditto-
Same on Google, same on Bing.


RE: - number ^ power issue? HP Prime - CR Haeger - 05-28-2014 06:11 PM

Thanks all - yes the Prime (and other calculators) are doing this correctly.

My error.


RE: - number ^ power issue? HP Prime - Tim Wessman - 05-28-2014 07:05 PM

(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! Big Grin


RE: - number ^ power issue? HP Prime - Steve Simpkin - 05-28-2014 08:17 PM

(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! Big Grin

Well don't let it go to your headSmile

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


RE: - number ^ power issue? HP Prime - Tugdual - 05-28-2014 08:18 PM

(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! Big Grin
Ha ha ha thumbs up Tim


RE: - number ^ power issue? HP Prime - CR Haeger - 05-28-2014 10:37 PM

(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! Big Grin

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...