1------------------------------------------------------------------------
2-- dqMaxMag.decTest -- decQuad maxnummag                              --
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
32dqmxg001 maxmag  -2  -2  -> -2
33dqmxg002 maxmag  -2  -1  -> -2
34dqmxg003 maxmag  -2   0  -> -2
35dqmxg004 maxmag  -2   1  -> -2
36dqmxg005 maxmag  -2   2  ->  2
37dqmxg006 maxmag  -1  -2  -> -2
38dqmxg007 maxmag  -1  -1  -> -1
39dqmxg008 maxmag  -1   0  -> -1
40dqmxg009 maxmag  -1   1  ->  1
41dqmxg010 maxmag  -1   2  ->  2
42dqmxg011 maxmag   0  -2  -> -2
43dqmxg012 maxmag   0  -1  -> -1
44dqmxg013 maxmag   0   0  ->  0
45dqmxg014 maxmag   0   1  ->  1
46dqmxg015 maxmag   0   2  ->  2
47dqmxg016 maxmag   1  -2  -> -2
48dqmxg017 maxmag   1  -1  ->  1
49dqmxg018 maxmag   1   0  ->  1
50dqmxg019 maxmag   1   1  ->  1
51dqmxg020 maxmag   1   2  ->  2
52dqmxg021 maxmag   2  -2  ->  2
53dqmxg022 maxmag   2  -1  ->  2
54dqmxg023 maxmag   2   0  ->  2
55dqmxg025 maxmag   2   1  ->  2
56dqmxg026 maxmag   2   2  ->  2
57
58-- extended zeros
59dqmxg030 maxmag   0     0   ->  0
60dqmxg031 maxmag   0    -0   ->  0
61dqmxg032 maxmag   0    -0.0 ->  0
62dqmxg033 maxmag   0     0.0 ->  0
63dqmxg034 maxmag  -0     0   ->  0    -- note: -0 = 0, but 0 chosen
64dqmxg035 maxmag  -0    -0   -> -0
65dqmxg036 maxmag  -0    -0.0 -> -0.0
66dqmxg037 maxmag  -0     0.0 ->  0.0
67dqmxg038 maxmag   0.0   0   ->  0
68dqmxg039 maxmag   0.0  -0   ->  0.0
69dqmxg040 maxmag   0.0  -0.0 ->  0.0
70dqmxg041 maxmag   0.0   0.0 ->  0.0
71dqmxg042 maxmag  -0.0   0   ->  0
72dqmxg043 maxmag  -0.0  -0   -> -0.0
73dqmxg044 maxmag  -0.0  -0.0 -> -0.0
74dqmxg045 maxmag  -0.0   0.0 ->  0.0
75
76dqmxg050 maxmag  -0E1   0E1 ->  0E+1
77dqmxg051 maxmag  -0E2   0E2 ->  0E+2
78dqmxg052 maxmag  -0E2   0E1 ->  0E+1
79dqmxg053 maxmag  -0E1   0E2 ->  0E+2
80dqmxg054 maxmag   0E1  -0E1 ->  0E+1
81dqmxg055 maxmag   0E2  -0E2 ->  0E+2
82dqmxg056 maxmag   0E2  -0E1 ->  0E+2
83dqmxg057 maxmag   0E1  -0E2 ->  0E+1
84
85dqmxg058 maxmag   0E1   0E1 ->  0E+1
86dqmxg059 maxmag   0E2   0E2 ->  0E+2
87dqmxg060 maxmag   0E2   0E1 ->  0E+2
88dqmxg061 maxmag   0E1   0E2 ->  0E+2
89dqmxg062 maxmag  -0E1  -0E1 -> -0E+1
90dqmxg063 maxmag  -0E2  -0E2 -> -0E+2
91dqmxg064 maxmag  -0E2  -0E1 -> -0E+1
92dqmxg065 maxmag  -0E1  -0E2 -> -0E+1
93
94-- Specials
95dqmxg090 maxmag  Inf  -Inf   ->  Infinity
96dqmxg091 maxmag  Inf  -1000  ->  Infinity
97dqmxg092 maxmag  Inf  -1     ->  Infinity
98dqmxg093 maxmag  Inf  -0     ->  Infinity
99dqmxg094 maxmag  Inf   0     ->  Infinity
100dqmxg095 maxmag  Inf   1     ->  Infinity
101dqmxg096 maxmag  Inf   1000  ->  Infinity
102dqmxg097 maxmag  Inf   Inf   ->  Infinity
103dqmxg098 maxmag -1000  Inf   ->  Infinity
104dqmxg099 maxmag -Inf   Inf   ->  Infinity
105dqmxg100 maxmag -1     Inf   ->  Infinity
106dqmxg101 maxmag -0     Inf   ->  Infinity
107dqmxg102 maxmag  0     Inf   ->  Infinity
108dqmxg103 maxmag  1     Inf   ->  Infinity
109dqmxg104 maxmag  1000  Inf   ->  Infinity
110dqmxg105 maxmag  Inf   Inf   ->  Infinity
111
112dqmxg120 maxmag -Inf  -Inf   -> -Infinity
113dqmxg121 maxmag -Inf  -1000  -> -Infinity
114dqmxg122 maxmag -Inf  -1     -> -Infinity
115dqmxg123 maxmag -Inf  -0     -> -Infinity
116dqmxg124 maxmag -Inf   0     -> -Infinity
117dqmxg125 maxmag -Inf   1     -> -Infinity
118dqmxg126 maxmag -Inf   1000  -> -Infinity
119dqmxg127 maxmag -Inf   Inf   ->  Infinity
120dqmxg128 maxmag -Inf  -Inf   ->  -Infinity
121dqmxg129 maxmag -1000 -Inf   -> -Infinity
122dqmxg130 maxmag -1    -Inf   -> -Infinity
123dqmxg131 maxmag -0    -Inf   -> -Infinity
124dqmxg132 maxmag  0    -Inf   -> -Infinity
125dqmxg133 maxmag  1    -Inf   -> -Infinity
126dqmxg134 maxmag  1000 -Inf   -> -Infinity
127dqmxg135 maxmag  Inf  -Inf   ->  Infinity
128
129-- 2004.08.02 754r chooses number over NaN in mixed cases
130dqmxg141 maxmag  NaN -Inf    -> -Infinity
131dqmxg142 maxmag  NaN -1000   -> -1000
132dqmxg143 maxmag  NaN -1      -> -1
133dqmxg144 maxmag  NaN -0      -> -0
134dqmxg145 maxmag  NaN  0      ->  0
135dqmxg146 maxmag  NaN  1      ->  1
136dqmxg147 maxmag  NaN  1000   ->  1000
137dqmxg148 maxmag  NaN  Inf    ->  Infinity
138dqmxg149 maxmag  NaN  NaN    ->  NaN
139dqmxg150 maxmag -Inf  NaN    -> -Infinity
140dqmxg151 maxmag -1000 NaN    -> -1000
141dqmxg152 maxmag -1    NaN    -> -1
142dqmxg153 maxmag -0    NaN    -> -0
143dqmxg154 maxmag  0    NaN    ->  0
144dqmxg155 maxmag  1    NaN    ->  1
145dqmxg156 maxmag  1000 NaN    ->  1000
146dqmxg157 maxmag  Inf  NaN    ->  Infinity
147
148dqmxg161 maxmag  sNaN -Inf   ->  NaN  Invalid_operation
149dqmxg162 maxmag  sNaN -1000  ->  NaN  Invalid_operation
150dqmxg163 maxmag  sNaN -1     ->  NaN  Invalid_operation
151dqmxg164 maxmag  sNaN -0     ->  NaN  Invalid_operation
152dqmxg165 maxmag  sNaN  0     ->  NaN  Invalid_operation
153dqmxg166 maxmag  sNaN  1     ->  NaN  Invalid_operation
154dqmxg167 maxmag  sNaN  1000  ->  NaN  Invalid_operation
155dqmxg168 maxmag  sNaN  NaN   ->  NaN  Invalid_operation
156dqmxg169 maxmag  sNaN sNaN   ->  NaN  Invalid_operation
157dqmxg170 maxmag  NaN  sNaN   ->  NaN  Invalid_operation
158dqmxg171 maxmag -Inf  sNaN   ->  NaN  Invalid_operation
159dqmxg172 maxmag -1000 sNaN   ->  NaN  Invalid_operation
160dqmxg173 maxmag -1    sNaN   ->  NaN  Invalid_operation
161dqmxg174 maxmag -0    sNaN   ->  NaN  Invalid_operation
162dqmxg175 maxmag  0    sNaN   ->  NaN  Invalid_operation
163dqmxg176 maxmag  1    sNaN   ->  NaN  Invalid_operation
164dqmxg177 maxmag  1000 sNaN   ->  NaN  Invalid_operation
165dqmxg178 maxmag  Inf  sNaN   ->  NaN  Invalid_operation
166dqmxg179 maxmag  NaN  sNaN   ->  NaN  Invalid_operation
167
168-- propagating NaNs
169dqmxg181 maxmag  NaN9  -Inf   -> -Infinity
170dqmxg182 maxmag  NaN8     9   ->  9
171dqmxg183 maxmag -NaN7   Inf   ->  Infinity
172
173dqmxg184 maxmag -NaN1   NaN11 -> -NaN1
174dqmxg185 maxmag  NaN2   NaN12 ->  NaN2
175dqmxg186 maxmag -NaN13 -NaN7  -> -NaN13
176dqmxg187 maxmag  NaN14 -NaN5  ->  NaN14
177
178dqmxg188 maxmag -Inf    NaN4  -> -Infinity
179dqmxg189 maxmag -9     -NaN3  -> -9
180dqmxg190 maxmag  Inf    NaN2  ->  Infinity
181
182dqmxg191 maxmag  sNaN99 -Inf    ->  NaN99 Invalid_operation
183dqmxg192 maxmag  sNaN98 -1      ->  NaN98 Invalid_operation
184dqmxg193 maxmag -sNaN97  NaN    -> -NaN97 Invalid_operation
185dqmxg194 maxmag  sNaN96 sNaN94  ->  NaN96 Invalid_operation
186dqmxg195 maxmag  NaN95  sNaN93  ->  NaN93 Invalid_operation
187dqmxg196 maxmag -Inf    sNaN92  ->  NaN92 Invalid_operation
188dqmxg197 maxmag  0      sNaN91  ->  NaN91 Invalid_operation
189dqmxg198 maxmag  Inf   -sNaN90  -> -NaN90 Invalid_operation
190dqmxg199 maxmag  NaN    sNaN89  ->  NaN89 Invalid_operation
191
192-- old rounding checks
193dqmxg221 maxmag 12345678000 1  -> 12345678000
194dqmxg222 maxmag 1 12345678000  -> 12345678000
195dqmxg223 maxmag 1234567800  1  -> 1234567800
196dqmxg224 maxmag 1 1234567800   -> 1234567800
197dqmxg225 maxmag 1234567890  1  -> 1234567890
198dqmxg226 maxmag 1 1234567890   -> 1234567890
199dqmxg227 maxmag 1234567891  1  -> 1234567891
200dqmxg228 maxmag 1 1234567891   -> 1234567891
201dqmxg229 maxmag 12345678901 1  -> 12345678901
202dqmxg230 maxmag 1 12345678901  -> 12345678901
203dqmxg231 maxmag 1234567896  1  -> 1234567896
204dqmxg232 maxmag 1 1234567896   -> 1234567896
205dqmxg233 maxmag -1234567891  1 -> -1234567891
206dqmxg234 maxmag 1 -1234567891  -> -1234567891
207dqmxg235 maxmag -12345678901 1 -> -12345678901
208dqmxg236 maxmag 1 -12345678901 -> -12345678901
209dqmxg237 maxmag -1234567896  1 -> -1234567896
210dqmxg238 maxmag 1 -1234567896  -> -1234567896
211
212-- from examples
213dqmxg280 maxmag '3'   '2'  ->  '3'
214dqmxg281 maxmag '-10' '3'  ->  '-10'
215dqmxg282 maxmag '1.0' '1'  ->  '1'
216dqmxg283 maxmag '1' '1.0'  ->  '1'
217dqmxg284 maxmag '7' 'NaN'  ->  '7'
218
219-- expanded list from min/max 754r purple prose
220-- [explicit tests for exponent ordering]
221dqmxg401 maxmag  Inf    1.1     ->  Infinity
222dqmxg402 maxmag  1.1    1       ->  1.1
223dqmxg403 maxmag  1      1.0     ->  1
224dqmxg404 maxmag  1.0    0.1     ->  1.0
225dqmxg405 maxmag  0.1    0.10    ->  0.1
226dqmxg406 maxmag  0.10   0.100   ->  0.10
227dqmxg407 maxmag  0.10   0       ->  0.10
228dqmxg408 maxmag  0      0.0     ->  0
229dqmxg409 maxmag  0.0   -0       ->  0.0
230dqmxg410 maxmag  0.0   -0.0     ->  0.0
231dqmxg411 maxmag  0.00  -0.0     ->  0.00
232dqmxg412 maxmag  0.0   -0.00    ->  0.0
233dqmxg413 maxmag  0     -0.0     ->  0
234dqmxg414 maxmag  0     -0       ->  0
235dqmxg415 maxmag -0.0   -0       -> -0.0
236dqmxg416 maxmag -0     -0.100   -> -0.100
237dqmxg417 maxmag -0.100 -0.10    -> -0.100
238dqmxg418 maxmag -0.10  -0.1     -> -0.10
239dqmxg419 maxmag -0.1   -1.0     -> -1.0
240dqmxg420 maxmag -1.0   -1       -> -1.0
241dqmxg421 maxmag -1     -1.1     -> -1.1
242dqmxg423 maxmag -1.1   -Inf     -> -Infinity
243-- same with operands reversed
244dqmxg431 maxmag  1.1    Inf     ->  Infinity
245dqmxg432 maxmag  1      1.1     ->  1.1
246dqmxg433 maxmag  1.0    1       ->  1
247dqmxg434 maxmag  0.1    1.0     ->  1.0
248dqmxg435 maxmag  0.10   0.1     ->  0.1
249dqmxg436 maxmag  0.100  0.10    ->  0.10
250dqmxg437 maxmag  0      0.10    ->  0.10
251dqmxg438 maxmag  0.0    0       ->  0
252dqmxg439 maxmag -0      0.0     ->  0.0
253dqmxg440 maxmag -0.0    0.0     ->  0.0
254dqmxg441 maxmag -0.0    0.00    ->  0.00
255dqmxg442 maxmag -0.00   0.0     ->  0.0
256dqmxg443 maxmag -0.0    0       ->  0
257dqmxg444 maxmag -0      0       ->  0
258dqmxg445 maxmag -0     -0.0     -> -0.0
259dqmxg446 maxmag -0.100 -0       -> -0.100
260dqmxg447 maxmag -0.10  -0.100   -> -0.100
261dqmxg448 maxmag -0.1   -0.10    -> -0.10
262dqmxg449 maxmag -1.0   -0.1     -> -1.0
263dqmxg450 maxmag -1     -1.0     -> -1.0
264dqmxg451 maxmag -1.1   -1       -> -1.1
265dqmxg453 maxmag -Inf   -1.1     -> -Infinity
266-- largies
267dqmxg460 maxmag  1000   1E+3    ->  1E+3
268dqmxg461 maxmag  1E+3   1000    ->  1E+3
269dqmxg462 maxmag  1000  -1E+3    ->  1000
270dqmxg463 maxmag  1E+3  -1000    ->  1E+3
271dqmxg464 maxmag -1000   1E+3    ->  1E+3
272dqmxg465 maxmag -1E+3   1000    ->  1000
273dqmxg466 maxmag -1000  -1E+3    -> -1000
274dqmxg467 maxmag -1E+3  -1000    -> -1000
275
276-- subnormals
277dqmxg510 maxmag  1.00E-6143       0  ->   1.00E-6143
278dqmxg511 maxmag  0.1E-6143        0  ->   1E-6144    Subnormal
279dqmxg512 maxmag  0.10E-6143       0  ->   1.0E-6144  Subnormal
280dqmxg513 maxmag  0.100E-6143      0  ->   1.00E-6144 Subnormal
281dqmxg514 maxmag  0.01E-6143       0  ->   1E-6145    Subnormal
282dqmxg515 maxmag  0.999E-6143      0  ->   9.99E-6144 Subnormal
283dqmxg516 maxmag  0.099E-6143      0  ->   9.9E-6145  Subnormal
284dqmxg517 maxmag  0.009E-6143      0  ->   9E-6146    Subnormal
285dqmxg518 maxmag  0.001E-6143      0  ->   1E-6146    Subnormal
286dqmxg519 maxmag  0.0009E-6143     0  ->   9E-6147    Subnormal
287dqmxg520 maxmag  0.0001E-6143     0  ->   1E-6147    Subnormal
288
289dqmxg530 maxmag -1.00E-6143       0  ->  -1.00E-6143
290dqmxg531 maxmag -0.1E-6143        0  ->  -1E-6144    Subnormal
291dqmxg532 maxmag -0.10E-6143       0  ->  -1.0E-6144  Subnormal
292dqmxg533 maxmag -0.100E-6143      0  ->  -1.00E-6144 Subnormal
293dqmxg534 maxmag -0.01E-6143       0  ->  -1E-6145    Subnormal
294dqmxg535 maxmag -0.999E-6143      0  ->  -9.99E-6144 Subnormal
295dqmxg536 maxmag -0.099E-6143      0  ->  -9.9E-6145  Subnormal
296dqmxg537 maxmag -0.009E-6143      0  ->  -9E-6146    Subnormal
297dqmxg538 maxmag -0.001E-6143      0  ->  -1E-6146    Subnormal
298dqmxg539 maxmag -0.0009E-6143     0  ->  -9E-6147    Subnormal
299dqmxg540 maxmag -0.0001E-6143     0  ->  -1E-6147    Subnormal
300
301-- Null tests
302dqmxg900 maxmag 10  #  -> NaN Invalid_operation
303dqmxg901 maxmag  # 10  -> NaN Invalid_operation
304
305