in reply to Re: Operator Precedence (unary negation and exponentiation)
in thread Operator Precedence (unary negation and exponentiation)
Negation is ranked above multiplication while subtraction is ranked below. This means that
-2*3 is evaluated as (-2)*3
while
0-2*3 is evaluated as 0-(2*3)
I cannot think of any practical circumstance where this would lead to a different answer!
I have just been chatting to a mathematician about this and we agreed that the reason we would expect -2**3 to mean (-2)**3 is that we do not think of unary negation as a operation at all. Rather, we think of "-2" as a number.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Operator Precedence (unary negation and exponentiation)
by pdcawley (Hermit) on Jan 19, 2003 at 02:17 UTC | |
by Elliott (Pilgrim) on Jan 23, 2003 at 01:55 UTC | |
by pdcawley (Hermit) on Jan 23, 2003 at 04:59 UTC |