title: Can floating point multiplication by zero be optimised at runtime?
body: <p>I am writing an algorithm to find the inverse of an nxn matrix. Let us take the specific case of a 3x3 matrix.</p>
  
  <p>When you invert a matrix by hand, you typically look for rows/columns containing one or more zeros to make the determinant calculation faster as it eliminates terms you need to calculate.</p>
  
  <p>Following this logic in C/C++, if you identify a row/column with one or more zeros, you will end up with the following code:</p>
  
  <pre><code>float term1 = currentElement * DetOf2x2(...);
  //           ^
  //           This is equal to 0.
  //
  // float term2 = ... and so on.
  </code></pre>
  
  <p>As the compiler cannot know <code>currentElement</code> will be zero at compile time, it cannot be optimised to something like <code>float term = 0;</code> and thus the floating point multiplication will be carried out at runtime.</p>
  
  <p>My question is, will these zero values make the floating point multiplication faster, or will the multiplication take the same amount of time regardless of the value of <code>currentElement</code>? If there is no way of optimising the multiplication at runtime, then I can remove the logic that searches for rows/columns containing zeros.</p>