|
|
|
@ -342,75 +342,76 @@ T{ MID-UINT+1 1 RSHIFT MID-UINT+1 OR 2 * -> MID-UINT+1 }T
|
|
|
|
|
\ T{ 1S 2 UM* -> 1S 1 LSHIFT 1 }T
|
|
|
|
|
\ T{ MAX-UINT MAX-UINT UM* -> 1 1 INVERT }T
|
|
|
|
|
|
|
|
|
|
\ \ ------------------------------------------------------------------------
|
|
|
|
|
\ TESTING DIVIDE: FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD
|
|
|
|
|
\
|
|
|
|
|
\ T{ 0 S>D 1 FM/MOD -> 0 0 }T
|
|
|
|
|
\ T{ 1 S>D 1 FM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ 2 S>D 1 FM/MOD -> 0 2 }T
|
|
|
|
|
\ T{ -1 S>D 1 FM/MOD -> 0 -1 }T
|
|
|
|
|
\ T{ -2 S>D 1 FM/MOD -> 0 -2 }T
|
|
|
|
|
\ T{ 0 S>D -1 FM/MOD -> 0 0 }T
|
|
|
|
|
\ T{ 1 S>D -1 FM/MOD -> 0 -1 }T
|
|
|
|
|
\ T{ 2 S>D -1 FM/MOD -> 0 -2 }T
|
|
|
|
|
\ T{ -1 S>D -1 FM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ -2 S>D -1 FM/MOD -> 0 2 }T
|
|
|
|
|
\ T{ 2 S>D 2 FM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ -1 S>D -1 FM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ -2 S>D -2 FM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ 7 S>D 3 FM/MOD -> 1 2 }T
|
|
|
|
|
\ T{ 7 S>D -3 FM/MOD -> -2 -3 }T
|
|
|
|
|
\ T{ -7 S>D 3 FM/MOD -> 2 -3 }T
|
|
|
|
|
\ T{ -7 S>D -3 FM/MOD -> -1 2 }T
|
|
|
|
|
\ T{ MAX-INT S>D 1 FM/MOD -> 0 MAX-INT }T
|
|
|
|
|
\ T{ MIN-INT S>D 1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T{ 1 S>D -1 SM/REM -> 0 -1 }T
|
|
|
|
|
\ T{ 2 S>D -1 SM/REM -> 0 -2 }T
|
|
|
|
|
\ T{ -1 S>D -1 SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ -2 S>D -1 SM/REM -> 0 2 }T
|
|
|
|
|
\ T{ 2 S>D 2 SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ -1 S>D -1 SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ -2 S>D -2 SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ 7 S>D 3 SM/REM -> 1 2 }T
|
|
|
|
|
\ T{ 7 S>D -3 SM/REM -> 1 -2 }T
|
|
|
|
|
\ T{ -7 S>D 3 SM/REM -> -1 -2 }T
|
|
|
|
|
\ T{ -7 S>D -3 SM/REM -> -1 2 }T
|
|
|
|
|
\ T{ MAX-INT S>D 1 SM/REM -> 0 MAX-INT }T
|
|
|
|
|
\ T{ MIN-INT S>D 1 SM/REM -> 0 MIN-INT }T
|
|
|
|
|
\ T{ MAX-INT S>D MAX-INT SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ MIN-INT S>D MIN-INT SM/REM -> 0 1 }T
|
|
|
|
|
\ T{ 1S 1 4 SM/REM -> 3 MAX-INT }T
|
|
|
|
|
\ T{ 2 MIN-INT M* 2 SM/REM -> 0 MIN-INT }T
|
|
|
|
|
\ T{ 2 MIN-INT M* MIN-INT SM/REM -> 0 2 }T
|
|
|
|
|
\ T{ 2 MAX-INT M* 2 SM/REM -> 0 MAX-INT }T
|
|
|
|
|
\ T{ 2 MAX-INT M* MAX-INT SM/REM -> 0 2 }T
|
|
|
|
|
\ T{ MIN-INT MIN-INT M* MIN-INT SM/REM -> 0 MIN-INT }T
|
|
|
|
|
\ T{ MIN-INT MAX-INT M* MIN-INT SM/REM -> 0 MAX-INT }T
|
|
|
|
|
\ T{ MIN-INT MAX-INT M* MAX-INT SM/REM -> 0 MIN-INT }T
|
|
|
|
|
\ T{ MAX-INT MAX-INT M* MAX-INT SM/REM -> 0 MAX-INT }T
|
|
|
|
|
\
|
|
|
|
|
\ ------------------------------------------------------------------------
|
|
|
|
|
." TESTING DIVIDE: FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD" CR
|
|
|
|
|
|
|
|
|
|
T{ 0 S>D 1 FM/MOD -> 0 0 }T
|
|
|
|
|
T{ 1 S>D 1 FM/MOD -> 0 1 }T
|
|
|
|
|
T{ 2 S>D 1 FM/MOD -> 0 2 }T
|
|
|
|
|
T{ -1 S>D 1 FM/MOD -> 0 -1 }T
|
|
|
|
|
T{ -2 S>D 1 FM/MOD -> 0 -2 }T
|
|
|
|
|
T{ 0 S>D -1 FM/MOD -> 0 0 }T
|
|
|
|
|
T{ 1 S>D -1 FM/MOD -> 0 -1 }T
|
|
|
|
|
T{ 2 S>D -1 FM/MOD -> 0 -2 }T
|
|
|
|
|
T{ -1 S>D -1 FM/MOD -> 0 1 }T
|
|
|
|
|
T{ -2 S>D -1 FM/MOD -> 0 2 }T
|
|
|
|
|
T{ 2 S>D 2 FM/MOD -> 0 1 }T
|
|
|
|
|
T{ -1 S>D -1 FM/MOD -> 0 1 }T
|
|
|
|
|
T{ -2 S>D -2 FM/MOD -> 0 1 }T
|
|
|
|
|
T{ 7 S>D 3 FM/MOD -> 1 2 }T
|
|
|
|
|
T{ 7 S>D -3 FM/MOD -> -2 -3 }T
|
|
|
|
|
T{ -7 S>D 3 FM/MOD -> 2 -3 }T
|
|
|
|
|
T{ -7 S>D -3 FM/MOD -> -1 2 }T
|
|
|
|
|
T{ MAX-INT S>D 1 FM/MOD -> 0 MAX-INT }T
|
|
|
|
|
T{ MIN-INT S>D 1 FM/MOD -> 0 MIN-INT }T
|
|
|
|
|
T{ MAX-INT S>D MAX-INT FM/MOD -> 0 1 }T
|
|
|
|
|
T{ MIN-INT S>D MIN-INT FM/MOD -> 0 1 }T
|
|
|
|
|
T{ 1S 1 4 FM/MOD -> 3 MAX-INT }T
|
|
|
|
|
T{ 1 MIN-IN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
|
|
|
T{ -2 S>D -2 SM/REM -> 0 1 }T
|
|
|
|
|
T{ 7 S>D 3 SM/REM -> 1 2 }T
|
|
|
|
|
T{ 7 S>D -3 SM/REM -> 1 -2 }T
|
|
|
|
|
T{ -7 S>D 3 SM/REM -> -1 -2 }T
|
|
|
|
|
T{ -7 S>D -3 SM/REM -> -1 2 }T
|
|
|
|
|
T{ MAX-INT S>D 1 SM/REM -> 0 MAX-INT }T
|
|
|
|
|
T{ MIN-INT S>D 1 SM/REM -> 0 MIN-INT }T
|
|
|
|
|
T{ MAX-INT S>D MAX-INT SM/REM -> 0 1 }T
|
|
|
|
|
T{ MIN-INT S>D MIN-INT SM/REM -> 0 1 }T
|
|
|
|
|
T{ 1S 1 4 SM/REM -> 3 MAX-INT }T
|
|
|
|
|
T{ 2 MIN-INT M* 2 SM/REM -> 0 MIN-INT }T
|
|
|
|
|
T{ 2 MIN-INT M* MIN-INT SM/REM -> 0 2 }T
|
|
|
|
|
T{ 2 MAX-INT M* 2 SM/REM -> 0 MAX-INT }T
|
|
|
|
|
T{ 2 MAX-INT M* MAX-INT SM/REM -> 0 2 }T
|
|
|
|
|
T{ MIN-INT MIN-INT M* MIN-INT SM/REM -> 0 MIN-INT }T
|
|
|
|
|
T{ MIN-INT MAX-INT M* MIN-INT SM/REM -> 0 MAX-INT }T
|
|
|
|
|
T{ MIN-INT MAX-INT M* MAX-INT SM/REM -> 0 MIN-INT }T
|
|
|
|
|
T{ MAX-INT MAX-INT M* MAX-INT SM/REM -> 0 MAX-INT }T
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ T{ 0 0 1 UM/MOD -> 0 0 }T
|
|
|
|
|
\ T{ 1 0 1 UM/MOD -> 0 1 }T
|
|
|
|
|
\ T{ 1 0 2 UM/MOD -> 1 0 }T
|
|
|
|
@ -418,133 +419,133 @@ T{ MID-UINT+1 1 RSHIFT MID-UINT+1 OR 2 * -> MID-UINT+1 }T
|
|
|
|
|
\ T{ MAX-UINT 2 UM* 2 UM/MOD -> 0 MAX-UINT }T
|
|
|
|
|
\ T{ MAX-UINT 2 UM* MAX-UINT UM/MOD -> 0 2 }T
|
|
|
|
|
\ T{ MAX-UINT MAX-UINT UM* MAX-UINT UM/MOD -> 0 MAX-UINT }T
|
|
|
|
|
\
|
|
|
|
|
\ : IFFLOORED
|
|
|
|
|
\ [ -3 2 / -2 = INVERT ] LITERAL IF POSTPONE \ THEN ;
|
|
|
|
|
\
|
|
|
|
|
\ : IFSYM
|
|
|
|
|
\ [ -3 2 / -1 = INVERT ] LITERAL IF POSTPONE \ THEN ;
|
|
|
|
|
\
|
|
|
|
|
\ \ THE SYSTEM MIGHT DO EITHER FLOORED OR SYMMETRIC DIVISION.
|
|
|
|
|
\ \ SINCE WE HAVE ALREADY TESTED M*, FM/MOD, AND SM/REM WE CAN USE THEM IN TEST
|
|
|
|
|
\
|
|
|
|
|
\ IFFLOORED : T/MOD >R S>D R> FM/MOD ;
|
|
|
|
|
\ IFFLOORED : T/ T/MOD SWAP DROP ;
|
|
|
|
|
\ IFFLOORED : TMOD T/MOD DROP ;
|
|
|
|
|
\ IFFLOORED : T*/MOD >R M* R> FM/MOD ;
|
|
|
|
|
\ IFFLOORED : T*/ T*/MOD SWAP DROP ;
|
|
|
|
|
\ IFSYM : T/MOD >R S>D R> SM/REM ;
|
|
|
|
|
\ IFSYM : T/ T/MOD SWAP DROP ;
|
|
|
|
|
\ IFSYM : TMOD T/MOD DROP ;
|
|
|
|
|
\ IFSYM : T*/MOD >R M* R> SM/REM ;
|
|
|
|
|
\ IFSYM : T*/ T*/MOD SWAP DROP ;
|
|
|
|
|
\
|
|
|
|
|
\ T{ 0 1 /MOD -> 0 1 T/MOD }T
|
|
|
|
|
\ T{ 1 1 /MOD -> 1 1 T/MOD }T
|
|
|
|
|
\ T{ 2 1 /MOD -> 2 1 T/MOD }T
|
|
|
|
|
\ T{ -1 1 /MOD -> -1 1 T/MOD }T
|
|
|
|
|
\ T{ -2 1 /MOD -> -2 1 T/M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
|
|
[ -3 2 / -2 = INVERT ] LITERAL IF POSTPONE \ THEN ;
|
|
|
|
|
|
|
|
|
|
: IFSYM
|
|
|
|
|
[ -3 2 / -1 = INVERT ] LITERAL IF POSTPONE \ THEN ;
|
|
|
|
|
|
|
|
|
|
\ THE SYSTEM MIGHT DO EITHER FLOORED OR SYMMETRIC DIVISION.
|
|
|
|
|
\ SINCE WE HAVE ALREADY TESTED M*, FM/MOD, AND SM/REM WE CAN USE THEM IN TEST
|
|
|
|
|
|
|
|
|
|
IFFLOORED : T/MOD >R S>D R> FM/MOD ;
|
|
|
|
|
IFFLOORED : T/ T/MOD SWAP DROP ;
|
|
|
|
|
IFFLOORED : TMOD T/MOD DROP ;
|
|
|
|
|
IFFLOORED : T*/MOD >R M* R> FM/MOD ;
|
|
|
|
|
IFFLOORED : T*/ T*/MOD SWAP DROP ;
|
|
|
|
|
IFSYM : T/MOD >R S>D R> SM/REM ;
|
|
|
|
|
IFSYM : T/ T/MOD SWAP DROP ;
|
|
|
|
|
IFSYM : TMOD T/MOD DROP ;
|
|
|
|
|
IFSYM : T*/MOD >R M* R> SM/REM ;
|
|
|
|
|
IFSYM : T*/ T*/MOD SWAP DROP ;
|
|
|
|
|
|
|
|
|
|
T{ 0 1 /MOD -> 0 1 T/MOD }T
|
|
|
|
|
T{ 1 1 /MOD -> 1 1 T/MOD }T
|
|
|
|
|
T{ 2 1 /MOD -> 2 1 T/MOD }T
|
|
|
|
|
T{ -1 1 /MOD -> -1 1 T/MOD }T
|
|
|
|
|
T{ -2 1 /MOD -> -2 1 T/MOD }T
|
|
|
|
|
T{ 0 -1 /MOD -> 0 -1 T/MOD }T
|
|
|
|
|
T{ 1 -1 /MOD -> 1 -1 T/MOD }T
|
|
|
|
|
T{ 2 -1 /MOD -> 2 -1 T/MOD }T
|
|
|
|
|
T{ -1 -1 /MOD -> -1 -1 T/MOD }T
|
|
|
|
|
T{ -2 -1 /MOD -> -2 -1 T/MOD }T
|
|
|
|
|
T{ 2 2 /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T*/MOD }T
|
|
|
|
|
T{ 2 2 -1 */MOD -> 2 2 -1 T*/MOD }T
|
|
|
|
|
T{ -1 2 -1 */MOD -> -1 2 -1 T*/MOD }T
|
|
|
|
|
T{ -2 2 -1 */MOD -> -2 2 -1 T*/MOD }T
|
|
|
|
|
T{ 2 2 2 */MOD -> 2 2 2 T*/MOD }T
|
|
|
|
|
T{ -1 2 -1 */MOD -> -1 2 -1 T*/MOD }T
|
|
|
|
|
T{ -2 2 -2 */MOD -> -2 2 -2 T*/MOD }T
|
|
|
|
|
T{ 7 2 3 */MOD -> 7 2 3 T*/MOD }T
|
|
|
|
|
T{ 7 2 -3 */MOD -> 7 2 -3 T*/MOD }T
|
|
|
|
|
T{ -7 2 3 */MOD -> -7 2 3 T*/MOD }T
|
|
|
|
|
T{ -7 2 -3 */MOD -> -7 2 -3 T*/MOD }T
|
|
|
|
|
T{ MAX-INT 2 MAX-INT */MOD -> MAX-INT 2 MAX-INT T*/MOD }T
|
|
|
|
|
T{ MIN-INT 2 MIN-INT */MOD -> MIN-INT 2 MIN-INT T*/MOD }T
|
|
|
|
|
|
|
|
|
|
\ ------------------------------------------------------------------------
|
|
|
|
|
." TESTING HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2! ALIGN ALIGNED +! ALLOT"
|
|
|
|
|
CR
|
|
|
|
@ -651,7 +652,7 @@ HERE 3 C, CHAR G C, CHAR T C, CHAR 2 C, CONSTANT GT2STRING
|
|
|
|
|
\ ( HOW TO SEARCH FOR NON-EXISTENT WORD? )
|
|
|
|
|
T{ : GT3 GT2 LITERAL ; -> }T
|
|
|
|
|
T{ GT3 -> ' GT1 }T
|
|
|
|
|
\ T{ GT1STRING COUNT -> GT1STRING CHAR+ 3 }T
|
|
|
|
|
T{ GT1STRING COUNT -> GT1STRING CHAR+ 3 }T
|
|
|
|
|
|
|
|
|
|
T{ : GT4 POSTPONE GT1 ; IMMEDIATE -> }T
|
|
|
|
|
T{ : GT5 GT4 ; -> }T
|
|
|
|
|