Re: Syntax across languages



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.
.



Relevant Pages

  • Re: controversial paper
    ... I need only specify a location (the zero ... bits that differ. ... regions to the network (add more digits on the right). ...
    (sci.crypt)
  • Re: INT defect: Please try this on 2007 for me
    ... Not that I would object to a calculation option that would do just that, namely: force the result of all formulas to be rounded to 15 significant digits, not unlike the "Precision as displayed" option, but more generally applied. ... That would legitimatize some of the heuristics that Excel has implemented to try to ameliorate the aberrations due to binary floating point arithmetic. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Interesting math
    ... "C Float Number" must have "exactly six digits after the ... The "six or more significant digits" requirement has little ... data type called "float" that can represent floating-point ... articles, or your posts? ...
    (alt.usage.english)
  • Re: loan amortization
    ... you have about 14 significant digits. ... your are working on a $100,000.00 mortgage. ... An insurance company insider told me that they once spotted a penny difference ...
    (comp.lang.java.programmer)
  • Re: Adding Zeros as placeholders
    ... significant digits. ... >> Seth, ... >>> this works for items that are left justified and entries ...
    (microsoft.public.excel.worksheet.functions)