Post Reply 
Unary minus precedence preference
07-29-2014, 07:25 PM (This post was last modified: 07-29-2014 07:46 PM by Eddie W. Shore.)
Post: #30
RE: Unary minus precedence preference
-8^2 returns -64 but -8 * -8 returns 64:

-8 * -8
(0 - 8) * (0 - 8)
—8 * —8 // — used as a negative sign.
—1 * 8 * —1 * 8
64

I don't recall any calculator manual mentioning that the [ - ] really meant unary subtraction. That key was always labeled negation. Thankfully, manuals do state that this operation is executed after powers and roots in the order of operations.

We also have the problem of inverse functions. Clearly, when the user presses [ - ] [ 8 ] [x^2], the user was not intending to enter an imaginary number. But on software with algebraic entry:

-8^2 returns 64
SQRT(Ans) returns 8*i or Error if complex mode is turned off or not available.

Personally, I prefer if [ - ] just negates the number and make it part of the number.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Unary minus precedence preference - Eddie W. Shore - 07-29-2014 07:25 PM



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