1------------------------------------------------------------------------
2-- ddInvert.decTest -- digitwise logical INVERT for decDoubles        --
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
22precision:   16
23maxExponent: 384
24minExponent: -383
25extended:    1
26clamp:       1
27rounding:    half_even
28
29-- Sanity check (truth table)
30ddinv001 invert             0 -> 1111111111111111
31ddinv002 invert             1 -> 1111111111111110
32ddinv003 invert            10 -> 1111111111111101
33ddinv004 invert     111111111 -> 1111111000000000
34ddinv005 invert     000000000 -> 1111111111111111
35-- and at msd and msd-1
36ddinv007 invert 0000000000000000 ->   1111111111111111
37ddinv008 invert 1000000000000000 ->    111111111111111
38ddinv009 invert 0000000000000000 ->   1111111111111111
39ddinv010 invert 0100000000000000 ->   1011111111111111
40ddinv011 invert 0111111111111111 ->   1000000000000000
41ddinv012 invert 1111111111111111 ->                  0
42ddinv013 invert 0011111111111111 ->   1100000000000000
43ddinv014 invert 0111111111111111 ->   1000000000000000
44
45-- Various lengths
46--             123456789         1234567890123456
47ddinv021 invert 111111111     ->  1111111000000000
48ddinv022 invert 111111111111  ->  1111000000000000
49ddinv023 invert  11111111     ->  1111111100000000
50ddinv025 invert   1111111     ->  1111111110000000
51ddinv026 invert    111111     ->  1111111111000000
52ddinv027 invert     11111     ->  1111111111100000
53ddinv028 invert      1111     ->  1111111111110000
54ddinv029 invert       111     ->  1111111111111000
55ddinv031 invert        11     ->  1111111111111100
56ddinv032 invert         1     ->  1111111111111110
57ddinv033 invert 111111111111  ->  1111000000000000
58ddinv034 invert 11111111111   ->  1111100000000000
59ddinv035 invert 1111111111    ->  1111110000000000
60ddinv036 invert 111111111     ->  1111111000000000
61
62ddinv040 invert 011111111   ->  1111111100000000
63ddinv041 invert 101111111   ->  1111111010000000
64ddinv042 invert 110111111   ->  1111111001000000
65ddinv043 invert 111011111   ->  1111111000100000
66ddinv044 invert 111101111   ->  1111111000010000
67ddinv045 invert 111110111   ->  1111111000001000
68ddinv046 invert 111111011   ->  1111111000000100
69ddinv047 invert 111111101   ->  1111111000000010
70ddinv048 invert 111111110   ->  1111111000000001
71ddinv049 invert 011111011   ->  1111111100000100
72ddinv050 invert 101111101   ->  1111111010000010
73ddinv051 invert 110111110   ->  1111111001000001
74ddinv052 invert 111011101   ->  1111111000100010
75ddinv053 invert 111101011   ->  1111111000010100
76ddinv054 invert 111110111   ->  1111111000001000
77ddinv055 invert 111101011   ->  1111111000010100
78ddinv056 invert 111011101   ->  1111111000100010
79ddinv057 invert 110111110   ->  1111111001000001
80ddinv058 invert 101111101   ->  1111111010000010
81ddinv059 invert 011111011   ->  1111111100000100
82
83ddinv080 invert 1000000011111111   ->   111111100000000
84ddinv081 invert 0100000101111111   ->  1011111010000000
85ddinv082 invert 0010000110111111   ->  1101111001000000
86ddinv083 invert 0001000111011111   ->  1110111000100000
87ddinv084 invert 0000100111101111   ->  1111011000010000
88ddinv085 invert 0000010111110111   ->  1111101000001000
89ddinv086 invert 0000001111111011   ->  1111110000000100
90ddinv087 invert 0000010111111101   ->  1111101000000010
91ddinv088 invert 0000100111111110   ->  1111011000000001
92ddinv089 invert 0001000011111011   ->  1110111100000100
93ddinv090 invert 0010000101111101   ->  1101111010000010
94ddinv091 invert 0100000110111110   ->  1011111001000001
95ddinv092 invert 1000000111011101   ->   111111000100010
96ddinv093 invert 0100000111101011   ->  1011111000010100
97ddinv094 invert 0010000111110111   ->  1101111000001000
98ddinv095 invert 0001000111101011   ->  1110111000010100
99ddinv096 invert 0000100111011101   ->  1111011000100010
100ddinv097 invert 0000010110111110   ->  1111101001000001
101ddinv098 invert 0000001101111101   ->  1111110010000010
102ddinv099 invert 0000010011111011   ->  1111101100000100
103
104-- non-0/1 should not be accepted, nor should signs
105ddinv220 invert 111111112   ->  NaN Invalid_operation
106ddinv221 invert 333333333   ->  NaN Invalid_operation
107ddinv222 invert 555555555   ->  NaN Invalid_operation
108ddinv223 invert 777777777   ->  NaN Invalid_operation
109ddinv224 invert 999999999   ->  NaN Invalid_operation
110ddinv225 invert 222222222   ->  NaN Invalid_operation
111ddinv226 invert 444444444   ->  NaN Invalid_operation
112ddinv227 invert 666666666   ->  NaN Invalid_operation
113ddinv228 invert 888888888   ->  NaN Invalid_operation
114ddinv229 invert 999999999   ->  NaN Invalid_operation
115ddinv230 invert 999999999   ->  NaN Invalid_operation
116ddinv231 invert 999999999   ->  NaN Invalid_operation
117ddinv232 invert 999999999   ->  NaN Invalid_operation
118-- a few randoms
119ddinv240 invert  567468689  ->  NaN Invalid_operation
120ddinv241 invert  567367689  ->  NaN Invalid_operation
121ddinv242 invert -631917772  ->  NaN Invalid_operation
122ddinv243 invert -756253257  ->  NaN Invalid_operation
123ddinv244 invert  835590149  ->  NaN Invalid_operation
124-- test MSD
125ddinv250 invert  2000000000000000  ->  NaN Invalid_operation
126ddinv251 invert  3000000000000000  ->  NaN Invalid_operation
127ddinv252 invert  4000000000000000  ->  NaN Invalid_operation
128ddinv253 invert  5000000000000000  ->  NaN Invalid_operation
129ddinv254 invert  6000000000000000  ->  NaN Invalid_operation
130ddinv255 invert  7000000000000000  ->  NaN Invalid_operation
131ddinv256 invert  8000000000000000  ->  NaN Invalid_operation
132ddinv257 invert  9000000000000000  ->  NaN Invalid_operation
133-- test MSD-1
134ddinv270 invert  0200001000000000  ->  NaN Invalid_operation
135ddinv271 invert  0300000100000000  ->  NaN Invalid_operation
136ddinv272 invert  0400000010000000  ->  NaN Invalid_operation
137ddinv273 invert  0500000001000000  ->  NaN Invalid_operation
138ddinv274 invert  1600000000100000  ->  NaN Invalid_operation
139ddinv275 invert  1700000000010000  ->  NaN Invalid_operation
140ddinv276 invert  1800000000001000  ->  NaN Invalid_operation
141ddinv277 invert  1900000000000100  ->  NaN Invalid_operation
142-- test LSD
143ddinv280 invert  0010000000000002  ->  NaN Invalid_operation
144ddinv281 invert  0001000000000003  ->  NaN Invalid_operation
145ddinv282 invert  0000100000000004  ->  NaN Invalid_operation
146ddinv283 invert  0000010000000005  ->  NaN Invalid_operation
147ddinv284 invert  1000001000000006  ->  NaN Invalid_operation
148ddinv285 invert  1000000100000007  ->  NaN Invalid_operation
149ddinv286 invert  1000000010000008  ->  NaN Invalid_operation
150ddinv287 invert  1000000001000009  ->  NaN Invalid_operation
151-- test Middie
152ddinv288 invert  0010000020000000  ->  NaN Invalid_operation
153ddinv289 invert  0001000030000001  ->  NaN Invalid_operation
154ddinv290 invert  0000100040000010  ->  NaN Invalid_operation
155ddinv291 invert  0000010050000100  ->  NaN Invalid_operation
156ddinv292 invert  1000001060001000  ->  NaN Invalid_operation
157ddinv293 invert  1000000170010000  ->  NaN Invalid_operation
158ddinv294 invert  1000000080100000  ->  NaN Invalid_operation
159ddinv295 invert  1000000091000000  ->  NaN Invalid_operation
160-- sign
161ddinv296 invert -1000000001000000  ->  NaN Invalid_operation
162ddinv299 invert  1000000001000000  ->  111111110111111
163
164
165-- Nmax, Nmin, Ntiny-like
166ddinv341 invert  9.99999999E+299   -> NaN Invalid_operation
167ddinv342 invert  1E-299            -> NaN Invalid_operation
168ddinv343 invert  1.00000000E-299   -> NaN Invalid_operation
169ddinv344 invert  1E-207            -> NaN Invalid_operation
170ddinv345 invert  -1E-207           -> NaN Invalid_operation
171ddinv346 invert  -1.00000000E-299  -> NaN Invalid_operation
172ddinv347 invert  -1E-299           -> NaN Invalid_operation
173ddinv348 invert  -9.99999999E+299  -> NaN Invalid_operation
174
175-- A few other non-integers
176ddinv361 invert  1.0               -> NaN Invalid_operation
177ddinv362 invert  1E+1              -> NaN Invalid_operation
178ddinv363 invert  0.0               -> NaN Invalid_operation
179ddinv364 invert  0E+1              -> NaN Invalid_operation
180ddinv365 invert  9.9               -> NaN Invalid_operation
181ddinv366 invert  9E+1              -> NaN Invalid_operation
182
183-- All Specials are in error
184ddinv788 invert -Inf     -> NaN  Invalid_operation
185ddinv794 invert  Inf     -> NaN  Invalid_operation
186ddinv821 invert  NaN     -> NaN  Invalid_operation
187ddinv841 invert  sNaN    -> NaN  Invalid_operation
188-- propagating NaNs
189ddinv861 invert  NaN1    -> NaN Invalid_operation
190ddinv862 invert +NaN2    -> NaN Invalid_operation
191ddinv863 invert  NaN3    -> NaN Invalid_operation
192ddinv864 invert  NaN4    -> NaN Invalid_operation
193ddinv865 invert  NaN5    -> NaN Invalid_operation
194ddinv871 invert  sNaN11  -> NaN Invalid_operation
195ddinv872 invert  sNaN12  -> NaN Invalid_operation
196ddinv873 invert  sNaN13  -> NaN Invalid_operation
197ddinv874 invert  sNaN14  -> NaN Invalid_operation
198ddinv875 invert  sNaN15  -> NaN Invalid_operation
199ddinv876 invert  NaN16   -> NaN Invalid_operation
200ddinv881 invert +NaN25   -> NaN Invalid_operation
201ddinv882 invert -NaN26   -> NaN Invalid_operation
202ddinv883 invert -sNaN27  -> NaN Invalid_operation
203