Commit | Line | Data |
---|---|---|
665e21b4 AT |
1 | # This test verifies arithmetic IMP remainder. |
2 | ||
9e28c156 | 3 | # First, verify basic function with two positive numbers. |
665e21b4 AT |
4 | SSSTTSSSSTSN | ST: Push +194 |
5 | SSSTSSSSSSTN | ST: Push +128 | |
6 | TSTT | MA: Remainder | |
7 | TNSS | IO: Output character | |
9e28c156 AT |
8 | |
9 | # The VVS modulo function should always return a positive value. | |
10 | # C-derived languages (among others) do not share this convention. | |
11 | ||
12 | # This test verifies that -3 mod 2 = 1. | |
13 | SSTTTN | ST: Push -3 | |
14 | SSSTSN | ST: Push +2 | |
15 | TSTT | MA: Remainder | |
16 | TNST | IO: Output digit | |
17 | ||
18 | # This test verifies that -3 mod -2 = 1. | |
19 | SSTTTN | ST: Push -3 | |
20 | SSTTSN | ST: Push -2 | |
21 | TSTT | MA: Remainder | |
22 | TNST | IO: Output digit | |
23 | ||
24 | # This test verifies that -3 mod -(2^63) = 3. | |
25 | SSTTTN | ST: Push -3 | |
26 | SSTTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSN | PUSH -(2^63) | |
27 | TSTT | MA: Remainder | |
28 | TNST | IO: Output digit | |
29 | ||
30 | # All done | |
665e21b4 | 31 | NNN | FC: Terminate program |