title: How to avoid "RuntimeWarning: invalid value encountered in divide" in NumPy?
body: <p>I am trying to avoid the warning <code>RuntimeWarning: invalid value encountered in divide</code> in NumPy.</p>
  
  <p>I thought I could do:</p>
  
  <pre><code>import numpy as np
  
  A=np.array([0.0])
  print A.dtype
  with np.errstate(divide='ignore'):
      B=A/A
  print B
  </code></pre>
  
  <p>but this gives:</p>
  
  <pre><code>float64
  ./t.py:9: RuntimeWarning: invalid value encountered in divide
    B=A/A
  [ nan]
  </code></pre>
  
  <p>If I replace <code>B=A/A</code> with <code>np.float64(1.0) / 0.0</code> it gives no warning.</p>