title: How to avoid `RuntimeWarning` for divide by zero when the value is unusued?
body: <p>I need to write a function to calculate the <code>(exp(x) - 1) / x</code>, taking into the account the fact that as <code>x</code> approaches <code>0</code> the function approaches <code>1</code>.   I have the following implementation</p>
  
  <pre><code>def f(x):
      return np.where(x == 0, 1.0, np.expm1(x) / x)
  </code></pre>
  
  <p>This is correct in the sense that it returns correct values, but the annoying thing is that when it is called with an <code>x</code> argument that contains zeros, it issues a <code>RuntimeWarning: invalid value encountered in true_divide</code>.  I understand that this is because the division by zero actually happens in the third argument of <code>where</code> although those <code>nan</code> values are never used.</p>
  
  <p>Is there a better implementation or a way to avoid the annoying warning?</p>