title: force Division by zero default to NaN instead of Inf
body: <p>I'm wondering if there might be a setting I'm overlooking to force <code>R</code> to return <code>NaN</code> instead of ±<code>Inf</code> when dividing by zero. </p>
  
  <p>I too often findmyself doing something like </p>
  
  <pre><code> results[is.infinite(results)] &lt;- NaN
  </code></pre>
  
  <p>I'm hoping to skip the filtering/search process altogether. </p>
  
  <hr>
  
  <h3>Example:</h3>
  
  <pre><code>### Example:
  
  num &lt;- c(1:5, NA)
  denom &lt;- -2:3
  
  quotient &lt;- num / denom
  [1] -0.5 -2.0  Inf  4.0  2.5   NA
  
  # desired results
  [1] -0.5 -2.0  NaN  4.0  2.5   NA
  </code></pre>
  
  <p>Simple way of achieving the desired results is: </p>
  
  <pre><code>quotient[is.infinite(quotient)] &lt;- NaN
  </code></pre>
  
  <p>What I am wondering is if that last step can be avoided while still getting the same desired results. </p>