title: Can division by non-zero still create a nan / infinity
body: <p>I have a number which might be zeros. I divide by that number so I want to test if it's zero to prevent NaN's and infinitys. Is it possible that I still create NaNs / infinity because of rounding errors within the division? </p>
  
  <pre class="lang-cpp prettyprint-override"><code>double x; // might be zero
  double y;
  
  if(x != 0) return y / x;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks for the responses. I'll add some subquestions then.</p>
  
  <p>1) assuming neither x nor y is NaN / +inf or -inf, would a division that results in -inf / +inf result in more CPU cycles or any other unwanted behaviour? (Could it crash?) </p>
  
  <p>2) is there a way to prevent the division from resulting in infinity? Using offsets and so on. </p>