forth: mixed/double-cell math (S>D M* UM* UM/MOD FM/MOD SM/REM */ */MOD); Hayes 342→446 (69%)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -82,6 +82,36 @@
|
||||
"CREATE X 0 , 0 , 11 22 X 2! X 2@"
|
||||
(list 11 22))))
|
||||
|
||||
(define
|
||||
forth-p5-mixed-tests
|
||||
(fn
|
||||
()
|
||||
(forth-p5-check-stack "S>D positive" "5 S>D" (list 5 0))
|
||||
(forth-p5-check-stack "S>D negative" "-5 S>D" (list -5 -1))
|
||||
(forth-p5-check-stack "S>D zero" "0 S>D" (list 0 0))
|
||||
(forth-p5-check-top "D>S keeps low" "5 0 D>S" 5)
|
||||
(forth-p5-check-stack "M* small positive" "3 4 M*" (list 12 0))
|
||||
(forth-p5-check-stack "M* negative" "-3 4 M*" (list -12 -1))
|
||||
(forth-p5-check-stack
|
||||
"M* negative * negative"
|
||||
"-3 -4 M*"
|
||||
(list 12 0))
|
||||
(forth-p5-check-stack "UM* small" "3 4 UM*" (list 12 0))
|
||||
(forth-p5-check-stack
|
||||
"UM/MOD: 100 0 / 5"
|
||||
"100 0 5 UM/MOD"
|
||||
(list 0 20))
|
||||
(forth-p5-check-stack
|
||||
"FM/MOD: -7 / 2 floored"
|
||||
"-7 -1 2 FM/MOD"
|
||||
(list 1 -4))
|
||||
(forth-p5-check-stack
|
||||
"SM/REM: -7 / 2 truncated"
|
||||
"-7 -1 2 SM/REM"
|
||||
(list -1 -3))
|
||||
(forth-p5-check-top "*/ truncated" "7 11 13 */" 5)
|
||||
(forth-p5-check-stack "*/MOD" "7 11 13 */MOD" (list 12 5))))
|
||||
|
||||
(define
|
||||
forth-p5-run-all
|
||||
(fn
|
||||
@@ -92,6 +122,7 @@
|
||||
(forth-p5-create-tests)
|
||||
(forth-p5-unsigned-tests)
|
||||
(forth-p5-2bang-tests)
|
||||
(forth-p5-mixed-tests)
|
||||
(dict
|
||||
"passed"
|
||||
forth-p5-passed
|
||||
|
||||
Reference in New Issue
Block a user