Post Reply 
negative number raised to even power
05-07-2015, 02:25 PM
Post: #64
RE: negative number raised to even power
(05-07-2015 01:39 PM)Steve Simpkin Wrote:  
(05-07-2015 12:25 PM)Dave Britten Wrote:  I'm of the opinion that the negation sign is a part of the number itself, not an operation, and thus -2^2 = 4. Yes, you can say that -2 = 0 - 2, but you can also say that 2.5 = 2 + .5, and 2.5^2 isn't 2.25, is it?

In CS terms, fully parsing a numeric literal is atomic, and precedes any operations on that number.

I tend to agree with this point of view when it is presented simply as "-2^2" but what about the case where it is part of an equation such as "10-2^2"?

In that case, it's a binary operation (subtraction), so the result should be 6. If it were written "10 + -2^2", then I say it should be 14.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
negative number raised to even power - DrD - 04-25-2015, 11:24 AM
RE: negative number raised to even power - Dave Britten - 05-07-2015 02:25 PM



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