[Tutor] nice()

Ismael Garrido ismaelgf at adinet.com.uy
Mon Feb 13 05:09:33 CET 2006


Smith wrote:
> I've been thinking about a function that was recently proposed at 
> python-dev named 'areclose'. It is a function that is meant to tell 
> whether two (or possible more) numbers are close to each other. It 
> is a function similar to one that exists in Numeric. One such 
> implementation is
> [Snip]

How about overloading Float comparison? I'd say that'd "nicer". BTW: 
Nice is not an... em.. nice name for a function that does what you describe.

If I have understood correctly, float to float comparison must be done 
comparing relative errors, so that when dealing with small but rightly 
represented numbers it won't tell "True" just because they're "close". I 
think your/their solution only covers the case when dealing with "big" 
numbers.

Ismael


More information about the Tutor mailing list