Re: New version of John Hayes' tester
- From: Krishna Myneni <krishnamyneni@xxxxxxxxxxxxx>
- Date: Tue, 14 Aug 2007 06:56:10 -0500
Anton Ertl wrote:
Krishna Myneni <krishnamyneni@xxxxxxxxxxxxx> writes:
David Williams' ftester module addresses the fp issues separately.
It's at
<http://www-personal.umich.edu/~williams/archive/forth/utilities/ftester.fs>.
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).
...
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 }
Ok. Thanks. I got the impression from the example in your original message that
you can only test a single result, and in order to do that, you must explicitly
use "F~".
Moreover, with my extension you can also test code that has mixed
integer and fp results:
decimal { s" 1.23" >float -> 1.23e true }
You can also do this with ftester, but you have to write:
{ f{ s" 1.23" >float -> f-> 1.23e true } }f
I haven't encountered the mixed result case so far, and have not looked at it.
But it is certainly an advantage if it can be handled without additional
complication.
I have ported ftester to an integrate fp/data stack system as well,
I don't see how you can use the approximate testing without additional
specifications about which stack items are floats and which are
integers.
Yes, the mixed result types pose a problem for integrated stack systems, since
we need the nearness comparison when working with fp. In practice so far it has
not been a problem, since most of the time the results are all either fp, or an
integer flag. But the issue will certainly arise.
Hmm, I could add replacement words for } like FIFI}, which would
specify that the results are of the form ( r x r x ), and do
approximate comparisons for the rs; that would work for both
separate-stack and mixed-stack systems. The test above would then
look like:
decimal { s" 1.23" >float -> 1.23e true fi}
...
Thanks for offering, but I believe it is neither worth the time, nor desirable,
to add words like "FIFI}" to your module. I think integrated stack Forths will
have to work around this issue in a different way.
However, it would be a useful exercise to make use of your new version of tester
to perform the tests in the complex-test module, which may also be found at:
http://www-personal.umich.edu/~williams/archive/forth/complex/
I may take a shot at this, when time permits.
Krishna
.
- Follow-Ups:
- Re: New version of John Hayes' tester
- From: Anton Ertl
- Re: New version of John Hayes' tester
- References:
- New version of John Hayes' tester
- From: Anton Ertl
- Re: New version of John Hayes' tester
- From: Krishna Myneni
- Re: New version of John Hayes' tester
- From: Anton Ertl
- New version of John Hayes' tester
- Prev by Date: Re: RfD: Number Prefixes
- Next by Date: Re: RfD: Number Prefixes
- Previous by thread: Re: New version of John Hayes' tester
- Next by thread: Re: New version of John Hayes' tester
- Index(es):