quote:</font><HR>Originally posted by Pyros:
Wait a sec, take a look at the following code involving brackets again.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:
The program produces the following output:
-16
-16
16
My question is, the 1st and 3rd are almost alike except for the brackets. What exactly are the brackets doing there? Are they making it go from a negative to a postivte?
Let's take this back to math class >
![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif)
) Remember the order of operations(
Please
Excuse
my
dear
aunt
Sally
![[Linked Image]](https://ubbdev.com/ubb/smilies/biggrin.gif)
). So for the first one the power is first: The computer things 2 ** 4 before the - is evaluated. For the second, it is doing the exact same. No need for the paren's, since the exponent is already evaluated first. For the last one, what is in the paren's is always evaluated first. That means the number being taken to the power is -2. When taking a negative number to a power, it will always be positive.
Speaking of math, does anybody know of a CGI script that would handle imaginary numbers(what is returned when taking the square root of a negative number) I would like to see the way the computer has to think to do that
![[Linked Image]](https://ubbdev.com/ubb/smilies/biggrin.gif)
------------------
Da Wannabe Cannuck