mirror of
https://github.com/mgcaret/of816.git
synced 2024-12-27 19:29:58 +00:00
216 lines
5.3 KiB
Forth
216 lines
5.3 KiB
Forth
testing 7.3.2.1 Single-precision integer arithmetic
|
|
T{ 0 5 + -> 5 }T
|
|
T{ 5 0 + -> 5 }T
|
|
T{ 0 -5 + -> -5 }T
|
|
T{ -5 0 + -> -5 }T
|
|
T{ 1 2 + -> 3 }T
|
|
T{ 1 -2 + -> -1 }T
|
|
T{ -1 2 + -> 1 }T
|
|
T{ -1 -2 + -> -3 }T
|
|
T{ -1 1 + -> 0 }T
|
|
T{ MID-UINT 1 + -> MID-UINT+1 }T
|
|
|
|
T{ 0 5 - -> -5 }T
|
|
T{ 5 0 - -> 5 }T
|
|
T{ 0 -5 - -> 5 }T
|
|
T{ -5 0 - -> -5 }T
|
|
T{ 1 2 - -> -1 }T
|
|
T{ 1 -2 - -> 3 }T
|
|
T{ -1 2 - -> -3 }T
|
|
T{ -1 -2 - -> 1 }T
|
|
T{ 0 1 - -> -1 }T
|
|
|
|
T{ MID-UINT+1 1 - -> MID-UINT }T
|
|
T{ 0 0 * -> 0 }T \ TEST IDENTITIES
|
|
T{ 0 1 * -> 0 }T
|
|
T{ 1 0 * -> 0 }T
|
|
T{ 1 2 * -> 2 }T
|
|
T{ 2 1 * -> 2 }T
|
|
T{ 3 3 * -> 9 }T
|
|
T{ -3 3 * -> -9 }T
|
|
T{ 3 -3 * -> -9 }T
|
|
T{ -3 -3 * -> 9 }T
|
|
T{ MID-UINT+1 1 RSHIFT 2 * -> MID-UINT+1 }T
|
|
T{ MID-UINT+1 2 RSHIFT 4 * -> MID-UINT+1 }T
|
|
T{ MID-UINT+1 1 RSHIFT MID-UINT+1 OR 2 * -> MID-UINT+1 }T
|
|
|
|
\ todo: u*
|
|
|
|
T{ 0 1 / -> 0 1 T/ }T
|
|
T{ 1 1 / -> 1 1 T/ }T
|
|
T{ 2 1 / -> 2 1 T/ }T
|
|
T{ -1 1 / -> -1 1 T/ }T
|
|
T{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