1------------------------------------------------------------------------
2-- ddXor.decTest -- digitwise logical XOR 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)
30ddxor001 xor             0    0 ->    0
31ddxor002 xor             0    1 ->    1
32ddxor003 xor             1    0 ->    1
33ddxor004 xor             1    1 ->    0
34ddxor005 xor          1100 1010 ->  110
35-- and at msd and msd-1
36ddxor006 xor 0000000000000000 0000000000000000 ->           0
37ddxor007 xor 0000000000000000 1000000000000000 ->   1000000000000000
38ddxor008 xor 1000000000000000 0000000000000000 ->   1000000000000000
39ddxor009 xor 1000000000000000 1000000000000000 ->           0
40ddxor010 xor 0000000000000000 0000000000000000 ->           0
41ddxor011 xor 0000000000000000 0100000000000000 ->    100000000000000
42ddxor012 xor 0100000000000000 0000000000000000 ->    100000000000000
43ddxor013 xor 0100000000000000 0100000000000000 ->           0
44
45-- Various lengths
46--          1234567890123456     1234567890123456 1234567890123456
47ddxor021 xor 1111111110000000     1111111110000000  ->  0
48ddxor022 xor  111111110000000      111111110000000  ->  0
49ddxor023 xor   11111110000000       11111110000000  ->  0
50ddxor024 xor    1111110000000        1111110000000  ->  0
51ddxor025 xor     111110000000         111110000000  ->  0
52ddxor026 xor      11110000000          11110000000  ->  0
53ddxor027 xor       1110000000           1110000000  ->  0
54ddxor028 xor        110000000            110000000  ->  0
55ddxor029 xor         10000000             10000000  ->  0
56ddxor030 xor          1000000              1000000  ->  0
57ddxor031 xor           100000               100000  ->  0
58ddxor032 xor            10000                10000  ->  0
59ddxor033 xor             1000                 1000  ->  0
60ddxor034 xor              100                  100  ->  0
61ddxor035 xor               10                   10  ->  0
62ddxor036 xor                1                    1  ->  0
63
64ddxor040 xor 111111111  111111111111  ->  111000000000
65ddxor041 xor  11111111  111111111111  ->  111100000000
66ddxor042 xor  11111111     111111111  ->  100000000
67ddxor043 xor   1111111     100000010  ->  101111101
68ddxor044 xor    111111     100000100  ->  100111011
69ddxor045 xor     11111     100001000  ->  100010111
70ddxor046 xor      1111     100010000  ->  100011111
71ddxor047 xor       111     100100000  ->  100100111
72ddxor048 xor        11     101000000  ->  101000011
73ddxor049 xor         1     110000000  ->  110000001
74
75ddxor050 xor 1111111111  1  ->  1111111110
76ddxor051 xor  111111111  1  ->  111111110
77ddxor052 xor   11111111  1  ->  11111110
78ddxor053 xor    1111111  1  ->  1111110
79ddxor054 xor     111111  1  ->  111110
80ddxor055 xor      11111  1  ->  11110
81ddxor056 xor       1111  1  ->  1110
82ddxor057 xor        111  1  ->  110
83ddxor058 xor         11  1  ->  10
84ddxor059 xor          1  1  ->  0
85
86ddxor060 xor 1111111111  0  ->  1111111111
87ddxor061 xor  111111111  0  ->  111111111
88ddxor062 xor   11111111  0  ->  11111111
89ddxor063 xor    1111111  0  ->  1111111
90ddxor064 xor     111111  0  ->  111111
91ddxor065 xor      11111  0  ->  11111
92ddxor066 xor       1111  0  ->  1111
93ddxor067 xor        111  0  ->  111
94ddxor068 xor         11  0  ->  11
95ddxor069 xor          1  0  ->  1
96
97ddxor070 xor 1  1111111111  ->  1111111110
98ddxor071 xor 1   111111111  ->  111111110
99ddxor072 xor 1    11111111  ->  11111110
100ddxor073 xor 1     1111111  ->  1111110
101ddxor074 xor 1      111111  ->  111110
102ddxor075 xor 1       11111  ->  11110
103ddxor076 xor 1        1111  ->  1110
104ddxor077 xor 1         111  ->  110
105ddxor078 xor 1          11  ->  10
106ddxor079 xor 1           1  ->  0
107
108ddxor080 xor 0  1111111111  ->  1111111111
109ddxor081 xor 0   111111111  ->  111111111
110ddxor082 xor 0    11111111  ->  11111111
111ddxor083 xor 0     1111111  ->  1111111
112ddxor084 xor 0      111111  ->  111111
113ddxor085 xor 0       11111  ->  11111
114ddxor086 xor 0        1111  ->  1111
115ddxor087 xor 0         111  ->  111
116ddxor088 xor 0          11  ->  11
117ddxor089 xor 0           1  ->  1
118
119ddxor090 xor 011111111  111101111  ->  100010000
120ddxor091 xor 101111111  111101111  ->   10010000
121ddxor092 xor 110111111  111101111  ->    1010000
122ddxor093 xor 111011111  111101111  ->     110000
123ddxor094 xor 111101111  111101111  ->          0
124ddxor095 xor 111110111  111101111  ->      11000
125ddxor096 xor 111111011  111101111  ->      10100
126ddxor097 xor 111111101  111101111  ->      10010
127ddxor098 xor 111111110  111101111  ->      10001
128
129ddxor100 xor 111101111  011111111  ->  100010000
130ddxor101 xor 111101111  101111111  ->   10010000
131ddxor102 xor 111101111  110111111  ->    1010000
132ddxor103 xor 111101111  111011111  ->     110000
133ddxor104 xor 111101111  111101111  ->          0
134ddxor105 xor 111101111  111110111  ->      11000
135ddxor106 xor 111101111  111111011  ->      10100
136ddxor107 xor 111101111  111111101  ->      10010
137ddxor108 xor 111101111  111111110  ->      10001
138
139-- non-0/1 should not be accepted, nor should signs
140ddxor220 xor 111111112  111111111  ->  NaN Invalid_operation
141ddxor221 xor 333333333  333333333  ->  NaN Invalid_operation
142ddxor222 xor 555555555  555555555  ->  NaN Invalid_operation
143ddxor223 xor 777777777  777777777  ->  NaN Invalid_operation
144ddxor224 xor 999999999  999999999  ->  NaN Invalid_operation
145ddxor225 xor 222222222  999999999  ->  NaN Invalid_operation
146ddxor226 xor 444444444  999999999  ->  NaN Invalid_operation
147ddxor227 xor 666666666  999999999  ->  NaN Invalid_operation
148ddxor228 xor 888888888  999999999  ->  NaN Invalid_operation
149ddxor229 xor 999999999  222222222  ->  NaN Invalid_operation
150ddxor230 xor 999999999  444444444  ->  NaN Invalid_operation
151ddxor231 xor 999999999  666666666  ->  NaN Invalid_operation
152ddxor232 xor 999999999  888888888  ->  NaN Invalid_operation
153-- a few randoms
154ddxor240 xor  567468689 -934981942 ->  NaN Invalid_operation
155ddxor241 xor  567367689  934981942 ->  NaN Invalid_operation
156ddxor242 xor -631917772 -706014634 ->  NaN Invalid_operation
157ddxor243 xor -756253257  138579234 ->  NaN Invalid_operation
158ddxor244 xor  835590149  567435400 ->  NaN Invalid_operation
159-- test MSD
160ddxor250 xor  2000000000000000 1000000000000000 ->  NaN Invalid_operation
161ddxor251 xor  7000000000000000 1000000000000000 ->  NaN Invalid_operation
162ddxor252 xor  8000000000000000 1000000000000000 ->  NaN Invalid_operation
163ddxor253 xor  9000000000000000 1000000000000000 ->  NaN Invalid_operation
164ddxor254 xor  2000000000000000 0000000000000000 ->  NaN Invalid_operation
165ddxor255 xor  7000000000000000 0000000000000000 ->  NaN Invalid_operation
166ddxor256 xor  8000000000000000 0000000000000000 ->  NaN Invalid_operation
167ddxor257 xor  9000000000000000 0000000000000000 ->  NaN Invalid_operation
168ddxor258 xor  1000000000000000 2000000000000000 ->  NaN Invalid_operation
169ddxor259 xor  1000000000000000 7000000000000000 ->  NaN Invalid_operation
170ddxor260 xor  1000000000000000 8000000000000000 ->  NaN Invalid_operation
171ddxor261 xor  1000000000000000 9000000000000000 ->  NaN Invalid_operation
172ddxor262 xor  0000000000000000 2000000000000000 ->  NaN Invalid_operation
173ddxor263 xor  0000000000000000 7000000000000000 ->  NaN Invalid_operation
174ddxor264 xor  0000000000000000 8000000000000000 ->  NaN Invalid_operation
175ddxor265 xor  0000000000000000 9000000000000000 ->  NaN Invalid_operation
176-- test MSD-1
177ddxor270 xor  0200001000000000 1000100000000010 ->  NaN Invalid_operation
178ddxor271 xor  0700000100000000 1000010000000100 ->  NaN Invalid_operation
179ddxor272 xor  0800000010000000 1000001000001000 ->  NaN Invalid_operation
180ddxor273 xor  0900000001000000 1000000100010000 ->  NaN Invalid_operation
181ddxor274 xor  1000000000100000 0200000010100000 ->  NaN Invalid_operation
182ddxor275 xor  1000000000010000 0700000001000000 ->  NaN Invalid_operation
183ddxor276 xor  1000000000001000 0800000010100000 ->  NaN Invalid_operation
184ddxor277 xor  1000000000000100 0900000000010000 ->  NaN Invalid_operation
185-- test LSD
186ddxor280 xor  0010000000000002 1000000100000001 ->  NaN Invalid_operation
187ddxor281 xor  0001000000000007 1000001000000011 ->  NaN Invalid_operation
188ddxor282 xor  0000100000000008 1000010000000001 ->  NaN Invalid_operation
189ddxor283 xor  0000010000000009 1000100000000001 ->  NaN Invalid_operation
190ddxor284 xor  1000001000000000 0001000000000002 ->  NaN Invalid_operation
191ddxor285 xor  1000000100000000 0010000000000007 ->  NaN Invalid_operation
192ddxor286 xor  1000000010000000 0100000000000008 ->  NaN Invalid_operation
193ddxor287 xor  1000000001000000 1000000000000009 ->  NaN Invalid_operation
194-- test Middie
195ddxor288 xor  0010000020000000 1000001000000000 ->  NaN Invalid_operation
196ddxor289 xor  0001000070000001 1000000100000000 ->  NaN Invalid_operation
197ddxor290 xor  0000100080000010 1000000010000000 ->  NaN Invalid_operation
198ddxor291 xor  0000010090000100 1000000001000000 ->  NaN Invalid_operation
199ddxor292 xor  1000001000001000 0000000020100000 ->  NaN Invalid_operation
200ddxor293 xor  1000000100010000 0000000070010000 ->  NaN Invalid_operation
201ddxor294 xor  1000000010100000 0000000080001000 ->  NaN Invalid_operation
202ddxor295 xor  1000000001000000 0000000090000100 ->  NaN Invalid_operation
203-- signs
204ddxor296 xor -1000000001000000 -0000010000000100 ->  NaN Invalid_operation
205ddxor297 xor -1000000001000000  0000000010000100 ->  NaN Invalid_operation
206ddxor298 xor  1000000001000000 -0000001000000100 ->  NaN Invalid_operation
207ddxor299 xor  1000000001000000  0000000011000100 ->  1000000010000100
208
209-- Nmax, Nmin, Ntiny-like
210ddxor331 xor  2   9.99999999E+299     -> NaN Invalid_operation
211ddxor332 xor  3   1E-299              -> NaN Invalid_operation
212ddxor333 xor  4   1.00000000E-299     -> NaN Invalid_operation
213ddxor334 xor  5   1E-200              -> NaN Invalid_operation
214ddxor335 xor  6   -1E-200             -> NaN Invalid_operation
215ddxor336 xor  7   -1.00000000E-299    -> NaN Invalid_operation
216ddxor337 xor  8   -1E-299             -> NaN Invalid_operation
217ddxor338 xor  9   -9.99999999E+299    -> NaN Invalid_operation
218ddxor341 xor  9.99999999E+299     -18 -> NaN Invalid_operation
219ddxor342 xor  1E-299               01 -> NaN Invalid_operation
220ddxor343 xor  1.00000000E-299     -18 -> NaN Invalid_operation
221ddxor344 xor  1E-208               18 -> NaN Invalid_operation
222ddxor345 xor  -1E-207             -10 -> NaN Invalid_operation
223ddxor346 xor  -1.00000000E-299     18 -> NaN Invalid_operation
224ddxor347 xor  -1E-299              10 -> NaN Invalid_operation
225ddxor348 xor  -9.99999999E+299    -18 -> NaN Invalid_operation
226
227-- A few other non-integers
228ddxor361 xor  1.0                  1  -> NaN Invalid_operation
229ddxor362 xor  1E+1                 1  -> NaN Invalid_operation
230ddxor363 xor  0.0                  1  -> NaN Invalid_operation
231ddxor364 xor  0E+1                 1  -> NaN Invalid_operation
232ddxor365 xor  9.9                  1  -> NaN Invalid_operation
233ddxor366 xor  9E+1                 1  -> NaN Invalid_operation
234ddxor371 xor  0 1.0                   -> NaN Invalid_operation
235ddxor372 xor  0 1E+1                  -> NaN Invalid_operation
236ddxor373 xor  0 0.0                   -> NaN Invalid_operation
237ddxor374 xor  0 0E+1                  -> NaN Invalid_operation
238ddxor375 xor  0 9.9                   -> NaN Invalid_operation
239ddxor376 xor  0 9E+1                  -> NaN Invalid_operation
240
241-- All Specials are in error
242ddxor780 xor -Inf  -Inf   -> NaN Invalid_operation
243ddxor781 xor -Inf  -1000  -> NaN Invalid_operation
244ddxor782 xor -Inf  -1     -> NaN Invalid_operation
245ddxor783 xor -Inf  -0     -> NaN Invalid_operation
246ddxor784 xor -Inf   0     -> NaN Invalid_operation
247ddxor785 xor -Inf   1     -> NaN Invalid_operation
248ddxor786 xor -Inf   1000  -> NaN Invalid_operation
249ddxor787 xor -1000 -Inf   -> NaN Invalid_operation
250ddxor788 xor -Inf  -Inf   -> NaN Invalid_operation
251ddxor789 xor -1    -Inf   -> NaN Invalid_operation
252ddxor790 xor -0    -Inf   -> NaN Invalid_operation
253ddxor791 xor  0    -Inf   -> NaN Invalid_operation
254ddxor792 xor  1    -Inf   -> NaN Invalid_operation
255ddxor793 xor  1000 -Inf   -> NaN Invalid_operation
256ddxor794 xor  Inf  -Inf   -> NaN Invalid_operation
257
258ddxor800 xor  Inf  -Inf   -> NaN Invalid_operation
259ddxor801 xor  Inf  -1000  -> NaN Invalid_operation
260ddxor802 xor  Inf  -1     -> NaN Invalid_operation
261ddxor803 xor  Inf  -0     -> NaN Invalid_operation
262ddxor804 xor  Inf   0     -> NaN Invalid_operation
263ddxor805 xor  Inf   1     -> NaN Invalid_operation
264ddxor806 xor  Inf   1000  -> NaN Invalid_operation
265ddxor807 xor  Inf   Inf   -> NaN Invalid_operation
266ddxor808 xor -1000  Inf   -> NaN Invalid_operation
267ddxor809 xor -Inf   Inf   -> NaN Invalid_operation
268ddxor810 xor -1     Inf   -> NaN Invalid_operation
269ddxor811 xor -0     Inf   -> NaN Invalid_operation
270ddxor812 xor  0     Inf   -> NaN Invalid_operation
271ddxor813 xor  1     Inf   -> NaN Invalid_operation
272ddxor814 xor  1000  Inf   -> NaN Invalid_operation
273ddxor815 xor  Inf   Inf   -> NaN Invalid_operation
274
275ddxor821 xor  NaN -Inf    -> NaN Invalid_operation
276ddxor822 xor  NaN -1000   -> NaN Invalid_operation
277ddxor823 xor  NaN -1      -> NaN Invalid_operation
278ddxor824 xor  NaN -0      -> NaN Invalid_operation
279ddxor825 xor  NaN  0      -> NaN Invalid_operation
280ddxor826 xor  NaN  1      -> NaN Invalid_operation
281ddxor827 xor  NaN  1000   -> NaN Invalid_operation
282ddxor828 xor  NaN  Inf    -> NaN Invalid_operation
283ddxor829 xor  NaN  NaN    -> NaN Invalid_operation
284ddxor830 xor -Inf  NaN    -> NaN Invalid_operation
285ddxor831 xor -1000 NaN    -> NaN Invalid_operation
286ddxor832 xor -1    NaN    -> NaN Invalid_operation
287ddxor833 xor -0    NaN    -> NaN Invalid_operation
288ddxor834 xor  0    NaN    -> NaN Invalid_operation
289ddxor835 xor  1    NaN    -> NaN Invalid_operation
290ddxor836 xor  1000 NaN    -> NaN Invalid_operation
291ddxor837 xor  Inf  NaN    -> NaN Invalid_operation
292
293ddxor841 xor  sNaN -Inf   ->  NaN  Invalid_operation
294ddxor842 xor  sNaN -1000  ->  NaN  Invalid_operation
295ddxor843 xor  sNaN -1     ->  NaN  Invalid_operation
296ddxor844 xor  sNaN -0     ->  NaN  Invalid_operation
297ddxor845 xor  sNaN  0     ->  NaN  Invalid_operation
298ddxor846 xor  sNaN  1     ->  NaN  Invalid_operation
299ddxor847 xor  sNaN  1000  ->  NaN  Invalid_operation
300ddxor848 xor  sNaN  NaN   ->  NaN  Invalid_operation
301ddxor849 xor  sNaN sNaN   ->  NaN  Invalid_operation
302ddxor850 xor  NaN  sNaN   ->  NaN  Invalid_operation
303ddxor851 xor -Inf  sNaN   ->  NaN  Invalid_operation
304ddxor852 xor -1000 sNaN   ->  NaN  Invalid_operation
305ddxor853 xor -1    sNaN   ->  NaN  Invalid_operation
306ddxor854 xor -0    sNaN   ->  NaN  Invalid_operation
307ddxor855 xor  0    sNaN   ->  NaN  Invalid_operation
308ddxor856 xor  1    sNaN   ->  NaN  Invalid_operation
309ddxor857 xor  1000 sNaN   ->  NaN  Invalid_operation
310ddxor858 xor  Inf  sNaN   ->  NaN  Invalid_operation
311ddxor859 xor  NaN  sNaN   ->  NaN  Invalid_operation
312
313-- propagating NaNs
314ddxor861 xor  NaN1   -Inf    -> NaN Invalid_operation
315ddxor862 xor +NaN2   -1000   -> NaN Invalid_operation
316ddxor863 xor  NaN3    1000   -> NaN Invalid_operation
317ddxor864 xor  NaN4    Inf    -> NaN Invalid_operation
318ddxor865 xor  NaN5   +NaN6   -> NaN Invalid_operation
319ddxor866 xor -Inf     NaN7   -> NaN Invalid_operation
320ddxor867 xor -1000    NaN8   -> NaN Invalid_operation
321ddxor868 xor  1000    NaN9   -> NaN Invalid_operation
322ddxor869 xor  Inf    +NaN10  -> NaN Invalid_operation
323ddxor871 xor  sNaN11  -Inf   -> NaN Invalid_operation
324ddxor872 xor  sNaN12  -1000  -> NaN Invalid_operation
325ddxor873 xor  sNaN13   1000  -> NaN Invalid_operation
326ddxor874 xor  sNaN14   NaN17 -> NaN Invalid_operation
327ddxor875 xor  sNaN15  sNaN18 -> NaN Invalid_operation
328ddxor876 xor  NaN16   sNaN19 -> NaN Invalid_operation
329ddxor877 xor -Inf    +sNaN20 -> NaN Invalid_operation
330ddxor878 xor -1000    sNaN21 -> NaN Invalid_operation
331ddxor879 xor  1000    sNaN22 -> NaN Invalid_operation
332ddxor880 xor  Inf     sNaN23 -> NaN Invalid_operation
333ddxor881 xor +NaN25  +sNaN24 -> NaN Invalid_operation
334ddxor882 xor -NaN26    NaN28 -> NaN Invalid_operation
335ddxor883 xor -sNaN27  sNaN29 -> NaN Invalid_operation
336ddxor884 xor  1000    -NaN30 -> NaN Invalid_operation
337ddxor885 xor  1000   -sNaN31 -> NaN Invalid_operation
338