Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> On Sun, 23 Oct 2005 20:59:46 -0400, Mike Meyer <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to