1------------------------------------------------------------------------
2-- ddAnd.decTest -- digitwise logical AND 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)
30ddand001 and             0    0 ->    0
31ddand002 and             0    1 ->    0
32ddand003 and             1    0 ->    0
33ddand004 and             1    1 ->    1
34ddand005 and          1100 1010 -> 1000
35-- and at msd and msd-1
36--           1234567890123456 1234567890123456      1234567890123456
37ddand006 and 0000000000000000 0000000000000000 ->                  0
38ddand007 and 0000000000000000 1000000000000000 ->                  0
39ddand008 and 1000000000000000 0000000000000000 ->                  0
40ddand009 and 1000000000000000 1000000000000000 ->   1000000000000000
41ddand010 and 0000000000000000 0000000000000000 ->                  0
42ddand011 and 0000000000000000 0100000000000000 ->                  0
43ddand012 and 0100000000000000 0000000000000000 ->                  0
44ddand013 and 0100000000000000 0100000000000000 ->    100000000000000
45
46-- Various lengths
47--           1234567890123456 1234567890123456      1234567890123456
48ddand021 and 1111111111111111 1111111111111111  ->  1111111111111111
49ddand024 and 1111111111111111  111111111111111  ->   111111111111111
50ddand025 and 1111111111111111   11111111111111  ->    11111111111111
51ddand026 and 1111111111111111    1111111111111  ->     1111111111111
52ddand027 and 1111111111111111     111111111111  ->      111111111111
53ddand028 and 1111111111111111      11111111111  ->       11111111111
54ddand029 and 1111111111111111       1111111111  ->        1111111111
55ddand030 and 1111111111111111        111111111  ->         111111111
56ddand031 and 1111111111111111         11111111  ->          11111111
57ddand032 and 1111111111111111          1111111  ->           1111111
58ddand033 and 1111111111111111           111111  ->            111111
59ddand034 and 1111111111111111            11111  ->             11111
60ddand035 and 1111111111111111             1111  ->              1111
61ddand036 and 1111111111111111              111  ->               111
62ddand037 and 1111111111111111               11  ->                11
63ddand038 and 1111111111111111                1  ->                 1
64ddand039 and 1111111111111111                0  ->                 0
65
66ddand040 and 1111111111111111    1111111111111111 ->  1111111111111111
67ddand041 and  111111111111111    1111111111111111 ->   111111111111111
68ddand042 and  111111111111111    1111111111111111 ->   111111111111111
69ddand043 and   11111111111111    1111111111111111 ->    11111111111111
70ddand044 and    1111111111111    1111111111111111 ->     1111111111111
71ddand045 and     111111111111    1111111111111111 ->      111111111111
72ddand046 and      11111111111    1111111111111111 ->       11111111111
73ddand047 and       1111111111    1111111111111111 ->        1111111111
74ddand048 and        111111111    1111111111111111 ->         111111111
75ddand049 and         11111111    1111111111111111 ->          11111111
76ddand050 and          1111111    1111111111111111 ->           1111111
77ddand051 and           111111    1111111111111111 ->            111111
78ddand052 and            11111    1111111111111111 ->             11111
79ddand053 and             1111    1111111111111111 ->              1111
80ddand054 and              111    1111111111111111 ->               111
81ddand055 and               11    1111111111111111 ->                11
82ddand056 and                1    1111111111111111 ->                 1
83ddand057 and                0    1111111111111111 ->                 0
84
85ddand150 and 1111111111  1  ->  1
86ddand151 and  111111111  1  ->  1
87ddand152 and   11111111  1  ->  1
88ddand153 and    1111111  1  ->  1
89ddand154 and     111111  1  ->  1
90ddand155 and      11111  1  ->  1
91ddand156 and       1111  1  ->  1
92ddand157 and        111  1  ->  1
93ddand158 and         11  1  ->  1
94ddand159 and          1  1  ->  1
95
96ddand160 and 1111111111  0  ->  0
97ddand161 and  111111111  0  ->  0
98ddand162 and   11111111  0  ->  0
99ddand163 and    1111111  0  ->  0
100ddand164 and     111111  0  ->  0
101ddand165 and      11111  0  ->  0
102ddand166 and       1111  0  ->  0
103ddand167 and        111  0  ->  0
104ddand168 and         11  0  ->  0
105ddand169 and          1  0  ->  0
106
107ddand170 and 1  1111111111  ->  1
108ddand171 and 1   111111111  ->  1
109ddand172 and 1    11111111  ->  1
110ddand173 and 1     1111111  ->  1
111ddand174 and 1      111111  ->  1
112ddand175 and 1       11111  ->  1
113ddand176 and 1        1111  ->  1
114ddand177 and 1         111  ->  1
115ddand178 and 1          11  ->  1
116ddand179 and 1           1  ->  1
117
118ddand180 and 0  1111111111  ->  0
119ddand181 and 0   111111111  ->  0
120ddand182 and 0    11111111  ->  0
121ddand183 and 0     1111111  ->  0
122ddand184 and 0      111111  ->  0
123ddand185 and 0       11111  ->  0
124ddand186 and 0        1111  ->  0
125ddand187 and 0         111  ->  0
126ddand188 and 0          11  ->  0
127ddand189 and 0           1  ->  0
128
129ddand090 and 011111111  111111111  ->   11111111
130ddand091 and 101111111  111111111  ->  101111111
131ddand092 and 110111111  111111111  ->  110111111
132ddand093 and 111011111  111111111  ->  111011111
133ddand094 and 111101111  111111111  ->  111101111
134ddand095 and 111110111  111111111  ->  111110111
135ddand096 and 111111011  111111111  ->  111111011
136ddand097 and 111111101  111111111  ->  111111101
137ddand098 and 111111110  111111111  ->  111111110
138
139ddand100 and 111111111  011111111  ->   11111111
140ddand101 and 111111111  101111111  ->  101111111
141ddand102 and 111111111  110111111  ->  110111111
142ddand103 and 111111111  111011111  ->  111011111
143ddand104 and 111111111  111101111  ->  111101111
144ddand105 and 111111111  111110111  ->  111110111
145ddand106 and 111111111  111111011  ->  111111011
146ddand107 and 111111111  111111101  ->  111111101
147ddand108 and 111111111  111111110  ->  111111110
148
149-- non-0/1 should not be accepted, nor should signs
150ddand220 and 111111112  111111111  ->  NaN Invalid_operation
151ddand221 and 333333333  333333333  ->  NaN Invalid_operation
152ddand222 and 555555555  555555555  ->  NaN Invalid_operation
153ddand223 and 777777777  777777777  ->  NaN Invalid_operation
154ddand224 and 999999999  999999999  ->  NaN Invalid_operation
155ddand225 and 222222222  999999999  ->  NaN Invalid_operation
156ddand226 and 444444444  999999999  ->  NaN Invalid_operation
157ddand227 and 666666666  999999999  ->  NaN Invalid_operation
158ddand228 and 888888888  999999999  ->  NaN Invalid_operation
159ddand229 and 999999999  222222222  ->  NaN Invalid_operation
160ddand230 and 999999999  444444444  ->  NaN Invalid_operation
161ddand231 and 999999999  666666666  ->  NaN Invalid_operation
162ddand232 and 999999999  888888888  ->  NaN Invalid_operation
163-- a few randoms
164ddand240 and  567468689 -934981942 ->  NaN Invalid_operation
165ddand241 and  567367689  934981942 ->  NaN Invalid_operation
166ddand242 and -631917772 -706014634 ->  NaN Invalid_operation
167ddand243 and -756253257  138579234 ->  NaN Invalid_operation
168ddand244 and  835590149  567435400 ->  NaN Invalid_operation
169-- test MSD
170ddand250 and  2000000000000000 1000000000000000 ->  NaN Invalid_operation
171ddand251 and  7000000000000000 1000000000000000 ->  NaN Invalid_operation
172ddand252 and  8000000000000000 1000000000000000 ->  NaN Invalid_operation
173ddand253 and  9000000000000000 1000000000000000 ->  NaN Invalid_operation
174ddand254 and  2000000000000000 0000000000000000 ->  NaN Invalid_operation
175ddand255 and  7000000000000000 0000000000000000 ->  NaN Invalid_operation
176ddand256 and  8000000000000000 0000000000000000 ->  NaN Invalid_operation
177ddand257 and  9000000000000000 0000000000000000 ->  NaN Invalid_operation
178ddand258 and  1000000000000000 2000000000000000 ->  NaN Invalid_operation
179ddand259 and  1000000000000000 7000000000000000 ->  NaN Invalid_operation
180ddand260 and  1000000000000000 8000000000000000 ->  NaN Invalid_operation
181ddand261 and  1000000000000000 9000000000000000 ->  NaN Invalid_operation
182ddand262 and  0000000000000000 2000000000000000 ->  NaN Invalid_operation
183ddand263 and  0000000000000000 7000000000000000 ->  NaN Invalid_operation
184ddand264 and  0000000000000000 8000000000000000 ->  NaN Invalid_operation
185ddand265 and  0000000000000000 9000000000000000 ->  NaN Invalid_operation
186-- test MSD-1
187ddand270 and  0200001000000000 1000100000000010 ->  NaN Invalid_operation
188ddand271 and  0700000100000000 1000010000000100 ->  NaN Invalid_operation
189ddand272 and  0800000010000000 1000001000001000 ->  NaN Invalid_operation
190ddand273 and  0900000001000000 1000000100010000 ->  NaN Invalid_operation
191ddand274 and  1000000000100000 0200000010100000 ->  NaN Invalid_operation
192ddand275 and  1000000000010000 0700000001000000 ->  NaN Invalid_operation
193ddand276 and  1000000000001000 0800000010100000 ->  NaN Invalid_operation
194ddand277 and  1000000000000100 0900000000010000 ->  NaN Invalid_operation
195-- test LSD
196ddand280 and  0010000000000002 1000000100000001 ->  NaN Invalid_operation
197ddand281 and  0001000000000007 1000001000000011 ->  NaN Invalid_operation
198ddand282 and  0000100000000008 1000010000000001 ->  NaN Invalid_operation
199ddand283 and  0000010000000009 1000100000000001 ->  NaN Invalid_operation
200ddand284 and  1000001000000000 0001000000000002 ->  NaN Invalid_operation
201ddand285 and  1000000100000000 0010000000000007 ->  NaN Invalid_operation
202ddand286 and  1000000010000000 0100000000000008 ->  NaN Invalid_operation
203ddand287 and  1000000001000000 1000000000000009 ->  NaN Invalid_operation
204-- test Middie
205ddand288 and  0010000020000000 1000001000000000 ->  NaN Invalid_operation
206ddand289 and  0001000070000001 1000000100000000 ->  NaN Invalid_operation
207ddand290 and  0000100080000010 1000000010000000 ->  NaN Invalid_operation
208ddand291 and  0000010090000100 1000000001000000 ->  NaN Invalid_operation
209ddand292 and  1000001000001000 0000000020100000 ->  NaN Invalid_operation
210ddand293 and  1000000100010000 0000000070010000 ->  NaN Invalid_operation
211ddand294 and  1000000010100000 0000000080001000 ->  NaN Invalid_operation
212ddand295 and  1000000001000000 0000000090000100 ->  NaN Invalid_operation
213-- signs
214ddand296 and -1000000001000000 -0000010000000100 ->  NaN Invalid_operation
215ddand297 and -1000000001000000  0000000010000100 ->  NaN Invalid_operation
216ddand298 and  1000000001000000 -0000001000000100 ->  NaN Invalid_operation
217ddand299 and  1000000001000000  0000000011000100 ->  1000000
218
219-- Nmax, Nmin, Ntiny-like
220ddand331 and  2   9.99999999E+199     -> NaN Invalid_operation
221ddand332 and  3   1E-199              -> NaN Invalid_operation
222ddand333 and  4   1.00000000E-199     -> NaN Invalid_operation
223ddand334 and  5   1E-100              -> NaN Invalid_operation
224ddand335 and  6   -1E-100             -> NaN Invalid_operation
225ddand336 and  7   -1.00000000E-199    -> NaN Invalid_operation
226ddand337 and  8   -1E-199             -> NaN Invalid_operation
227ddand338 and  9   -9.99999999E+199    -> NaN Invalid_operation
228ddand341 and  9.99999999E+199     -18 -> NaN Invalid_operation
229ddand342 and  1E-199               01 -> NaN Invalid_operation
230ddand343 and  1.00000000E-199     -18 -> NaN Invalid_operation
231ddand344 and  1E-100               18 -> NaN Invalid_operation
232ddand345 and  -1E-100             -10 -> NaN Invalid_operation
233ddand346 and  -1.00000000E-199     18 -> NaN Invalid_operation
234ddand347 and  -1E-199              10 -> NaN Invalid_operation
235ddand348 and  -9.99999999E+199    -18 -> NaN Invalid_operation
236
237-- A few other non-integers
238ddand361 and  1.0                  1  -> NaN Invalid_operation
239ddand362 and  1E+1                 1  -> NaN Invalid_operation
240ddand363 and  0.0                  1  -> NaN Invalid_operation
241ddand364 and  0E+1                 1  -> NaN Invalid_operation
242ddand365 and  9.9                  1  -> NaN Invalid_operation
243ddand366 and  9E+1                 1  -> NaN Invalid_operation
244ddand371 and  0 1.0                   -> NaN Invalid_operation
245ddand372 and  0 1E+1                  -> NaN Invalid_operation
246ddand373 and  0 0.0                   -> NaN Invalid_operation
247ddand374 and  0 0E+1                  -> NaN Invalid_operation
248ddand375 and  0 9.9                   -> NaN Invalid_operation
249ddand376 and  0 9E+1                  -> NaN Invalid_operation
250
251-- All Specials are in error
252ddand780 and -Inf  -Inf   -> NaN Invalid_operation
253ddand781 and -Inf  -1000  -> NaN Invalid_operation
254ddand782 and -Inf  -1     -> NaN Invalid_operation
255ddand783 and -Inf  -0     -> NaN Invalid_operation
256ddand784 and -Inf   0     -> NaN Invalid_operation
257ddand785 and -Inf   1     -> NaN Invalid_operation
258ddand786 and -Inf   1000  -> NaN Invalid_operation
259ddand787 and -1000 -Inf   -> NaN Invalid_operation
260ddand788 and -Inf  -Inf   -> NaN Invalid_operation
261ddand789 and -1    -Inf   -> NaN Invalid_operation
262ddand790 and -0    -Inf   -> NaN Invalid_operation
263ddand791 and  0    -Inf   -> NaN Invalid_operation
264ddand792 and  1    -Inf   -> NaN Invalid_operation
265ddand793 and  1000 -Inf   -> NaN Invalid_operation
266ddand794 and  Inf  -Inf   -> NaN Invalid_operation
267
268ddand800 and  Inf  -Inf   -> NaN Invalid_operation
269ddand801 and  Inf  -1000  -> NaN Invalid_operation
270ddand802 and  Inf  -1     -> NaN Invalid_operation
271ddand803 and  Inf  -0     -> NaN Invalid_operation
272ddand804 and  Inf   0     -> NaN Invalid_operation
273ddand805 and  Inf   1     -> NaN Invalid_operation
274ddand806 and  Inf   1000  -> NaN Invalid_operation
275ddand807 and  Inf   Inf   -> NaN Invalid_operation
276ddand808 and -1000  Inf   -> NaN Invalid_operation
277ddand809 and -Inf   Inf   -> NaN Invalid_operation
278ddand810 and -1     Inf   -> NaN Invalid_operation
279ddand811 and -0     Inf   -> NaN Invalid_operation
280ddand812 and  0     Inf   -> NaN Invalid_operation
281ddand813 and  1     Inf   -> NaN Invalid_operation
282ddand814 and  1000  Inf   -> NaN Invalid_operation
283ddand815 and  Inf   Inf   -> NaN Invalid_operation
284
285ddand821 and  NaN -Inf    -> NaN Invalid_operation
286ddand822 and  NaN -1000   -> NaN Invalid_operation
287ddand823 and  NaN -1      -> NaN Invalid_operation
288ddand824 and  NaN -0      -> NaN Invalid_operation
289ddand825 and  NaN  0      -> NaN Invalid_operation
290ddand826 and  NaN  1      -> NaN Invalid_operation
291ddand827 and  NaN  1000   -> NaN Invalid_operation
292ddand828 and  NaN  Inf    -> NaN Invalid_operation
293ddand829 and  NaN  NaN    -> NaN Invalid_operation
294ddand830 and -Inf  NaN    -> NaN Invalid_operation
295ddand831 and -1000 NaN    -> NaN Invalid_operation
296ddand832 and -1    NaN    -> NaN Invalid_operation
297ddand833 and -0    NaN    -> NaN Invalid_operation
298ddand834 and  0    NaN    -> NaN Invalid_operation
299ddand835 and  1    NaN    -> NaN Invalid_operation
300ddand836 and  1000 NaN    -> NaN Invalid_operation
301ddand837 and  Inf  NaN    -> NaN Invalid_operation
302
303ddand841 and  sNaN -Inf   ->  NaN  Invalid_operation
304ddand842 and  sNaN -1000  ->  NaN  Invalid_operation
305ddand843 and  sNaN -1     ->  NaN  Invalid_operation
306ddand844 and  sNaN -0     ->  NaN  Invalid_operation
307ddand845 and  sNaN  0     ->  NaN  Invalid_operation
308ddand846 and  sNaN  1     ->  NaN  Invalid_operation
309ddand847 and  sNaN  1000  ->  NaN  Invalid_operation
310ddand848 and  sNaN  NaN   ->  NaN  Invalid_operation
311ddand849 and  sNaN sNaN   ->  NaN  Invalid_operation
312ddand850 and  NaN  sNaN   ->  NaN  Invalid_operation
313ddand851 and -Inf  sNaN   ->  NaN  Invalid_operation
314ddand852 and -1000 sNaN   ->  NaN  Invalid_operation
315ddand853 and -1    sNaN   ->  NaN  Invalid_operation
316ddand854 and -0    sNaN   ->  NaN  Invalid_operation
317ddand855 and  0    sNaN   ->  NaN  Invalid_operation
318ddand856 and  1    sNaN   ->  NaN  Invalid_operation
319ddand857 and  1000 sNaN   ->  NaN  Invalid_operation
320ddand858 and  Inf  sNaN   ->  NaN  Invalid_operation
321ddand859 and  NaN  sNaN   ->  NaN  Invalid_operation
322
323-- propagating NaNs
324ddand861 and  NaN1   -Inf    -> NaN Invalid_operation
325ddand862 and +NaN2   -1000   -> NaN Invalid_operation
326ddand863 and  NaN3    1000   -> NaN Invalid_operation
327ddand864 and  NaN4    Inf    -> NaN Invalid_operation
328ddand865 and  NaN5   +NaN6   -> NaN Invalid_operation
329ddand866 and -Inf     NaN7   -> NaN Invalid_operation
330ddand867 and -1000    NaN8   -> NaN Invalid_operation
331ddand868 and  1000    NaN9   -> NaN Invalid_operation
332ddand869 and  Inf    +NaN10  -> NaN Invalid_operation
333ddand871 and  sNaN11  -Inf   -> NaN Invalid_operation
334ddand872 and  sNaN12  -1000  -> NaN Invalid_operation
335ddand873 and  sNaN13   1000  -> NaN Invalid_operation
336ddand874 and  sNaN14   NaN17 -> NaN Invalid_operation
337ddand875 and  sNaN15  sNaN18 -> NaN Invalid_operation
338ddand876 and  NaN16   sNaN19 -> NaN Invalid_operation
339ddand877 and -Inf    +sNaN20 -> NaN Invalid_operation
340ddand878 and -1000    sNaN21 -> NaN Invalid_operation
341ddand879 and  1000    sNaN22 -> NaN Invalid_operation
342ddand880 and  Inf     sNaN23 -> NaN Invalid_operation
343ddand881 and +NaN25  +sNaN24 -> NaN Invalid_operation
344ddand882 and -NaN26    NaN28 -> NaN Invalid_operation
345ddand883 and -sNaN27  sNaN29 -> NaN Invalid_operation
346ddand884 and  1000    -NaN30 -> NaN Invalid_operation
347ddand885 and  1000   -sNaN31 -> NaN Invalid_operation
348