Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 3,590
Likes: 1
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
Likes: 1
Code
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]) Remember the order of operations(Please Excuse my dear aunt Sally [Linked Image]). 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]



------------------
Da Wannabe Cannuck

Sponsored Links
Entire Thread
Subject Posted By Posted
Order of Precedence Question Pyros 09/25/2000 1:55 AM
Re: Order of Precedence Question SonnyBlack 09/25/2000 6:06 AM
Re: Order of Precedence Question Pyros 09/25/2000 10:36 PM
Re: Order of Precedence Question SonnyBlack 09/25/2000 11:29 PM
Re: Order of Precedence Question The Team 09/26/2000 12:24 AM
Re: Order of Precedence Question Pyros 09/26/2000 12:25 AM
Re: Order of Precedence Question Pyros 09/26/2000 12:28 AM
Re: Order of Precedence Question SonnyBlack 09/26/2000 1:09 AM
Re: Order of Precedence Question Pyros 09/26/2000 1:19 AM
Re: Order of Precedence Question SonnyBlack 09/26/2000 1:27 AM
Re: Order of Precedence Question Pyros 09/26/2000 1:33 AM
Re: Order of Precedence Question Twenty7 09/26/2000 1:43 AM
Re: Order of Precedence Question Pyros 09/26/2000 1:49 AM
Re: Order of Precedence Question SonnyBlack 09/26/2000 2:00 AM
Re: Order of Precedence Question Pyros 09/26/2000 2:07 AM
Re: Order of Precedence Question SonnyBlack 09/26/2000 2:15 AM
Re: Order of Precedence Question The Team 09/26/2000 2:30 AM
Re: Order of Precedence Question Pyros 09/26/2000 10:22 PM
Re: Order of Precedence Question The Team 09/27/2000 12:23 AM
Re: Order of Precedence Question SonnyBlack 09/27/2000 12:43 AM
Re: Order of Precedence Question The Team 09/27/2000 1:37 AM
Re: Order of Precedence Question SonnyBlack 09/27/2000 1:45 AM
Re: Order of Precedence Question Pyros 09/27/2000 2:21 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,583
Posts293,956
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 2278
Topics Created 0
Posts Made 0
Users Online 2
Birthdays 24
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
isaac 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261016)