Order of Operations -- In Terms of Efficiency
|
|
I'm not quite sure how efficient the different mathematical/comparative functions and operators are -- I'd undoubtedly be taught this in a course for a degree in Computer Science, but I don't have such a course handy. (Still have to finish off my math upgrading before I can get automatically accepted into university -- though I figure I might as well drop an application off for next year, and get myself a full-time job (I can handle it) to pay for the tuition... wow, am I ever getting off the topic at hand.)
My basic experience goes (in order from most expensive to least expensive):
**
log()
/
*
--
-=, &=
-, &
!, ~
&&, ||
max(), min()
==, <, >
++
+=, |=
+, |
=
If you see any errors, don't hesitate to correct them.
One question I have: since dividing is just multiplying a reciprocal, does that mean that using "num * 0.5" would be more efficient than "num / 2.0"? (Floating point math in both instances.)
|
Although there MUST be a website for the standards about thius. Did you try a google search? Also min/max are procedures... and I don't see an explicit procedure slot on that list (technically they are probably usually evaluated first)