|
1 ------------------------------------------------------------------------ |
|
2 -- invert.decTest -- digitwise logical INVERT -- |
|
3 -- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. -- |
|
4 ------------------------------------------------------------------------ |
|
5 -- Please see the document "General Decimal Arithmetic Testcases" -- |
|
6 -- at http://www2.hursley.ibm.com/decimal for the description of -- |
|
7 -- these testcases. -- |
|
8 -- -- |
|
9 -- These testcases are experimental ('beta' versions), and they -- |
|
10 -- may contain errors. They are offered on an as-is basis. In -- |
|
11 -- particular, achieving the same results as the tests here is not -- |
|
12 -- a guarantee that an implementation complies with any Standard -- |
|
13 -- or specification. The tests are not exhaustive. -- |
|
14 -- -- |
|
15 -- Please send comments, suggestions, and corrections to the author: -- |
|
16 -- Mike Cowlishaw, IBM Fellow -- |
|
17 -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- |
|
18 -- mfc@uk.ibm.com -- |
|
19 ------------------------------------------------------------------------ |
|
20 version: 2.58 |
|
21 |
|
22 extended: 1 |
|
23 precision: 9 |
|
24 rounding: half_up |
|
25 maxExponent: 999 |
|
26 minExponent: -999 |
|
27 |
|
28 -- Sanity check (truth table), and examples from decArith |
|
29 invx001 invert 0 -> 111111111 |
|
30 invx002 invert 1 -> 111111110 |
|
31 invx003 invert 10 -> 111111101 |
|
32 invx004 invert 111111111 -> 0 |
|
33 invx005 invert 000000000 -> 111111111 |
|
34 invx006 invert 101010101 -> '10101010' |
|
35 -- and at msd and msd-1 |
|
36 invx007 invert 000000000 -> 111111111 |
|
37 invx009 invert 100000000 -> 11111111 |
|
38 invx011 invert 000000000 -> 111111111 |
|
39 invx013 invert 010000000 -> 101111111 |
|
40 |
|
41 -- Various lengths |
|
42 -- 123456789 123456789 |
|
43 invx021 invert 111111111 -> 0 |
|
44 invx022 invert 111111111111 -> 0 |
|
45 invx023 invert 11111111 -> 100000000 |
|
46 invx025 invert 1111111 -> 110000000 |
|
47 invx026 invert 111111 -> 111000000 |
|
48 invx027 invert 11111 -> 111100000 |
|
49 invx028 invert 1111 -> 111110000 |
|
50 invx029 invert 111 -> 111111000 |
|
51 invx031 invert 11 -> 111111100 |
|
52 invx032 invert 1 -> 111111110 |
|
53 invx033 invert 111111111111 -> 0 |
|
54 invx034 invert 11111111111 -> 0 |
|
55 invx035 invert 1111111111 -> 0 |
|
56 invx036 invert 111111111 -> 0 |
|
57 |
|
58 invx080 invert 011111111 -> 100000000 |
|
59 invx081 invert 101111111 -> 10000000 |
|
60 invx082 invert 110111111 -> 1000000 |
|
61 invx083 invert 111011111 -> 100000 |
|
62 invx084 invert 111101111 -> 10000 |
|
63 invx085 invert 111110111 -> 1000 |
|
64 invx086 invert 111111011 -> 100 |
|
65 invx087 invert 111111101 -> 10 |
|
66 invx088 invert 111111110 -> 1 |
|
67 invx089 invert 011111011 -> 100000100 |
|
68 invx090 invert 101111101 -> 10000010 |
|
69 invx091 invert 110111110 -> 1000001 |
|
70 invx092 invert 111011101 -> 100010 |
|
71 invx093 invert 111101011 -> 10100 |
|
72 invx094 invert 111110111 -> 1000 |
|
73 invx095 invert 111101011 -> 10100 |
|
74 invx096 invert 111011101 -> 100010 |
|
75 invx097 invert 110111110 -> 1000001 |
|
76 invx098 invert 101111101 -> 10000010 |
|
77 invx099 invert 011111011 -> 100000100 |
|
78 |
|
79 -- non-0/1 should not be accepted, nor should signs |
|
80 invx220 invert 111111112 -> NaN Invalid_operation |
|
81 invx221 invert 333333333 -> NaN Invalid_operation |
|
82 invx222 invert 555555555 -> NaN Invalid_operation |
|
83 invx223 invert 777777777 -> NaN Invalid_operation |
|
84 invx224 invert 999999999 -> NaN Invalid_operation |
|
85 invx225 invert 222222222 -> NaN Invalid_operation |
|
86 invx226 invert 444444444 -> NaN Invalid_operation |
|
87 invx227 invert 666666666 -> NaN Invalid_operation |
|
88 invx228 invert 888888888 -> NaN Invalid_operation |
|
89 invx229 invert 999999999 -> NaN Invalid_operation |
|
90 invx230 invert 999999999 -> NaN Invalid_operation |
|
91 invx231 invert 999999999 -> NaN Invalid_operation |
|
92 invx232 invert 999999999 -> NaN Invalid_operation |
|
93 -- a few randoms |
|
94 invx240 invert 567468689 -> NaN Invalid_operation |
|
95 invx241 invert 567367689 -> NaN Invalid_operation |
|
96 invx242 invert -631917772 -> NaN Invalid_operation |
|
97 invx243 invert -756253257 -> NaN Invalid_operation |
|
98 invx244 invert 835590149 -> NaN Invalid_operation |
|
99 -- test MSD |
|
100 invx250 invert 200000000 -> NaN Invalid_operation |
|
101 invx251 invert 300000000 -> NaN Invalid_operation |
|
102 invx252 invert 400000000 -> NaN Invalid_operation |
|
103 invx253 invert 500000000 -> NaN Invalid_operation |
|
104 invx254 invert 600000000 -> NaN Invalid_operation |
|
105 invx255 invert 700000000 -> NaN Invalid_operation |
|
106 invx256 invert 800000000 -> NaN Invalid_operation |
|
107 invx257 invert 900000000 -> NaN Invalid_operation |
|
108 -- test MSD-1 |
|
109 invx270 invert 021000000 -> NaN Invalid_operation |
|
110 invx271 invert 030100000 -> NaN Invalid_operation |
|
111 invx272 invert 040010000 -> NaN Invalid_operation |
|
112 invx273 invert 050001000 -> NaN Invalid_operation |
|
113 invx274 invert 160000100 -> NaN Invalid_operation |
|
114 invx275 invert 170000010 -> NaN Invalid_operation |
|
115 invx276 invert 180000000 -> NaN Invalid_operation |
|
116 invx277 invert 190000000 -> NaN Invalid_operation |
|
117 -- test LSD |
|
118 invx280 invert 000000002 -> NaN Invalid_operation |
|
119 invx281 invert 000000003 -> NaN Invalid_operation |
|
120 invx282 invert 000000004 -> NaN Invalid_operation |
|
121 invx283 invert 000000005 -> NaN Invalid_operation |
|
122 invx284 invert 101000006 -> NaN Invalid_operation |
|
123 invx285 invert 100100007 -> NaN Invalid_operation |
|
124 invx286 invert 100010008 -> NaN Invalid_operation |
|
125 invx287 invert 100001009 -> NaN Invalid_operation |
|
126 -- test Middie |
|
127 invx288 invert 000020000 -> NaN Invalid_operation |
|
128 invx289 invert 000030001 -> NaN Invalid_operation |
|
129 invx290 invert 000040000 -> NaN Invalid_operation |
|
130 invx291 invert 000050000 -> NaN Invalid_operation |
|
131 invx292 invert 101060000 -> NaN Invalid_operation |
|
132 invx293 invert 100170010 -> NaN Invalid_operation |
|
133 invx294 invert 100080100 -> NaN Invalid_operation |
|
134 invx295 invert 100091000 -> NaN Invalid_operation |
|
135 -- signs |
|
136 invx296 invert -100001000 -> NaN Invalid_operation |
|
137 invx299 invert 100001000 -> 11110111 |
|
138 |
|
139 -- Nmax, Nmin, Ntiny |
|
140 invx341 invert 9.99999999E+999 -> NaN Invalid_operation |
|
141 invx342 invert 1E-999 -> NaN Invalid_operation |
|
142 invx343 invert 1.00000000E-999 -> NaN Invalid_operation |
|
143 invx344 invert 1E-1007 -> NaN Invalid_operation |
|
144 invx345 invert -1E-1007 -> NaN Invalid_operation |
|
145 invx346 invert -1.00000000E-999 -> NaN Invalid_operation |
|
146 invx347 invert -1E-999 -> NaN Invalid_operation |
|
147 invx348 invert -9.99999999E+999 -> NaN Invalid_operation |
|
148 |
|
149 -- A few other non-integers |
|
150 invx361 invert 1.0 -> NaN Invalid_operation |
|
151 invx362 invert 1E+1 -> NaN Invalid_operation |
|
152 invx363 invert 0.0 -> NaN Invalid_operation |
|
153 invx364 invert 0E+1 -> NaN Invalid_operation |
|
154 invx365 invert 9.9 -> NaN Invalid_operation |
|
155 invx366 invert 9E+1 -> NaN Invalid_operation |
|
156 |
|
157 -- All Specials are in error |
|
158 invx788 invert -Inf -> NaN Invalid_operation |
|
159 invx794 invert Inf -> NaN Invalid_operation |
|
160 invx821 invert NaN -> NaN Invalid_operation |
|
161 invx841 invert sNaN -> NaN Invalid_operation |
|
162 -- propagating NaNs |
|
163 invx861 invert NaN1 -> NaN Invalid_operation |
|
164 invx862 invert +NaN2 -> NaN Invalid_operation |
|
165 invx863 invert NaN3 -> NaN Invalid_operation |
|
166 invx864 invert NaN4 -> NaN Invalid_operation |
|
167 invx865 invert NaN5 -> NaN Invalid_operation |
|
168 invx871 invert sNaN11 -> NaN Invalid_operation |
|
169 invx872 invert sNaN12 -> NaN Invalid_operation |
|
170 invx873 invert sNaN13 -> NaN Invalid_operation |
|
171 invx874 invert sNaN14 -> NaN Invalid_operation |
|
172 invx875 invert sNaN15 -> NaN Invalid_operation |
|
173 invx876 invert NaN16 -> NaN Invalid_operation |
|
174 invx881 invert +NaN25 -> NaN Invalid_operation |
|
175 invx882 invert -NaN26 -> NaN Invalid_operation |
|
176 invx883 invert -sNaN27 -> NaN Invalid_operation |