Customizing -2^2

T

Tim Walters

Shouldn't minus a squared number be a minus number? In Excel -2^2 = 4. To
keep it negative I have to write -(2^2). It's very easy to make mistakes
because I also work with Quattro Pro which works differently. Is there a way
to customize this in Excel so that -2^2 = -4?

Thanks.
 
F

Fred Smith

In Excel the negation takes precedence over the power operator.

However, subtraction is a lower priority.
0-2^2
results in -4.

Does that help?


Regards,
Fred.
 
J

joel

Excel is performing the operations using the standard precendence wit
mathematical operations

the order is generally

^ first from left to right
* and / from left to right
+ and - from left to righ
 
J

Joe User

Tim Walters said:
Is there a way to customize this in Excel so that
-2^2 = -4?

No, at least not in Excel 2003. Operator precedence is not configurable.

Shouldn't minus a squared number be a minus number?

Arguing about the correctness (or not) of operator precedence among computer
languages is like arguing about the correctness of the order of
adverbial/verb and adjective/noun among natural languages. At least one
computer language eschewed operator precedence rules altogether. Whose to
say that is wrong?

When you learn a natural language, you learn its peculiar grammar rules as
well as its vocabulary. Similarly with computer languages and applications
like Excel that have a significant language for expressing things.

It is fair to say that Excel's precedence order between unary negation and
exponentiation is different from conventional mathematics. That is neither
"right" nor "wrong". Arguably, it would be "wrong" if Excel was marketed as
a language for expressing mathematics. But I do not believe MS has never
made that claim. (Obviously they shouldn't.)

As far as compatibility among spreadsheet products, Excel's
backward-compatibility models are Multiplan, Lotus and Visicalc, probably in
that order. Those were the market leaders of their day.

A human user must make appropriate adjustments when moving from one product
to another similar product. MS Word is very different from WordPerfect.
Likewise, Excel is different from Quattro Pro, albeit perhaps not quite as
dissimilar in some respects.

However, a QuattroPro-to-Excel converter should handle the differences
appropriately. In particular, the Quattro Pro formula -2^2 should be
converted to the Excel formula -(2^2) or -POWER(2,2). If it is not, that is
a defect in the converter, not a flaw in Excel operator precedence.


----- original message -----
 
B

Bill Sharpe

Tim said:
Shouldn't minus a squared number be a minus number? In Excel -2^2 = 4. To
keep it negative I have to write -(2^2). It's very easy to make mistakes
because I also work with Quattro Pro which works differently. Is there a
way to customize this in Excel so that -2^2 = -4?

Thanks.
In Excel help, type in "order of precedence."
First, Excel negates the 2.
Then it squares -2.
That results in +4.
I can't speak for Quattro Pro, as I haven't used it for years, but
always thought it was a better product than Lotus 1-2-3.

Bill
 
T

Tim Walters

Joe User said:
No, at least not in Excel 2003. Operator precedence is not configurable.



Arguing about the correctness (or not) of operator precedence among
computer languages is like arguing about the correctness of the order of
adverbial/verb and adjective/noun among natural languages. At least one
computer language eschewed operator precedence rules altogether. Whose to
say that is wrong?


Surely, if Excel treats -2^2 differently from +0-2^2, one has a right to
claim that it obliges one to use DIFFERENT grammars in the same language.
After all, the two statements are arithmetically identical.
 
J

Joe User

Tim Walters said:
Surely, if Excel treats -2^2 differently from +0-2^2,
one has a right to claim that it obliges one to use
DIFFERENT grammars in the same language.

Only if you ass-u-me something about the precedence of unary negation.

Excel has only one grammar. And in that grammar, unary negation has
precedence over exponential. If you don't like it, don't use Excel. Do us
all a favor ;-).

After all, the two statements are arithmetically identical.

It is fair to say that the two expressions are identical in the language of
mathematics.


----- original message -----
 
J

Joe User

PS....

Tim Walters said:
Excel treats -2^2 differently from +0-2^2
[.... But]
the two statements are arithmetically identical

FYI, I notice that the equivalent of -2^2 and 0-2^2 have different results
using the MS Calculator that comes with(?) Win XP, if you perform the
operations left-to-right as you read them.

My point is not to justify Excel's choice of precedence rules, but instead
to debunk your assertion that there is some God-given rule that the two
expressions are "arithmetically identical".

I reiterate.... They are identical in the language of mathematics. Whether
or not they are identical in another language is the prerogative of the
language designer to decide.


----- original message -----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top