version 1.3, 2007/08/12 13:13:20
|
version 1.5, 2007/08/12 13:48:53
|
Line 7
|
Line 7
|
\ VERSION 1.1 |
\ VERSION 1.1 |
|
|
\ revised by Anton Ertl 2007-08-12 |
\ revised by Anton Ertl 2007-08-12 |
\ added fp comparisons (note: BASE is HEX after loading this file) |
\ The original has two shortcomings: |
\ environmental dependency on separate fp stack |
|
\ the sensitivity of the fp comparison is determined by FSENSITIVITY |
\ - It does not work as expected if the stack is non-empty before the {. |
\ added support for non-empty stack at the start |
|
|
\ - 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. |
|
|
|
\ - 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 } |
HEX |
HEX |
|
|
\ SET THE FOLLOWING FLAG TO TRUE FOR MORE VERBOSE OUTPUT; THIS MAY |
\ SET THE FOLLOWING FLAG TO TRUE FOR MORE VERBOSE OUTPUT; THIS MAY |
Line 45 VARIABLE ERROR-XT
|
Line 81 VARIABLE ERROR-XT
|
FALSE |
FALSE |
[THEN] |
[THEN] |
[IF] \ WE HAVE FP WORDS AND A SEPARATE FP STACK |
[IF] \ WE HAVE FP WORDS AND A SEPARATE FP STACK |
FVARIABLE FSENSITIVITY -1E-12 FSENSITIVITY F! |
FVARIABLE FSENSITIVITY DECIMAL 0E HEX FSENSITIVITY F! |
VARIABLE ACTUAL-FDEPTH |
VARIABLE ACTUAL-FDEPTH |
CREATE ACTUAL-FRESULTS 20 FLOATS ALLOT |
CREATE ACTUAL-FRESULTS 20 FLOATS ALLOT |
VARIABLE START-FDEPTH |
VARIABLE START-FDEPTH |