1------------------------------------------------------------------------
2-- xor.decTest -- digitwise logical XOR                               --
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
23precision:   9
24rounding:    half_up
25maxExponent: 999
26minExponent: -999
27
28-- Sanity check (truth table)
29xorx001 xor             0    0 ->    0
30xorx002 xor             0    1 ->    1
31xorx003 xor             1    0 ->    1
32xorx004 xor             1    1 ->    0
33xorx005 xor          1100 1010 ->  110
34xorx006 xor          1111   10 -> 1101
35-- and at msd and msd-1
36xorx010 xor 000000000 000000000 ->           0
37xorx011 xor 000000000 100000000 ->   100000000
38xorx012 xor 100000000 000000000 ->   100000000
39xorx013 xor 100000000 100000000 ->           0
40xorx014 xor 000000000 000000000 ->           0
41xorx015 xor 000000000 010000000 ->    10000000
42xorx016 xor 010000000 000000000 ->    10000000
43xorx017 xor 010000000 010000000 ->           0
44
45-- Various lengths
46--        123456789     123456789      123456789
47xorx021 xor 111111111     111111111  ->  0
48xorx022 xor 111111111111  111111111  ->  0
49xorx023 xor  11111111      11111111  ->  0
50xorx025 xor   1111111       1111111  ->  0
51xorx026 xor    111111        111111  ->  0
52xorx027 xor     11111         11111  ->  0
53xorx028 xor      1111          1111  ->  0
54xorx029 xor       111           111  ->  0
55xorx031 xor        11            11  ->  0
56xorx032 xor         1             1  ->  0
57xorx033 xor 111111111111 1111111111  ->  0
58xorx034 xor 11111111111 11111111111  ->  0
59xorx035 xor 1111111111 111111111111  ->  0
60xorx036 xor 111111111 1111111111111  ->  0
61
62xorx040 xor 111111111  111111111111  ->  0
63xorx041 xor  11111111  111111111111  ->  100000000
64xorx042 xor  11111111     111111111  ->  100000000
65xorx043 xor   1111111     100000010  ->  101111101
66xorx044 xor    111111     100000100  ->  100111011
67xorx045 xor     11111     100001000  ->  100010111
68xorx046 xor      1111     100010000  ->  100011111
69xorx047 xor       111     100100000  ->  100100111
70xorx048 xor        11     101000000  ->  101000011
71xorx049 xor         1     110000000  ->  110000001
72
73xorx050 xor 1111111111  1  ->  111111110
74xorx051 xor  111111111  1  ->  111111110
75xorx052 xor   11111111  1  ->  11111110
76xorx053 xor    1111111  1  ->  1111110
77xorx054 xor     111111  1  ->  111110
78xorx055 xor      11111  1  ->  11110
79xorx056 xor       1111  1  ->  1110
80xorx057 xor        111  1  ->  110
81xorx058 xor         11  1  ->  10
82xorx059 xor          1  1  ->  0
83
84xorx060 xor 1111111111  0  ->  111111111
85xorx061 xor  111111111  0  ->  111111111
86xorx062 xor   11111111  0  ->  11111111
87xorx063 xor    1111111  0  ->  1111111
88xorx064 xor     111111  0  ->  111111
89xorx065 xor      11111  0  ->  11111
90xorx066 xor       1111  0  ->  1111
91xorx067 xor        111  0  ->  111
92xorx068 xor         11  0  ->  11
93xorx069 xor          1  0  ->  1
94
95xorx070 xor 1  1111111111  ->  111111110
96xorx071 xor 1   111111111  ->  111111110
97xorx072 xor 1    11111111  ->  11111110
98xorx073 xor 1     1111111  ->  1111110
99xorx074 xor 1      111111  ->  111110
100xorx075 xor 1       11111  ->  11110
101xorx076 xor 1        1111  ->  1110
102xorx077 xor 1         111  ->  110
103xorx078 xor 1          11  ->  10
104xorx079 xor 1           1  ->  0
105
106xorx080 xor 0  1111111111  ->  111111111
107xorx081 xor 0   111111111  ->  111111111
108xorx082 xor 0    11111111  ->  11111111
109xorx083 xor 0     1111111  ->  1111111
110xorx084 xor 0      111111  ->  111111
111xorx085 xor 0       11111  ->  11111
112xorx086 xor 0        1111  ->  1111
113xorx087 xor 0         111  ->  111
114xorx088 xor 0          11  ->  11
115xorx089 xor 0           1  ->  1
116
117xorx090 xor 011111111  111101111  ->  100010000
118xorx091 xor 101111111  111101111  ->   10010000
119xorx092 xor 110111111  111101111  ->    1010000
120xorx093 xor 111011111  111101111  ->     110000
121xorx094 xor 111101111  111101111  ->          0
122xorx095 xor 111110111  111101111  ->      11000
123xorx096 xor 111111011  111101111  ->      10100
124xorx097 xor 111111101  111101111  ->      10010
125xorx098 xor 111111110  111101111  ->      10001
126
127xorx100 xor 111101111  011111111  ->  100010000
128xorx101 xor 111101111  101111111  ->   10010000
129xorx102 xor 111101111  110111111  ->    1010000
130xorx103 xor 111101111  111011111  ->     110000
131xorx104 xor 111101111  111101111  ->          0
132xorx105 xor 111101111  111110111  ->      11000
133xorx106 xor 111101111  111111011  ->      10100
134xorx107 xor 111101111  111111101  ->      10010
135xorx108 xor 111101111  111111110  ->      10001
136
137-- non-0/1 should not be accepted, nor should signs
138xorx220 xor 111111112  111111111  ->  NaN Invalid_operation
139xorx221 xor 333333333  333333333  ->  NaN Invalid_operation
140xorx222 xor 555555555  555555555  ->  NaN Invalid_operation
141xorx223 xor 777777777  777777777  ->  NaN Invalid_operation
142xorx224 xor 999999999  999999999  ->  NaN Invalid_operation
143xorx225 xor 222222222  999999999  ->  NaN Invalid_operation
144xorx226 xor 444444444  999999999  ->  NaN Invalid_operation
145xorx227 xor 666666666  999999999  ->  NaN Invalid_operation
146xorx228 xor 888888888  999999999  ->  NaN Invalid_operation
147xorx229 xor 999999999  222222222  ->  NaN Invalid_operation
148xorx230 xor 999999999  444444444  ->  NaN Invalid_operation
149xorx231 xor 999999999  666666666  ->  NaN Invalid_operation
150xorx232 xor 999999999  888888888  ->  NaN Invalid_operation
151-- a few randoms
152xorx240 xor  567468689 -934981942 ->  NaN Invalid_operation
153xorx241 xor  567367689  934981942 ->  NaN Invalid_operation
154xorx242 xor -631917772 -706014634 ->  NaN Invalid_operation
155xorx243 xor -756253257  138579234 ->  NaN Invalid_operation
156xorx244 xor  835590149  567435400 ->  NaN Invalid_operation
157-- test MSD
158xorx250 xor  200000000 100000000 ->  NaN Invalid_operation
159xorx251 xor  700000000 100000000 ->  NaN Invalid_operation
160xorx252 xor  800000000 100000000 ->  NaN Invalid_operation
161xorx253 xor  900000000 100000000 ->  NaN Invalid_operation
162xorx254 xor  200000000 000000000 ->  NaN Invalid_operation
163xorx255 xor  700000000 000000000 ->  NaN Invalid_operation
164xorx256 xor  800000000 000000000 ->  NaN Invalid_operation
165xorx257 xor  900000000 000000000 ->  NaN Invalid_operation
166xorx258 xor  100000000 200000000 ->  NaN Invalid_operation
167xorx259 xor  100000000 700000000 ->  NaN Invalid_operation
168xorx260 xor  100000000 800000000 ->  NaN Invalid_operation
169xorx261 xor  100000000 900000000 ->  NaN Invalid_operation
170xorx262 xor  000000000 200000000 ->  NaN Invalid_operation
171xorx263 xor  000000000 700000000 ->  NaN Invalid_operation
172xorx264 xor  000000000 800000000 ->  NaN Invalid_operation
173xorx265 xor  000000000 900000000 ->  NaN Invalid_operation
174-- test MSD-1
175xorx270 xor  020000000 100000000 ->  NaN Invalid_operation
176xorx271 xor  070100000 100000000 ->  NaN Invalid_operation
177xorx272 xor  080010000 100000001 ->  NaN Invalid_operation
178xorx273 xor  090001000 100000010 ->  NaN Invalid_operation
179xorx274 xor  100000100 020010100 ->  NaN Invalid_operation
180xorx275 xor  100000000 070001000 ->  NaN Invalid_operation
181xorx276 xor  100000010 080010100 ->  NaN Invalid_operation
182xorx277 xor  100000000 090000010 ->  NaN Invalid_operation
183-- test LSD
184xorx280 xor  001000002 100000000 ->  NaN Invalid_operation
185xorx281 xor  000000007 100000000 ->  NaN Invalid_operation
186xorx282 xor  000000008 100000000 ->  NaN Invalid_operation
187xorx283 xor  000000009 100000000 ->  NaN Invalid_operation
188xorx284 xor  100000000 000100002 ->  NaN Invalid_operation
189xorx285 xor  100100000 001000007 ->  NaN Invalid_operation
190xorx286 xor  100010000 010000008 ->  NaN Invalid_operation
191xorx287 xor  100001000 100000009 ->  NaN Invalid_operation
192-- test Middie
193xorx288 xor  001020000 100000000 ->  NaN Invalid_operation
194xorx289 xor  000070001 100000000 ->  NaN Invalid_operation
195xorx290 xor  000080000 100010000 ->  NaN Invalid_operation
196xorx291 xor  000090000 100001000 ->  NaN Invalid_operation
197xorx292 xor  100000010 000020100 ->  NaN Invalid_operation
198xorx293 xor  100100000 000070010 ->  NaN Invalid_operation
199xorx294 xor  100010100 000080001 ->  NaN Invalid_operation
200xorx295 xor  100001000 000090000 ->  NaN Invalid_operation
201-- signs
202xorx296 xor -100001000 -000000000 ->  NaN Invalid_operation
203xorx297 xor -100001000  000010000 ->  NaN Invalid_operation
204xorx298 xor  100001000 -000000000 ->  NaN Invalid_operation
205xorx299 xor  100001000  000011000 ->  100010000
206
207-- Nmax, Nmin, Ntiny
208xorx331 xor  2   9.99999999E+999     -> NaN Invalid_operation
209xorx332 xor  3   1E-999              -> NaN Invalid_operation
210xorx333 xor  4   1.00000000E-999     -> NaN Invalid_operation
211xorx334 xor  5   1E-1007             -> NaN Invalid_operation
212xorx335 xor  6   -1E-1007            -> NaN Invalid_operation
213xorx336 xor  7   -1.00000000E-999    -> NaN Invalid_operation
214xorx337 xor  8   -1E-999             -> NaN Invalid_operation
215xorx338 xor  9   -9.99999999E+999    -> NaN Invalid_operation
216xorx341 xor  9.99999999E+999     -18 -> NaN Invalid_operation
217xorx342 xor  1E-999               01 -> NaN Invalid_operation
218xorx343 xor  1.00000000E-999     -18 -> NaN Invalid_operation
219xorx344 xor  1E-1007              18 -> NaN Invalid_operation
220xorx345 xor  -1E-1007            -10 -> NaN Invalid_operation
221xorx346 xor  -1.00000000E-999     18 -> NaN Invalid_operation
222xorx347 xor  -1E-999              10 -> NaN Invalid_operation
223xorx348 xor  -9.99999999E+999    -18 -> NaN Invalid_operation
224
225-- A few other non-integers
226xorx361 xor  1.0                  1  -> NaN Invalid_operation
227xorx362 xor  1E+1                 1  -> NaN Invalid_operation
228xorx363 xor  0.0                  1  -> NaN Invalid_operation
229xorx364 xor  0E+1                 1  -> NaN Invalid_operation
230xorx365 xor  9.9                  1  -> NaN Invalid_operation
231xorx366 xor  9E+1                 1  -> NaN Invalid_operation
232xorx371 xor  0 1.0                   -> NaN Invalid_operation
233xorx372 xor  0 1E+1                  -> NaN Invalid_operation
234xorx373 xor  0 0.0                   -> NaN Invalid_operation
235xorx374 xor  0 0E+1                  -> NaN Invalid_operation
236xorx375 xor  0 9.9                   -> NaN Invalid_operation
237xorx376 xor  0 9E+1                  -> NaN Invalid_operation
238
239-- All Specials are in error
240xorx780 xor -Inf  -Inf   -> NaN Invalid_operation
241xorx781 xor -Inf  -1000  -> NaN Invalid_operation
242xorx782 xor -Inf  -1     -> NaN Invalid_operation
243xorx783 xor -Inf  -0     -> NaN Invalid_operation
244xorx784 xor -Inf   0     -> NaN Invalid_operation
245xorx785 xor -Inf   1     -> NaN Invalid_operation
246xorx786 xor -Inf   1000  -> NaN Invalid_operation
247xorx787 xor -1000 -Inf   -> NaN Invalid_operation
248xorx788 xor -Inf  -Inf   -> NaN Invalid_operation
249xorx789 xor -1    -Inf   -> NaN Invalid_operation
250xorx790 xor -0    -Inf   -> NaN Invalid_operation
251xorx791 xor  0    -Inf   -> NaN Invalid_operation
252xorx792 xor  1    -Inf   -> NaN Invalid_operation
253xorx793 xor  1000 -Inf   -> NaN Invalid_operation
254xorx794 xor  Inf  -Inf   -> NaN Invalid_operation
255
256xorx800 xor  Inf  -Inf   -> NaN Invalid_operation
257xorx801 xor  Inf  -1000  -> NaN Invalid_operation
258xorx802 xor  Inf  -1     -> NaN Invalid_operation
259xorx803 xor  Inf  -0     -> NaN Invalid_operation
260xorx804 xor  Inf   0     -> NaN Invalid_operation
261xorx805 xor  Inf   1     -> NaN Invalid_operation
262xorx806 xor  Inf   1000  -> NaN Invalid_operation
263xorx807 xor  Inf   Inf   -> NaN Invalid_operation
264xorx808 xor -1000  Inf   -> NaN Invalid_operation
265xorx809 xor -Inf   Inf   -> NaN Invalid_operation
266xorx810 xor -1     Inf   -> NaN Invalid_operation
267xorx811 xor -0     Inf   -> NaN Invalid_operation
268xorx812 xor  0     Inf   -> NaN Invalid_operation
269xorx813 xor  1     Inf   -> NaN Invalid_operation
270xorx814 xor  1000  Inf   -> NaN Invalid_operation
271xorx815 xor  Inf   Inf   -> NaN Invalid_operation
272
273xorx821 xor  NaN -Inf    -> NaN Invalid_operation
274xorx822 xor  NaN -1000   -> NaN Invalid_operation
275xorx823 xor  NaN -1      -> NaN Invalid_operation
276xorx824 xor  NaN -0      -> NaN Invalid_operation
277xorx825 xor  NaN  0      -> NaN Invalid_operation
278xorx826 xor  NaN  1      -> NaN Invalid_operation
279xorx827 xor  NaN  1000   -> NaN Invalid_operation
280xorx828 xor  NaN  Inf    -> NaN Invalid_operation
281xorx829 xor  NaN  NaN    -> NaN Invalid_operation
282xorx830 xor -Inf  NaN    -> NaN Invalid_operation
283xorx831 xor -1000 NaN    -> NaN Invalid_operation
284xorx832 xor -1    NaN    -> NaN Invalid_operation
285xorx833 xor -0    NaN    -> NaN Invalid_operation
286xorx834 xor  0    NaN    -> NaN Invalid_operation
287xorx835 xor  1    NaN    -> NaN Invalid_operation
288xorx836 xor  1000 NaN    -> NaN Invalid_operation
289xorx837 xor  Inf  NaN    -> NaN Invalid_operation
290
291xorx841 xor  sNaN -Inf   ->  NaN  Invalid_operation
292xorx842 xor  sNaN -1000  ->  NaN  Invalid_operation
293xorx843 xor  sNaN -1     ->  NaN  Invalid_operation
294xorx844 xor  sNaN -0     ->  NaN  Invalid_operation
295xorx845 xor  sNaN  0     ->  NaN  Invalid_operation
296xorx846 xor  sNaN  1     ->  NaN  Invalid_operation
297xorx847 xor  sNaN  1000  ->  NaN  Invalid_operation
298xorx848 xor  sNaN  NaN   ->  NaN  Invalid_operation
299xorx849 xor  sNaN sNaN   ->  NaN  Invalid_operation
300xorx850 xor  NaN  sNaN   ->  NaN  Invalid_operation
301xorx851 xor -Inf  sNaN   ->  NaN  Invalid_operation
302xorx852 xor -1000 sNaN   ->  NaN  Invalid_operation
303xorx853 xor -1    sNaN   ->  NaN  Invalid_operation
304xorx854 xor -0    sNaN   ->  NaN  Invalid_operation
305xorx855 xor  0    sNaN   ->  NaN  Invalid_operation
306xorx856 xor  1    sNaN   ->  NaN  Invalid_operation
307xorx857 xor  1000 sNaN   ->  NaN  Invalid_operation
308xorx858 xor  Inf  sNaN   ->  NaN  Invalid_operation
309xorx859 xor  NaN  sNaN   ->  NaN  Invalid_operation
310
311-- propagating NaNs
312xorx861 xor  NaN1   -Inf    -> NaN Invalid_operation
313xorx862 xor +NaN2   -1000   -> NaN Invalid_operation
314xorx863 xor  NaN3    1000   -> NaN Invalid_operation
315xorx864 xor  NaN4    Inf    -> NaN Invalid_operation
316xorx865 xor  NaN5   +NaN6   -> NaN Invalid_operation
317xorx866 xor -Inf     NaN7   -> NaN Invalid_operation
318xorx867 xor -1000    NaN8   -> NaN Invalid_operation
319xorx868 xor  1000    NaN9   -> NaN Invalid_operation
320xorx869 xor  Inf    +NaN10  -> NaN Invalid_operation
321xorx871 xor  sNaN11  -Inf   -> NaN Invalid_operation
322xorx872 xor  sNaN12  -1000  -> NaN Invalid_operation
323xorx873 xor  sNaN13   1000  -> NaN Invalid_operation
324xorx874 xor  sNaN14   NaN17 -> NaN Invalid_operation
325xorx875 xor  sNaN15  sNaN18 -> NaN Invalid_operation
326xorx876 xor  NaN16   sNaN19 -> NaN Invalid_operation
327xorx877 xor -Inf    +sNaN20 -> NaN Invalid_operation
328xorx878 xor -1000    sNaN21 -> NaN Invalid_operation
329xorx879 xor  1000    sNaN22 -> NaN Invalid_operation
330xorx880 xor  Inf     sNaN23 -> NaN Invalid_operation
331xorx881 xor +NaN25  +sNaN24 -> NaN Invalid_operation
332xorx882 xor -NaN26    NaN28 -> NaN Invalid_operation
333xorx883 xor -sNaN27  sNaN29 -> NaN Invalid_operation
334xorx884 xor  1000    -NaN30 -> NaN Invalid_operation
335xorx885 xor  1000   -sNaN31 -> NaN Invalid_operation
336