Re: New version of John Hayes' tester



Krishna Myneni wrote:
Anton Ertl wrote:

Concerning the fine-tuning, I meant the REL-NEAR and ABS-NEAR stuff;
with FSENSITIVITY you can do either relative (negative FSENSITIVITY)
or absolute (positive FSENSITIVITY) approximate comparison, but not
both at once. Do you use that?


When a nearness comparison is made, ftester does both absolute nearness
("FABS=") and relative nearness ("FREL=") comparsions in the word "FNEARLY=".
There are two different parameters to specify the absolute and relative
tolerances (sensitivities).

Offhand it seems that one test or the other would be sufficient; however, one
may want to do both tests if the results are being compared against reference
values on a system with unknown fp precision.

Perhaps David has another justification for doing both tests.



In ftester, David comments on the justification for doing both absolute and
relative nearness tests in the word "FNEARLY=". If the two numbers being
compared are very small, their difference may be affected by truncation so that
a valid nearness test is not possible.

The following example may be instructive. Using a negative third argument for
F~, we perform the following relative nearness tests:

1e 1.01e -0.005e F~ . => -1 ( ok )
1e-15 1.01e-15 -0.005e F~ . => -1 ( ok )
1e-318 1.01e-318 -0.005e F~ . => -1 ( ok )
1e-319 1.01e-319 -0.005e F~ . => 0 ( incorrect )

The result for the last case is incorrect due to finite size representation
errors. Using an absolute nearness test, with a matching tolerance, also fails.

1e-319 1.01e-319 0.01005e-319 F~ . => 0 ( ok )

From the above example, it is not clear whether or not doing both types of
nearness tests gains us any more robustness in the test.


A side rant on "F~"
-------------------

The word F~ really is three different words, which are explicitly spelled out in
ftester:

FEXACTLY= ( not the same as F= which gives true when comparing 0e and -0e)
FABS=
FREL=

It may be justified to combine the first two functions into one word, but
combining the latter function into F~ is poor design. The relative
nearness test should have been specified as a separate word in the Forth
language standard. Using the sign of the tolerance to distinguish between
absolute and relative nearness tests is confusing and prone to misuse. For
comparing physical quantities, the tolerance parameter does not even have the
same units for absolute and relative comparisons (in the latter case, the
tolerance is dimensionless).


Krishna

.



Relevant Pages

  • Re: New version of John Hayes tester
    ... >>> with FSENSITIVITY you can do either relative ... >> When a nearness comparison is made, ftester does both absolute nearness ... > a valid nearness test is not possible. ... magnitude as the tolerance, eps. ...
    (comp.lang.forth)
  • Re: The Bet
    ... the absolute value with the same percentage tolerance. ... within my percentage threshold. ... I gave you both the tolerance of the 12x12x3 inch plate in both microinches ... That is not what informational entropy means. ...
    (talk.origins)
  • The Tolerance of Intolerance
    ... The Tolerance of Intolerance ... The practice of the atheists/evolutionists is to demand tolerance for ... their views to the absolute intolerance of anything of the Christian. ...
    (alt.religion.christian)
  • Re: revised quadratic.fs
    ... version performs slightly poorer with respect to absolute error of the ... The tolerance is the distance from zero in the complex plane, ... it represents an absolute error rather than a relative error. ...
    (comp.lang.forth)