When adding equations and formulas to programs, there are many ways to express the same thing. Which of the methods in each group, of which have the exact same effect mathematically, is the fastest, the second-fastest, and so on (in other words, the fastest to the slowest)?

my_var = another_var*2/3;

my_var = another_var*12/18; // see notes on why this would be used

my_var = another_var*0.6666666666666667; // not decent when integerical variables are used

my_var = another_var*2/3;

my_var = another_var*(2/3);

my_var += another_var*(third_var-4/fourth_var)+2; // minimal use of parentheses

my_var += (another_var*(third_var-(4/fourth_var))+2); // excessive use of parentheses

my_var = pow(another_var, 2.0);

my_var = another_var*another_var;

my_var = pow(another_var, 0.5);

my_var = sqrt(another_var);

my_var = another_var+another_var;

my_var = another_var*2;

The first group represents fractions. When doing a series like this:

my_var = another_var/8; // obviously faster - fewer operators

my_var = another_var/4; // same as above

my_var = another_var*3/8; // three-eighths

my_var = another_var/2;

my_var = another_var*5/8;

my_var = another_var*3/4; // reduced from six-eighths

my_var = another_var*7/8;

It's a bit tricky to tell what the fractions are, but if I did this instead:

my_var = another_var*1/8;

my_var = another_var*2/8;

my_var = another_var*3/8;

my_var = another_var*4/8;

my_var = another_var*5/8;

my_var = another_var*6/8;

my_var = another_var*7/8;

my_var = another_var*8/8;

It's much easier to see the fractions. I use this in my 2D game to get realistic scaling effects and thus a realistic 3D appearance.

The other is only useful when floating point values are used (the float and double).

The next two groups involve the usage of parentheses, particularly whether or not excessive parentheses have any effect on the speed. Given that multiplication and division come first before addition and subtraction, there is no need to group the multiplication, unless a higher order operation is used and the multiplication needs to be done first.

The next involve different ways of doing the same thing. Raising something to the second power is the same as multiplying it by itself. Raising something to the 0.5 power is the same as taking the square root of something and either of these methods could work. Which are the faster and slower methods?