New version of John Hayes' tester
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
New version of John Hayes' tester         


Author: Anton Ertl
Date: Aug 12, 2007 05:12

John Hayes tester is used in his core test suite, but also in other
test suites. It has two shortcomings:

- It does not work as expected if the stack is non-empty before the {.

- It does not check FP results if the system has a separate FP stack.

I have revised it to address both shortcomings. You can find the
result at

http://www.forth200x.org/tests/tester.fs

It is intended to be a drop-in replacement of the original.

In spirit of the original, I have strived to avoid any potential
non-portabilities and stayed as much within the CORE words as
possible; e.g., FLOATING words are used only if the FLOATING wordset
is present and the FP stack is separate.

There are a few things to be noted:

- Following the despicable practice of the original, this version sets
the base to HEX for everything that gets loaded later.
Floating-point input is ambiguous when the base is not decimal, so
you have to set it to decimal yourself when you want to deal with
decimal numbers.
Show full article (1.89Kb)
42 Comments
Re: New version of John Hayes' tester         


Author: Coos Haak
Date: Aug 13, 2007 11:01

Op Sun, 12 Aug 2007 12:12:33 GMT schreef Anton Ertl:
> John Hayes tester is used in his core test suite, but also in other
> test suites. It has two shortcomings:
>
> - It does not work as expected if the stack is non-empty before the {.
>
> - It does...
Show full article (2.04Kb)
no comments
Re: New version of John Hayes' tester         


Author: Anton Ertl
Date: Aug 13, 2007 12:21

no comments
Re: New version of John Hayes' tester         


Author: Krishna Myneni
Date: Aug 13, 2007 17:10

Anton Ertl wrote:
> John Hayes tester is used in his core test suite, but also in other
> test suites. It has two shortcomings:
> ...
> - The separate-FP-stack code has an fvariable FSENSITIVITY that allows
> approximate matching of FP results (it's used as the r3 parameter of
> F~). However, that's used only in the separate-fp-stack case. With
> a shared-fp-stack you get exact matching in any case (actually
> FSENSITIVITY variable is not even defined in that case). So if you
> define an FP test case and want to support shared-FP-stack systems,
> better do the approximate matching yourself. E.g., instead of
>
> -1e-12 fsensitivity f!
> { ... computation ... -> 2.345678901e }
>
> write
>
> { ... computation ... 2.345678901e -1e-12 f~ -> true }
>
> - anton ...
Show full article (1.60Kb)
no comments
Re: New version of John Hayes' tester         


Author: Anton Ertl
Date: Aug 14, 2007 00:00

Krishna Myneni bellsouth.net> writes:
>David Williams' ftester module addresses the fp issues separately.

It's at
<http://www-personal.umich.edu/~williams/archive/forth/utilities/ftester.fs>.

The similarities in source code with my extension are interesting (in
particular, he performed similar code duplication and placed
additional Fs at the same places as I did).

However, it does not fix the empty-stack-only shortcoming, and the
only potential advantage it has over my extension is that the
approximate comparison can be more finely tuned.
>one can use "F->", analogous to "->" in tester, to test multiple fp
>results from a computation (some words will return more than one fp result, e.g.
>FSINCOS).

You can also test multiple FP results with my extension, and there's
no need for F-> or F} there:

decimal { 0e fsincos -> 0e 1e }

Moreover, with my extension you can also test code that has mixed
integer and fp results:

decimal { s" 1.23" >float -> 1.23e true }
Show full article (2.04Kb)
no comments
Re: New version of John Hayes' tester         


Author: Krishna Myneni
Date: Aug 14, 2007 04:56

Anton Ertl wrote:
> Krishna Myneni bellsouth.net> writes:
>> David Williams' ftester module addresses the fp issues separately.

I should have given the link. Thanks.
> The similarities in source code with my extension are interesting (in
> particular, he performed similar code duplication and placed
> additional Fs at the same places as I did).
>
> However, it does not fix the empty-stack-only shortcoming, and the
> only potential advantage it has over my extension is that the
> approximate comparison can be more finely tuned.
>

Perhaps this tuning can be folded into your version (in particular, the use of
the ?EXACT flag to force exact fp comparisons).
Show full article (2.88Kb)
no comments
Re: New version of John Hayes' tester         


Author: Anton Ertl
Date: Aug 14, 2007 05:43

Krishna Myneni bellsouth.net> writes:
>Anton Ertl wrote:
>> However, it does not fix the empty-stack-only shortcoming, and the
>> only potential advantage it has over my extension is that the
>> approximate comparison can be more finely tuned.
>>
>
>Perhaps this tuning can be folded into your version (in particular, the use of
>the ?EXACT flag to force exact fp comparisons).

The matching is exact by default (FSENSITIVITY is set to 0E), and you
can make it exact with

decimal 0e fsensitivity f!

Or do you mean that you want to have words EXACT?, SET-EXACT, SET-NEAR
as present in ftester.fsq?

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?
Show full article (2.65Kb)
no comments
Re: New version of John Hayes' tester         


Author: David N. Williams
Date: Aug 14, 2007 06:47

I just got back from a trip and saw this.

Anton Ertl wrote:
> Krishna Myneni bellsouth.net> writes:
>> David Williams' ftester module addresses the fp issues separately.
>
> It's at
>
>
> The similarities in source code with my extension are interesting (in
> particular, he performed similar code duplication and placed
> additional Fs at the same places as I did).

:-)
> However, it does not fix the empty-stack-only shortcoming, and the
> only potential advantage it has over my extension is that the
> approximate comparison can be more finely tuned.

I agree that empty-stack-only is a shortcoming.
Show full article (1.57Kb)
no comments
Re: New version of John Hayes' tester         


Author: Krishna Myneni
Date: Aug 14, 2007 22:32

Anton Ertl wrote:
> Krishna Myneni bellsouth.net> writes:
>> Anton Ertl wrote:
>>> However, it does not fix the empty-stack-only shortcoming, and the
>>> only potential advantage it has over my extension is that the
>>> approximate comparison can be more finely tuned.
>>>
>> Perhaps this tuning can be folded into your version (in particular, the use of
>> the ?EXACT flag to force exact fp comparisons).
>
> The matching is exact by default (FSENSITIVITY is set to 0E), and you
> can make it exact with
>
> decimal 0e fsensitivity f!
>
> Or do you mean that you want to have words EXACT?, SET-EXACT, SET-NEAR
> as present in ftester.fsq?
>
Show full article (2.54Kb)
no comments
Re: New version of John Hayes' tester         


Author: Krishna Myneni
Date: Aug 16, 2007 03:30

Krishna Myneni wrote:
> Anton Ertl wrote:
Show full article (2.65Kb)
5 Comments
1 2 3 4 5