Exponents/negative numbers

It's pretty hard to tell when written like that.

Perhaps this piece will help: [math]-8^{-2} = -\dfrac{1}{8^{2}} = -\dfrac{1}{64}[/math]
 
I thought (-8)x(-8)=+64
I was hoping that this would give you the opportunity to question. You have done well. It may or may not mean what I have stated. It depends on the context and I really just wanted you to ask the question.

That thing out front is called a "Unary Minus" in some cases. You must decide if [math]-8^{2}[/math] means [math]-\left(8^{2}\right)[/math] or [math]\left(-8\right)^{2}[/math]. Your book or instructor should be VERY CLEAR about this.

Programming languages are persnickety about this sort of thing. You must ask each language what it thinks about it. Just one example for "C":
Notice how Unary Minus is precedence level two and multiple occurrences are evaluated right-to-left.
Multiplication and Division are precedence level three and multiple occurrences are evaluated left-to-right.
Addition and subtraction are precedence level four and multiple occurrences are evaluated left-to-right.

Thus, the SAME symbols, "+" and "-" can have completely different meanings, depending on the context.

Rule of thumb: Add parentheses to clarify intent. If there can exist ANY ambiguity, add the parentheses and eliminate it.
 
I thought (-8)x(-8)=+64
[MATH](- 8)^2 = (- 8) * (- 8) = 64.[/MATH]
[MATH]- 8^2 = - (8 * 8) = - (64) = - 64.[/MATH]
I am really saying the same thing as tkhunny, but exponentiation is not an operation in C. Instead, it is a function call. So you can't explicitly find exponentiation in the table he cites. You have to look for the precedence of function calls, which is level one.

Exponentiation is an operation in algebra and takes precedence over the unary minus.
 
Top