1------------------------------------------------------------------------
2-- dqMax.decTest -- decQuad maxnum                                    --
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
22-- we assume that base comparison is tested in compare.decTest, so
23-- these mainly cover special cases and rounding
24extended:    1
25clamp:       1
26precision:   34
27maxExponent: 6144
28minExponent: -6143
29rounding:    half_even
30
31-- sanity checks
32dqmax001 max  -2  -2  -> -2
33dqmax002 max  -2  -1  -> -1
34dqmax003 max  -2   0  ->  0
35dqmax004 max  -2   1  ->  1
36dqmax005 max  -2   2  ->  2
37dqmax006 max  -1  -2  -> -1
38dqmax007 max  -1  -1  -> -1
39dqmax008 max  -1   0  ->  0
40dqmax009 max  -1   1  ->  1
41dqmax010 max  -1   2  ->  2
42dqmax011 max   0  -2  ->  0
43dqmax012 max   0  -1  ->  0
44dqmax013 max   0   0  ->  0
45dqmax014 max   0   1  ->  1
46dqmax015 max   0   2  ->  2
47dqmax016 max   1  -2  ->  1
48dqmax017 max   1  -1  ->  1
49dqmax018 max   1   0  ->  1
50dqmax019 max   1   1  ->  1
51dqmax020 max   1   2  ->  2
52dqmax021 max   2  -2  ->  2
53dqmax022 max   2  -1  ->  2
54dqmax023 max   2   0  ->  2
55dqmax025 max   2   1  ->  2
56dqmax026 max   2   2  ->  2
57
58-- extended zeros
59dqmax030 max   0     0   ->  0
60dqmax031 max   0    -0   ->  0
61dqmax032 max   0    -0.0 ->  0
62dqmax033 max   0     0.0 ->  0
63dqmax034 max  -0     0   ->  0    -- note: -0 = 0, but 0 chosen
64dqmax035 max  -0    -0   -> -0
65dqmax036 max  -0    -0.0 -> -0.0
66dqmax037 max  -0     0.0 ->  0.0
67dqmax038 max   0.0   0   ->  0
68dqmax039 max   0.0  -0   ->  0.0
69dqmax040 max   0.0  -0.0 ->  0.0
70dqmax041 max   0.0   0.0 ->  0.0
71dqmax042 max  -0.0   0   ->  0
72dqmax043 max  -0.0  -0   -> -0.0
73dqmax044 max  -0.0  -0.0 -> -0.0
74dqmax045 max  -0.0   0.0 ->  0.0
75
76dqmax050 max  -0E1   0E1 ->  0E+1
77dqmax051 max  -0E2   0E2 ->  0E+2
78dqmax052 max  -0E2   0E1 ->  0E+1
79dqmax053 max  -0E1   0E2 ->  0E+2
80dqmax054 max   0E1  -0E1 ->  0E+1
81dqmax055 max   0E2  -0E2 ->  0E+2
82dqmax056 max   0E2  -0E1 ->  0E+2
83dqmax057 max   0E1  -0E2 ->  0E+1
84
85dqmax058 max   0E1   0E1 ->  0E+1
86dqmax059 max   0E2   0E2 ->  0E+2
87dqmax060 max   0E2   0E1 ->  0E+2
88dqmax061 max   0E1   0E2 ->  0E+2
89dqmax062 max  -0E1  -0E1 -> -0E+1
90dqmax063 max  -0E2  -0E2 -> -0E+2
91dqmax064 max  -0E2  -0E1 -> -0E+1
92dqmax065 max  -0E1  -0E2 -> -0E+1
93
94-- Specials
95dqmax090 max  Inf  -Inf   ->  Infinity
96dqmax091 max  Inf  -1000  ->  Infinity
97dqmax092 max  Inf  -1     ->  Infinity
98dqmax093 max  Inf  -0     ->  Infinity
99dqmax094 max  Inf   0     ->  Infinity
100dqmax095 max  Inf   1     ->  Infinity
101dqmax096 max  Inf   1000  ->  Infinity
102dqmax097 max  Inf   Inf   ->  Infinity
103dqmax098 max -1000  Inf   ->  Infinity
104dqmax099 max -Inf   Inf   ->  Infinity
105dqmax100 max -1     Inf   ->  Infinity
106dqmax101 max -0     Inf   ->  Infinity
107dqmax102 max  0     Inf   ->  Infinity
108dqmax103 max  1     Inf   ->  Infinity
109dqmax104 max  1000  Inf   ->  Infinity
110dqmax105 max  Inf   Inf   ->  Infinity
111
112dqmax120 max -Inf  -Inf   -> -Infinity
113dqmax121 max -Inf  -1000  -> -1000
114dqmax122 max -Inf  -1     -> -1
115dqmax123 max -Inf  -0     -> -0
116dqmax124 max -Inf   0     ->  0
117dqmax125 max -Inf   1     ->  1
118dqmax126 max -Inf   1000  ->  1000
119dqmax127 max -Inf   Inf   ->  Infinity
120dqmax128 max -Inf  -Inf   ->  -Infinity
121dqmax129 max -1000 -Inf   ->  -1000
122dqmax130 max -1    -Inf   ->  -1
123dqmax131 max -0    -Inf   ->  -0
124dqmax132 max  0    -Inf   ->  0
125dqmax133 max  1    -Inf   ->  1
126dqmax134 max  1000 -Inf   ->  1000
127dqmax135 max  Inf  -Inf   ->  Infinity
128
129-- 2004.08.02 754r chooses number over NaN in mixed cases
130dqmax141 max  NaN -Inf    -> -Infinity
131dqmax142 max  NaN -1000   -> -1000
132dqmax143 max  NaN -1      -> -1
133dqmax144 max  NaN -0      -> -0
134dqmax145 max  NaN  0      ->  0
135dqmax146 max  NaN  1      ->  1
136dqmax147 max  NaN  1000   ->  1000
137dqmax148 max  NaN  Inf    ->  Infinity
138dqmax149 max  NaN  NaN    ->  NaN
139dqmax150 max -Inf  NaN    -> -Infinity
140dqmax151 max -1000 NaN    -> -1000
141dqmax152 max -1    NaN    -> -1
142dqmax153 max -0    NaN    -> -0
143dqmax154 max  0    NaN    ->  0
144dqmax155 max  1    NaN    ->  1
145dqmax156 max  1000 NaN    ->  1000
146dqmax157 max  Inf  NaN    ->  Infinity
147
148dqmax161 max  sNaN -Inf   ->  NaN  Invalid_operation
149dqmax162 max  sNaN -1000  ->  NaN  Invalid_operation
150dqmax163 max  sNaN -1     ->  NaN  Invalid_operation
151dqmax164 max  sNaN -0     ->  NaN  Invalid_operation
152dqmax165 max  sNaN  0     ->  NaN  Invalid_operation
153dqmax166 max  sNaN  1     ->  NaN  Invalid_operation
154dqmax167 max  sNaN  1000  ->  NaN  Invalid_operation
155dqmax168 max  sNaN  NaN   ->  NaN  Invalid_operation
156dqmax169 max  sNaN sNaN   ->  NaN  Invalid_operation
157dqmax170 max  NaN  sNaN   ->  NaN  Invalid_operation
158dqmax171 max -Inf  sNaN   ->  NaN  Invalid_operation
159dqmax172 max -1000 sNaN   ->  NaN  Invalid_operation
160dqmax173 max -1    sNaN   ->  NaN  Invalid_operation
161dqmax174 max -0    sNaN   ->  NaN  Invalid_operation
162dqmax175 max  0    sNaN   ->  NaN  Invalid_operation
163dqmax176 max  1    sNaN   ->  NaN  Invalid_operation
164dqmax177 max  1000 sNaN   ->  NaN  Invalid_operation
165dqmax178 max  Inf  sNaN   ->  NaN  Invalid_operation
166dqmax179 max  NaN  sNaN   ->  NaN  Invalid_operation
167
168-- propagating NaNs
169dqmax181 max  NaN9  -Inf   -> -Infinity
170dqmax182 max  NaN8     9   ->  9
171dqmax183 max -NaN7   Inf   ->  Infinity
172
173dqmax184 max -NaN1   NaN11 -> -NaN1
174dqmax185 max  NaN2   NaN12 ->  NaN2
175dqmax186 max -NaN13 -NaN7  -> -NaN13
176dqmax187 max  NaN14 -NaN5  ->  NaN14
177
178dqmax188 max -Inf    NaN4  -> -Infinity
179dqmax189 max -9     -NaN3  -> -9
180dqmax190 max  Inf    NaN2  ->  Infinity
181
182dqmax191 max  sNaN99 -Inf    ->  NaN99 Invalid_operation
183dqmax192 max  sNaN98 -1      ->  NaN98 Invalid_operation
184dqmax193 max -sNaN97  NaN    -> -NaN97 Invalid_operation
185dqmax194 max  sNaN96 sNaN94  ->  NaN96 Invalid_operation
186dqmax195 max  NaN95  sNaN93  ->  NaN93 Invalid_operation
187dqmax196 max -Inf    sNaN92  ->  NaN92 Invalid_operation
188dqmax197 max  0      sNaN91  ->  NaN91 Invalid_operation
189dqmax198 max  Inf   -sNaN90  -> -NaN90 Invalid_operation
190dqmax199 max  NaN    sNaN89  ->  NaN89 Invalid_operation
191
192-- old rounding checks
193dqmax221 max 12345678000 1  -> 12345678000
194dqmax222 max 1 12345678000  -> 12345678000
195dqmax223 max 1234567800  1  -> 1234567800
196dqmax224 max 1 1234567800   -> 1234567800
197dqmax225 max 1234567890  1  -> 1234567890
198dqmax226 max 1 1234567890   -> 1234567890
199dqmax227 max 1234567891  1  -> 1234567891
200dqmax228 max 1 1234567891   -> 1234567891
201dqmax229 max 12345678901 1  -> 12345678901
202dqmax230 max 1 12345678901  -> 12345678901
203dqmax231 max 1234567896  1  -> 1234567896
204dqmax232 max 1 1234567896   -> 1234567896
205dqmax233 max -1234567891  1 -> 1
206dqmax234 max 1 -1234567891  -> 1
207dqmax235 max -12345678901 1 -> 1
208dqmax236 max 1 -12345678901 -> 1
209dqmax237 max -1234567896  1 -> 1
210dqmax238 max 1 -1234567896  -> 1
211
212-- from examples
213dqmax280 max '3'   '2'  ->  '3'
214dqmax281 max '-10' '3'  ->  '3'
215dqmax282 max '1.0' '1'  ->  '1'
216dqmax283 max '1' '1.0'  ->  '1'
217dqmax284 max '7' 'NaN'  ->  '7'
218
219-- expanded list from min/max 754r purple prose
220-- [explicit tests for exponent ordering]
221dqmax401 max  Inf    1.1     ->  Infinity
222dqmax402 max  1.1    1       ->  1.1
223dqmax403 max  1      1.0     ->  1
224dqmax404 max  1.0    0.1     ->  1.0
225dqmax405 max  0.1    0.10    ->  0.1
226dqmax406 max  0.10   0.100   ->  0.10
227dqmax407 max  0.10   0       ->  0.10
228dqmax408 max  0      0.0     ->  0
229dqmax409 max  0.0   -0       ->  0.0
230dqmax410 max  0.0   -0.0     ->  0.0
231dqmax411 max  0.00  -0.0     ->  0.00
232dqmax412 max  0.0   -0.00    ->  0.0
233dqmax413 max  0     -0.0     ->  0
234dqmax414 max  0     -0       ->  0
235dqmax415 max -0.0   -0       -> -0.0
236dqmax416 max -0     -0.100   -> -0
237dqmax417 max -0.100 -0.10    -> -0.100
238dqmax418 max -0.10  -0.1     -> -0.10
239dqmax419 max -0.1   -1.0     -> -0.1
240dqmax420 max -1.0   -1       -> -1.0
241dqmax421 max -1     -1.1     -> -1
242dqmax423 max -1.1   -Inf     -> -1.1
243-- same with operands reversed
244dqmax431 max  1.1    Inf     ->  Infinity
245dqmax432 max  1      1.1     ->  1.1
246dqmax433 max  1.0    1       ->  1
247dqmax434 max  0.1    1.0     ->  1.0
248dqmax435 max  0.10   0.1     ->  0.1
249dqmax436 max  0.100  0.10    ->  0.10
250dqmax437 max  0      0.10    ->  0.10
251dqmax438 max  0.0    0       ->  0
252dqmax439 max -0      0.0     ->  0.0
253dqmax440 max -0.0    0.0     ->  0.0
254dqmax441 max -0.0    0.00    ->  0.00
255dqmax442 max -0.00   0.0     ->  0.0
256dqmax443 max -0.0    0       ->  0
257dqmax444 max -0      0       ->  0
258dqmax445 max -0     -0.0     -> -0.0
259dqmax446 max -0.100 -0       -> -0
260dqmax447 max -0.10  -0.100   -> -0.100
261dqmax448 max -0.1   -0.10    -> -0.10
262dqmax449 max -1.0   -0.1     -> -0.1
263dqmax450 max -1     -1.0     -> -1.0
264dqmax451 max -1.1   -1       -> -1
265dqmax453 max -Inf   -1.1     -> -1.1
266-- largies
267dqmax460 max  1000   1E+3    ->  1E+3
268dqmax461 max  1E+3   1000    ->  1E+3
269dqmax462 max  1000  -1E+3    ->  1000
270dqmax463 max  1E+3  -1000    ->  1E+3
271dqmax464 max -1000   1E+3    ->  1E+3
272dqmax465 max -1E+3   1000    ->  1000
273dqmax466 max -1000  -1E+3    -> -1000
274dqmax467 max -1E+3  -1000    -> -1000
275
276-- misalignment traps for little-endian
277dqmax471 max      1.0       0.1  -> 1.0
278dqmax472 max      0.1       1.0  -> 1.0
279dqmax473 max     10.0       0.1  -> 10.0
280dqmax474 max      0.1      10.0  -> 10.0
281dqmax475 max      100       1.0  -> 100
282dqmax476 max      1.0       100  -> 100
283dqmax477 max     1000      10.0  -> 1000
284dqmax478 max     10.0      1000  -> 1000
285dqmax479 max    10000     100.0  -> 10000
286dqmax480 max    100.0     10000  -> 10000
287dqmax481 max   100000    1000.0  -> 100000
288dqmax482 max   1000.0    100000  -> 100000
289dqmax483 max  1000000   10000.0  -> 1000000
290dqmax484 max  10000.0   1000000  -> 1000000
291
292-- subnormals
293dqmax510 max  1.00E-6143       0  ->   1.00E-6143
294dqmax511 max  0.1E-6143        0  ->   1E-6144    Subnormal
295dqmax512 max  0.10E-6143       0  ->   1.0E-6144  Subnormal
296dqmax513 max  0.100E-6143      0  ->   1.00E-6144 Subnormal
297dqmax514 max  0.01E-6143       0  ->   1E-6145    Subnormal
298dqmax515 max  0.999E-6143      0  ->   9.99E-6144 Subnormal
299dqmax516 max  0.099E-6143      0  ->   9.9E-6145  Subnormal
300dqmax517 max  0.009E-6143      0  ->   9E-6146    Subnormal
301dqmax518 max  0.001E-6143      0  ->   1E-6146    Subnormal
302dqmax519 max  0.0009E-6143     0  ->   9E-6147    Subnormal
303dqmax520 max  0.0001E-6143     0  ->   1E-6147    Subnormal
304
305dqmax530 max -1.00E-6143       0  ->   0
306dqmax531 max -0.1E-6143        0  ->   0
307dqmax532 max -0.10E-6143       0  ->   0
308dqmax533 max -0.100E-6143      0  ->   0
309dqmax534 max -0.01E-6143       0  ->   0
310dqmax535 max -0.999E-6143      0  ->   0
311dqmax536 max -0.099E-6143      0  ->   0
312dqmax537 max -0.009E-6143      0  ->   0
313dqmax538 max -0.001E-6143      0  ->   0
314dqmax539 max -0.0009E-6143     0  ->   0
315dqmax540 max -0.0001E-6143     0  ->   0
316
317-- Null tests
318dqmax900 max 10  #  -> NaN Invalid_operation
319dqmax901 max  # 10  -> NaN Invalid_operation
320
321
322
323