Syntax across languages

Mike Meyer mwm at mired.org
Mon Oct 24 01:44:05 EDT 2005


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> On Sun, 23 Oct 2005 20:59:46 -0400, Mike Meyer <mwm at mired.org> declaimed
> the following in comp.lang.python:
>
>> Hopefully user defined. Rexx has a global control that lets you set
>> the number of digits to be considered significant in doing an FP
>> equality test.
>> 
> 	That's the good part about the REXX model...
>
> 	The bad part? It's based on the number of significant digits...
> Rather than a true epsilon.

Depends on what you mean by "a true epsilon". If you mean "I want the
two values to differ by at most 10^-5", then number of significant
digits is a better option. If you mean "I want the two values to
differ by at most 1 part in 10^5", then number of significant digits
is a slightly less flexible option.

You really, *really* don't want to specify the acceptable difference
as a fixed value. You want it to be relative to the size of objects
being compared. The latter is what number of significant digits gives
you. The downside is that you're restricted to values that are a power
of 10, and can't specify things like "I want the two values to differ
by at most one part in 34,000" or some such oddity. On the up side,
number of significant digits is (maybe was - been a long time since I
did any serious number crunching) a common form for expressing the
accuracy of a calculation.

         <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list