title: Compare rounded floats in Python
body: <p>I know that in general two floats must be compared like abs(f1-f2) &lt; 1e-6, but if they are rounded before comparison is it safe to compare their rounded values for equality in Python?</p>
  
  <pre><code>if round(f1,5)==round(f2,5):
      print "equal"
  else
      print "unequal"
  </code></pre>
  
  <p>Thanks</p>