[Python-Dev] math.areclose ...?
Aahz
aahz at pythoncraft.com
Sun Feb 5 19:01:24 CET 2006
More information about the Python-Dev mailing list
Sun Feb 5 19:01:24 CET 2006
- Previous message: [Python-Dev] math.areclose ...?
- Next message: [Python-Dev] math.areclose ...?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Feb 05, 2006, Alex Martelli wrote: > > But pulling in the whole of Numeric just to have that one handy > function is often overkill. So I was wondering if module math (and > perhaps by symmetry module cmath, too) shouldn't grow a function > 'areclose' (calling it just 'close' seems likely to engender > confusion, since 'close' is more often used as a verb than as an > adjective; maybe some other name would work better, e.g. > 'almost_equal') taking two float arguments and optional tolerances > and using roughly the same specs as Numeric, e.g.: > > def areclose(x,y,rtol=1.e-5,atol=1.e-8): > return abs(x-y)<atol+rtol*abs(y) Looks interesting. I don't quite understand what atol/rtol are, though. You're right that another name would be better; almost_equal is fine. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "19. A language that doesn't affect the way you think about programming, is not worth knowing." --Alan Perlis
- Previous message: [Python-Dev] math.areclose ...?
- Next message: [Python-Dev] math.areclose ...?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list