1------------------------------------------------------------------------
2-- dqInvert.decTest -- digitwise logical INVERT for decQuads          --
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------------------------------------------------------------------------
20version: 2.59
21
22extended:    1
23clamp:       1
24precision:   34
25maxExponent: 6144
26minExponent: -6143
27rounding:    half_even
28
29-- Sanity check (truth table)
30dqinv001 invert             0 -> 1111111111111111111111111111111111
31dqinv002 invert             1 -> 1111111111111111111111111111111110
32dqinv003 invert            10 -> 1111111111111111111111111111111101
33dqinv004 invert     111111111 -> 1111111111111111111111111000000000
34dqinv005 invert     000000000 -> 1111111111111111111111111111111111
35-- and at msd and msd-1
36dqinv007 invert 0000000000000000000000000000000000 ->   1111111111111111111111111111111111
37dqinv008 invert 1000000000000000000000000000000000 ->    111111111111111111111111111111111
38dqinv009 invert 0000000000000000000000000000000000 ->   1111111111111111111111111111111111
39dqinv010 invert 0100000000000000000000000000000000 ->   1011111111111111111111111111111111
40dqinv011 invert 0111111111111111111111111111111111 ->   1000000000000000000000000000000000
41dqinv012 invert 1111111111111111111111111111111111 ->                  0
42dqinv013 invert 0011111111111111111111111111111111 ->   1100000000000000000000000000000000
43dqinv014 invert 0111111111111111111111111111111111 ->   1000000000000000000000000000000000
44
45-- Various lengths
46dqinv600 invert 0111111111111111111011111111111111 ->   1000000000000000000100000000000000
47dqinv601 invert 0011111111111111110101111111111111 ->   1100000000000000001010000000000000
48dqinv602 invert 0101111111111111101110111111111111 ->   1010000000000000010001000000000000
49dqinv603 invert 0110111111111111011111011111111111 ->   1001000000000000100000100000000000
50dqinv604 invert 0111011111111110111111101111111111 ->   1000100000000001000000010000000000
51dqinv605 invert 0111101111111101111111110111111111 ->   1000010000000010000000001000000000
52dqinv606 invert 0111110111111011111111111011111111 ->   1000001000000100000000000100000000
53dqinv607 invert 0111111011110111111111111101111111 ->   1000000100001000000000000010000000
54dqinv608 invert 0111111101101111111111111110111111 ->   1000000010010000000000000001000000
55dqinv609 invert 0111111110011111111111111111011111 ->   1000000001100000000000000000100000
56dqinv610 invert 0111111110011111111111111111101111 ->   1000000001100000000000000000010000
57dqinv611 invert 0111111101101111111111111111110111 ->   1000000010010000000000000000001000
58dqinv612 invert 0111111011110111111111111111111011 ->   1000000100001000000000000000000100
59dqinv613 invert 0111110111111011111111111111111101 ->   1000001000000100000000000000000010
60dqinv614 invert 0111101111111101111111111111111110 ->   1000010000000010000000000000000001
61dqinv615 invert 0111011111111110111111111111111111 ->   1000100000000001000000000000000000
62dqinv616 invert 0110111111111111011111111111111110 ->   1001000000000000100000000000000001
63dqinv617 invert 0101111111111111101111111111111101 ->   1010000000000000010000000000000010
64dqinv618 invert 0011111111111111110111111111111011 ->   1100000000000000001000000000000100
65dqinv619 invert 0101111111111111111011111111110111 ->   1010000000000000000100000000001000
66dqinv620 invert 0110111111111111111101111111101111 ->   1001000000000000000010000000010000
67dqinv621 invert 0111011111111111111110111111011111 ->   1000100000000000000001000000100000
68dqinv622 invert 0111101111111111111111011110111111 ->   1000010000000000000000100001000000
69dqinv623 invert 0111110111111111111111101101111111 ->   1000001000000000000000010010000000
70dqinv624 invert 0111111011111111111111110011111111 ->   1000000100000000000000001100000000
71dqinv625 invert 0111111101111111111111110011111111 ->   1000000010000000000000001100000000
72dqinv626 invert 0111111110111111111111101101111111 ->   1000000001000000000000010010000000
73dqinv627 invert 0111111111011111111111011110111111 ->   1000000000100000000000100001000000
74dqinv628 invert 0111111111101111111110111111011111 ->   1000000000010000000001000000100000
75dqinv629 invert 0111111111110111111101111111101111 ->   1000000000001000000010000000010000
76dqinv630 invert 0111111111111011111011111111110111 ->   1000000000000100000100000000001000
77dqinv631 invert 0111111111111101110111111111111011 ->   1000000000000010001000000000000100
78dqinv632 invert 0111111111111110101111111111111101 ->   1000000000000001010000000000000010
79dqinv633 invert 0111111111111111011111111111111110 ->   1000000000000000100000000000000001
80
81dqinv021 invert 111111111     -> 1111111111111111111111111000000000
82dqinv022 invert 111111111111  -> 1111111111111111111111000000000000
83dqinv023 invert  11111111     -> 1111111111111111111111111100000000
84dqinv025 invert   1111111     -> 1111111111111111111111111110000000
85dqinv026 invert    111111     -> 1111111111111111111111111111000000
86dqinv027 invert     11111     -> 1111111111111111111111111111100000
87dqinv028 invert      1111     -> 1111111111111111111111111111110000
88dqinv029 invert       111     -> 1111111111111111111111111111111000
89dqinv031 invert        11     -> 1111111111111111111111111111111100
90dqinv032 invert         1     -> 1111111111111111111111111111111110
91dqinv033 invert 111111111111  -> 1111111111111111111111000000000000
92dqinv034 invert 11111111111   -> 1111111111111111111111100000000000
93dqinv035 invert 1111111111    -> 1111111111111111111111110000000000
94dqinv036 invert 111111111     -> 1111111111111111111111111000000000
95
96dqinv040 invert 011111111   -> 1111111111111111111111111100000000
97dqinv041 invert 101111111   -> 1111111111111111111111111010000000
98dqinv042 invert 110111111   -> 1111111111111111111111111001000000
99dqinv043 invert 111011111   -> 1111111111111111111111111000100000
100dqinv044 invert 111101111   -> 1111111111111111111111111000010000
101dqinv045 invert 111110111   -> 1111111111111111111111111000001000
102dqinv046 invert 111111011   -> 1111111111111111111111111000000100
103dqinv047 invert 111111101   -> 1111111111111111111111111000000010
104dqinv048 invert 111111110   -> 1111111111111111111111111000000001
105dqinv049 invert 011111011   -> 1111111111111111111111111100000100
106dqinv050 invert 101111101   -> 1111111111111111111111111010000010
107dqinv051 invert 110111110   -> 1111111111111111111111111001000001
108dqinv052 invert 111011101   -> 1111111111111111111111111000100010
109dqinv053 invert 111101011   -> 1111111111111111111111111000010100
110dqinv054 invert 111110111   -> 1111111111111111111111111000001000
111dqinv055 invert 111101011   -> 1111111111111111111111111000010100
112dqinv056 invert 111011101   -> 1111111111111111111111111000100010
113dqinv057 invert 110111110   -> 1111111111111111111111111001000001
114dqinv058 invert 101111101   -> 1111111111111111111111111010000010
115dqinv059 invert 011111011   -> 1111111111111111111111111100000100
116
117dqinv080 invert 1000000011111111   -> 1111111111111111110111111100000000
118dqinv081 invert 0100000101111111   -> 1111111111111111111011111010000000
119dqinv082 invert 0010000110111111   -> 1111111111111111111101111001000000
120dqinv083 invert 0001000111011111   -> 1111111111111111111110111000100000
121dqinv084 invert 0000100111101111   -> 1111111111111111111111011000010000
122dqinv085 invert 0000010111110111   -> 1111111111111111111111101000001000
123dqinv086 invert 0000001111111011   -> 1111111111111111111111110000000100
124dqinv087 invert 0000010111111101   -> 1111111111111111111111101000000010
125dqinv088 invert 0000100111111110   -> 1111111111111111111111011000000001
126dqinv089 invert 0001000011111011   -> 1111111111111111111110111100000100
127dqinv090 invert 0010000101111101   -> 1111111111111111111101111010000010
128dqinv091 invert 0100000110111110   -> 1111111111111111111011111001000001
129dqinv092 invert 1000000111011101   -> 1111111111111111110111111000100010
130dqinv093 invert 0100000111101011   -> 1111111111111111111011111000010100
131dqinv094 invert 0010000111110111   -> 1111111111111111111101111000001000
132dqinv095 invert 0001000111101011   -> 1111111111111111111110111000010100
133dqinv096 invert 0000100111011101   -> 1111111111111111111111011000100010
134dqinv097 invert 0000010110111110   -> 1111111111111111111111101001000001
135dqinv098 invert 0000001101111101   -> 1111111111111111111111110010000010
136dqinv099 invert 0000010011111011   -> 1111111111111111111111101100000100
137
138-- and more thorough MSD/LSD tests [8 and 9 mght be encoded differently...]
139dqinv151 invert 1111111111111111111111111111111110 ->                                   1
140dqinv152 invert 1111111111111111110000000000000000 ->                    1111111111111111
141dqinv153 invert 1000000000000000001111111111111111 ->   111111111111111110000000000000000
142dqinv154 invert 1111111111111111111000000000000000 ->                     111111111111111
143dqinv155 invert 0100000000000000000111111111111111 ->  1011111111111111111000000000000000
144dqinv156 invert 1011111111111111110100000000000000 ->   100000000000000001011111111111111
145dqinv157 invert 1101111111111111110111111111111111 ->    10000000000000001000000000000000
146dqinv158 invert 1110111111111111110011111111111111 ->     1000000000000001100000000000000
147
148-- non-0/1 should not be accepted, nor should signs
149dqinv220 invert 111111112   ->  NaN Invalid_operation
150dqinv221 invert 333333333   ->  NaN Invalid_operation
151dqinv222 invert 555555555   ->  NaN Invalid_operation
152dqinv223 invert 777777777   ->  NaN Invalid_operation
153dqinv224 invert 999999999   ->  NaN Invalid_operation
154dqinv225 invert 222222222   ->  NaN Invalid_operation
155dqinv226 invert 444444444   ->  NaN Invalid_operation
156dqinv227 invert 666666666   ->  NaN Invalid_operation
157dqinv228 invert 888888888   ->  NaN Invalid_operation
158dqinv229 invert 999999999   ->  NaN Invalid_operation
159dqinv230 invert 999999999   ->  NaN Invalid_operation
160dqinv231 invert 999999999   ->  NaN Invalid_operation
161dqinv232 invert 999999999   ->  NaN Invalid_operation
162-- a few randoms
163dqinv240 invert  567468689  ->  NaN Invalid_operation
164dqinv241 invert  567367689  ->  NaN Invalid_operation
165dqinv242 invert -631917772  ->  NaN Invalid_operation
166dqinv243 invert -756253257  ->  NaN Invalid_operation
167dqinv244 invert  835590149  ->  NaN Invalid_operation
168-- test MSD
169dqinv250 invert  2000000111000111000111000000000000 ->  NaN Invalid_operation
170dqinv251 invert  3000000111000111000111000000000000 ->  NaN Invalid_operation
171dqinv252 invert  4000000111000111000111000000000000 ->  NaN Invalid_operation
172dqinv253 invert  5000000111000111000111000000000000 ->  NaN Invalid_operation
173dqinv254 invert  6000000111000111000111000000000000 ->  NaN Invalid_operation
174dqinv255 invert  7000000111000111000111000000000000 ->  NaN Invalid_operation
175dqinv256 invert  8000000111000111000111000000000000 ->  NaN Invalid_operation
176dqinv257 invert  9000000111000111000111000000000000 ->  NaN Invalid_operation
177-- test MSD-1
178dqinv270 invert  0200000111000111000111001000000000 ->  NaN Invalid_operation
179dqinv271 invert  0300000111000111000111000100000000 ->  NaN Invalid_operation
180dqinv272 invert  0400000111000111000111000010000000 ->  NaN Invalid_operation
181dqinv273 invert  0500000111000111000111000001000000 ->  NaN Invalid_operation
182dqinv274 invert  1600000111000111000111000000100000 ->  NaN Invalid_operation
183dqinv275 invert  1700000111000111000111000000010000 ->  NaN Invalid_operation
184dqinv276 invert  1800000111000111000111000000001000 ->  NaN Invalid_operation
185dqinv277 invert  1900000111000111000111000000000100 ->  NaN Invalid_operation
186-- test LSD
187dqinv280 invert  0010000111000111000111000000000002 ->  NaN Invalid_operation
188dqinv281 invert  0001000111000111000111000000000003 ->  NaN Invalid_operation
189dqinv282 invert  0000000111000111000111100000000004 ->  NaN Invalid_operation
190dqinv283 invert  0000000111000111000111010000000005 ->  NaN Invalid_operation
191dqinv284 invert  1000000111000111000111001000000006 ->  NaN Invalid_operation
192dqinv285 invert  1000000111000111000111000100000007 ->  NaN Invalid_operation
193dqinv286 invert  1000000111000111000111000010000008 ->  NaN Invalid_operation
194dqinv287 invert  1000000111000111000111000001000009 ->  NaN Invalid_operation
195-- test Middie
196dqinv288 invert  0010000111000111000111000020000000 ->  NaN Invalid_operation
197dqinv289 invert  0001000111000111000111000030000001 ->  NaN Invalid_operation
198dqinv290 invert  0000000111000111000111100040000010 ->  NaN Invalid_operation
199dqinv291 invert  0000000111000111000111010050000100 ->  NaN Invalid_operation
200dqinv292 invert  1000000111000111000111001060001000 ->  NaN Invalid_operation
201dqinv293 invert  1000000111000111000111000170010000 ->  NaN Invalid_operation
202dqinv294 invert  1000000111000111000111000080100000 ->  NaN Invalid_operation
203dqinv295 invert  1000000111000111000111000091000000 ->  NaN Invalid_operation
204-- signs
205dqinv296 invert -1000000111000111000111000001000000  ->  NaN Invalid_operation
206dqinv299 invert  1000000111000111000111000001000000  ->  111111000111000111000111110111111
207
208-- Nmax, Nmin, Ntiny-like
209dqinv341 invert  9.99999999E+2998  -> NaN Invalid_operation
210dqinv342 invert  1E-2998           -> NaN Invalid_operation
211dqinv343 invert  1.00000000E-2998  -> NaN Invalid_operation
212dqinv344 invert  1E-2078           -> NaN Invalid_operation
213dqinv345 invert  -1E-2078          -> NaN Invalid_operation
214dqinv346 invert  -1.00000000E-2998 -> NaN Invalid_operation
215dqinv347 invert  -1E-2998          -> NaN Invalid_operation
216dqinv348 invert  -9.99999999E+2998 -> NaN Invalid_operation
217
218-- A few other non-integers
219dqinv361 invert  1.0               -> NaN Invalid_operation
220dqinv362 invert  1E+1              -> NaN Invalid_operation
221dqinv363 invert  0.0               -> NaN Invalid_operation
222dqinv364 invert  0E+1              -> NaN Invalid_operation
223dqinv365 invert  9.9               -> NaN Invalid_operation
224dqinv366 invert  9E+1              -> NaN Invalid_operation
225
226-- All Specials are in error
227dqinv788 invert -Inf     -> NaN  Invalid_operation
228dqinv794 invert  Inf     -> NaN  Invalid_operation
229dqinv821 invert  NaN     -> NaN  Invalid_operation
230dqinv841 invert  sNaN    -> NaN  Invalid_operation
231-- propagating NaNs
232dqinv861 invert  NaN1    -> NaN Invalid_operation
233dqinv862 invert +NaN2    -> NaN Invalid_operation
234dqinv863 invert  NaN3    -> NaN Invalid_operation
235dqinv864 invert  NaN4    -> NaN Invalid_operation
236dqinv865 invert  NaN5    -> NaN Invalid_operation
237dqinv871 invert  sNaN11  -> NaN Invalid_operation
238dqinv872 invert  sNaN12  -> NaN Invalid_operation
239dqinv873 invert  sNaN13  -> NaN Invalid_operation
240dqinv874 invert  sNaN14  -> NaN Invalid_operation
241dqinv875 invert  sNaN15  -> NaN Invalid_operation
242dqinv876 invert  NaN16   -> NaN Invalid_operation
243dqinv881 invert +NaN25   -> NaN Invalid_operation
244dqinv882 invert -NaN26   -> NaN Invalid_operation
245dqinv883 invert -sNaN27  -> NaN Invalid_operation
246