Re: Syntax across languages
- From: Mike Meyer <mwm@xxxxxxxxx>
- Date: Mon, 24 Oct 2005 01:44:05 -0400
Dennis Lee Bieber <wlfraed@xxxxxxxxxxxxx> writes:
> On Sun, 23 Oct 2005 20:59:46 -0400, Mike Meyer <mwm@xxxxxxxxx> 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@xxxxxxxxx> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
.
- References:
- Re: Syntax across languages
- From: Tom Anderson
- Re: Syntax across languages
- From: Mike Meyer
- Re: Syntax across languages
- Prev by Date: Re: output from external commands
- Next by Date: Re: testing '192.168.1.4' is in '192.168.1.0/24' ?
- Previous by thread: Re: Syntax across languages
- Next by thread: Re: Syntax across languages
- Index(es):
Relevant Pages
|