title: Is multiplication by zero a special case?
body: <p>I'm writing a code where optimization is a real issue, I really need to get this piece of code running as fast as possible.</p>
  
  <p>So I have somthing like:</p>
  
  <p>a is a double and x is an int.
  in my specific case x is always 2 or 3</p>
  
  <pre><code>double c1[3] = {5345.4364654, 43346.6876978, 1224324.654756};
  double c2[3] = {49876.642543678, 1104.57576756};
  ...
  ..
  if (x&gt;2)
     a = c1[0]*x*x*x-c1[1]*x*x+c1[2]*x;
  else
     a = c2[0]*x*x+c2[1]*x;
  </code></pre>
  
  <p>I wonder if it will be faster if I remove the if..else and do something like</p>
  
  <pre><code>double c [2][3] = { 
                        {5345.4364654, 43346.6876978 , 1224324.654756},
                        {0           ,49876.642543678, 1104.575767561}
                       };
  
  a = c1[x-2][0]*x*x*x-c1[x-2][1]*x*x+c1[x-2][2]*x;
  </code></pre>
  
  <p>it seemes to me that the second code would run faster if multiplication by zero is treated as a "special case" by the compiler but I'm not sure about that</p>
  
  <p>if any of you guys have an idea plz help :)
  Many thanks</p>