On Dec 6, 1:12 am, Raymond Hettinger <pyt...@rcn.com> wrote: > On Dec 5, 11:42 pm, Tim Roberts <t...@probo.com> wrote: > > > Raymond Hettinger <pyt...@rcn.com> wrote: > > > > if not round(x - y, 6): ... > > > That's a dangerous suggestion. It only works if x and y happen to be > > roughly in the range of integers. .> .> Right. Using abs(x-y) < eps is the way to go. .> .> Raymond
This only works when abs(x) and abs(y) are larger that eps, but not too much larger. Mark's suggestion is longer, but it works. The downside is it requires you to think about the scale and accuracy of your application. Dale B. Dalrymple -- http://mail.python.org/mailman/listinfo/python-list