Post Reply 
Why does -2^2 compute to -4 on my HP Prime?
02-11-2024, 11:17 PM
Post: #25
RE: Why does -2^2 compute to -4 on my HP Prime?
(02-09-2024 01:30 PM)Albert Chan Wrote:  
If we add MOD operator to the mix, zero make a difference.
Unary minus has higher precedence than binary minus, with MOD in-between.

It’s good for me to have read back a bit further in time. The “third item in that list” I was alluding to was MOD — how I personally view MOD depends on whether math mode is on in my brain. If it is, I like to see MOD as a declaration that we are doing modular arithmetic, so it would have much lower precedence — below equality tests, even (“(mod x)” would appear at the end of each line of mathematics). When I’m in programming mode, I can certainly appreciate % having the same precedence as /. Perhaps a hybrid approach would be to treat MOD as a declaration of arithmetic type, similar to how units are handled on the HP Prime. (Once applied, the modulus would carry through to results.)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Why does -2^2 compute to -4 on my HP Prime? - jte - 02-11-2024 11:17 PM



User(s) browsing this thread: 1 Guest(s)