unittest: Proposal to add failUnlessNear

Roy Smith roy at panix.com
Thu Jul 22 08:30:49 EDT 2004


In article <10fu44tgo7cald0 at news.supernews.com>,
 "John Roth" <newsgroups at jhrothjr.com> wrote:

> "Tim Peters" <tim.peters at gmail.com> wrote in message
> news:mailman.682.1090448229.5135.python-list at python.org...
> 
> 
> > Nope.  abs(a - b) works for both cases, although for complex numbers
> > Python uses a numerical method less prone to spurious
> > overflow/underflow than the "square root of the sum of the squares"
> > formula.
> 
> I didn't know that. It does make sense to do something like
> that, but it seems a bit like deep magic to make abs
> recognize that the operand is a subtraction.
> 
> John Roth
> >

It's not deep magic at all.  It's just the normal rules of complex math.



More information about the Python-list mailing list