[Python-Dev] math.areclose ...?

Raymond Hettinger python at rcn.com
Sun Feb 5 20:31:42 CET 2006


[Bob Ipppolito]
> For those of us that already know what we're doing with floating  
> point, areclose would be very convenient to have.

Do you agree that the original proposed use (helping newbs ignore floating
point realities) is misguided and error-prone?

Just curious, for your needs, do you want both absolute and relative 
checks combined into the same function?


>  Especially for  
> unit testing.  I could definitely throw away a bunch of ugly code  
> that uses less correct arbitrary tolerance guesses if it were around.

The unittest module already has assertAlmostEqual().  Does that
method meet your needs or does it need to be improved in some way?


Raymond


More information about the Python-Dev mailing list