1------------------------------------------------------------------------
2-- dqMinMag.decTest -- decQuad minnummag                              --
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
32dqmng001 minmag  -2  -2  -> -2
33dqmng002 minmag  -2  -1  -> -1
34dqmng003 minmag  -2   0  ->  0
35dqmng004 minmag  -2   1  ->  1
36dqmng005 minmag  -2   2  -> -2
37dqmng006 minmag  -1  -2  -> -1
38dqmng007 minmag  -1  -1  -> -1
39dqmng008 minmag  -1   0  ->  0
40dqmng009 minmag  -1   1  -> -1
41dqmng010 minmag  -1   2  -> -1
42dqmng011 minmag   0  -2  ->  0
43dqmng012 minmag   0  -1  ->  0
44dqmng013 minmag   0   0  ->  0
45dqmng014 minmag   0   1  ->  0
46dqmng015 minmag   0   2  ->  0
47dqmng016 minmag   1  -2  ->  1
48dqmng017 minmag   1  -1  -> -1
49dqmng018 minmag   1   0  ->  0
50dqmng019 minmag   1   1  ->  1
51dqmng020 minmag   1   2  ->  1
52dqmng021 minmag   2  -2  -> -2
53dqmng022 minmag   2  -1  -> -1
54dqmng023 minmag   2   0  ->  0
55dqmng025 minmag   2   1  ->  1
56dqmng026 minmag   2   2  ->  2
57
58-- extended zeros
59dqmng030 minmag   0     0   ->  0
60dqmng031 minmag   0    -0   -> -0
61dqmng032 minmag   0    -0.0 -> -0.0
62dqmng033 minmag   0     0.0 ->  0.0
63dqmng034 minmag  -0     0   -> -0
64dqmng035 minmag  -0    -0   -> -0
65dqmng036 minmag  -0    -0.0 -> -0
66dqmng037 minmag  -0     0.0 -> -0
67dqmng038 minmag   0.0   0   ->  0.0
68dqmng039 minmag   0.0  -0   -> -0
69dqmng040 minmag   0.0  -0.0 -> -0.0
70dqmng041 minmag   0.0   0.0 ->  0.0
71dqmng042 minmag  -0.0   0   -> -0.0
72dqmng043 minmag  -0.0  -0   -> -0
73dqmng044 minmag  -0.0  -0.0 -> -0.0
74dqmng045 minmag  -0.0   0.0 -> -0.0
75
76dqmng046 minmag   0E1  -0E1 -> -0E+1
77dqmng047 minmag  -0E1   0E2 -> -0E+1
78dqmng048 minmag   0E2   0E1 ->  0E+1
79dqmng049 minmag   0E1   0E2 ->  0E+1
80dqmng050 minmag  -0E3  -0E2 -> -0E+3
81dqmng051 minmag  -0E2  -0E3 -> -0E+3
82
83-- Specials
84dqmng090 minmag  Inf  -Inf   -> -Infinity
85dqmng091 minmag  Inf  -1000  -> -1000
86dqmng092 minmag  Inf  -1     -> -1
87dqmng093 minmag  Inf  -0     -> -0
88dqmng094 minmag  Inf   0     ->  0
89dqmng095 minmag  Inf   1     ->  1
90dqmng096 minmag  Inf   1000  ->  1000
91dqmng097 minmag  Inf   Inf   ->  Infinity
92dqmng098 minmag -1000  Inf   -> -1000
93dqmng099 minmag -Inf   Inf   -> -Infinity
94dqmng100 minmag -1     Inf   -> -1
95dqmng101 minmag -0     Inf   -> -0
96dqmng102 minmag  0     Inf   ->  0
97dqmng103 minmag  1     Inf   ->  1
98dqmng104 minmag  1000  Inf   ->  1000
99dqmng105 minmag  Inf   Inf   ->  Infinity
100
101dqmng120 minmag -Inf  -Inf   -> -Infinity
102dqmng121 minmag -Inf  -1000  -> -1000
103dqmng122 minmag -Inf  -1     -> -1
104dqmng123 minmag -Inf  -0     -> -0
105dqmng124 minmag -Inf   0     ->  0
106dqmng125 minmag -Inf   1     ->  1
107dqmng126 minmag -Inf   1000  ->  1000
108dqmng127 minmag -Inf   Inf   -> -Infinity
109dqmng128 minmag -Inf  -Inf   -> -Infinity
110dqmng129 minmag -1000 -Inf   -> -1000
111dqmng130 minmag -1    -Inf   -> -1
112dqmng131 minmag -0    -Inf   -> -0
113dqmng132 minmag  0    -Inf   ->  0
114dqmng133 minmag  1    -Inf   ->  1
115dqmng134 minmag  1000 -Inf   ->  1000
116dqmng135 minmag  Inf  -Inf   -> -Infinity
117
118-- 2004.08.02 754r chooses number over NaN in mixed cases
119dqmng141 minmag  NaN -Inf    ->  -Infinity
120dqmng142 minmag  NaN -1000   ->  -1000
121dqmng143 minmag  NaN -1      ->  -1
122dqmng144 minmag  NaN -0      ->  -0
123dqmng145 minmag  NaN  0      ->  0
124dqmng146 minmag  NaN  1      ->  1
125dqmng147 minmag  NaN  1000   ->  1000
126dqmng148 minmag  NaN  Inf    ->  Infinity
127dqmng149 minmag  NaN  NaN    ->  NaN
128dqmng150 minmag -Inf  NaN    -> -Infinity
129dqmng151 minmag -1000 NaN    -> -1000
130dqmng152 minmag -1   -NaN    -> -1
131dqmng153 minmag -0    NaN    -> -0
132dqmng154 minmag  0   -NaN    ->  0
133dqmng155 minmag  1    NaN    ->  1
134dqmng156 minmag  1000 NaN    ->  1000
135dqmng157 minmag  Inf  NaN    ->  Infinity
136
137dqmng161 minmag  sNaN -Inf   ->  NaN  Invalid_operation
138dqmng162 minmag  sNaN -1000  ->  NaN  Invalid_operation
139dqmng163 minmag  sNaN -1     ->  NaN  Invalid_operation
140dqmng164 minmag  sNaN -0     ->  NaN  Invalid_operation
141dqmng165 minmag -sNaN  0     -> -NaN  Invalid_operation
142dqmng166 minmag -sNaN  1     -> -NaN  Invalid_operation
143dqmng167 minmag  sNaN  1000  ->  NaN  Invalid_operation
144dqmng168 minmag  sNaN  NaN   ->  NaN  Invalid_operation
145dqmng169 minmag  sNaN sNaN   ->  NaN  Invalid_operation
146dqmng170 minmag  NaN  sNaN   ->  NaN  Invalid_operation
147dqmng171 minmag -Inf  sNaN   ->  NaN  Invalid_operation
148dqmng172 minmag -1000 sNaN   ->  NaN  Invalid_operation
149dqmng173 minmag -1    sNaN   ->  NaN  Invalid_operation
150dqmng174 minmag -0    sNaN   ->  NaN  Invalid_operation
151dqmng175 minmag  0    sNaN   ->  NaN  Invalid_operation
152dqmng176 minmag  1    sNaN   ->  NaN  Invalid_operation
153dqmng177 minmag  1000 sNaN   ->  NaN  Invalid_operation
154dqmng178 minmag  Inf  sNaN   ->  NaN  Invalid_operation
155dqmng179 minmag  NaN  sNaN   ->  NaN  Invalid_operation
156
157-- propagating NaNs
158dqmng181 minmag  NaN9   -Inf   -> -Infinity
159dqmng182 minmag -NaN8    9990  ->  9990
160dqmng183 minmag  NaN71   Inf   ->  Infinity
161
162dqmng184 minmag  NaN1    NaN54 ->  NaN1
163dqmng185 minmag  NaN22  -NaN53 ->  NaN22
164dqmng186 minmag -NaN3    NaN6  -> -NaN3
165dqmng187 minmag -NaN44   NaN7  -> -NaN44
166
167dqmng188 minmag -Inf     NaN41 -> -Infinity
168dqmng189 minmag -9999   -NaN33 -> -9999
169dqmng190 minmag  Inf     NaN2  ->  Infinity
170
171dqmng191 minmag  sNaN99 -Inf    ->  NaN99 Invalid_operation
172dqmng192 minmag  sNaN98 -11     ->  NaN98 Invalid_operation
173dqmng193 minmag -sNaN97  NaN8   -> -NaN97 Invalid_operation
174dqmng194 minmag  sNaN69 sNaN94  ->  NaN69 Invalid_operation
175dqmng195 minmag  NaN95  sNaN93  ->  NaN93 Invalid_operation
176dqmng196 minmag -Inf    sNaN92  ->  NaN92 Invalid_operation
177dqmng197 minmag  088    sNaN91  ->  NaN91 Invalid_operation
178dqmng198 minmag  Inf   -sNaN90  -> -NaN90 Invalid_operation
179dqmng199 minmag  NaN    sNaN86  ->  NaN86 Invalid_operation
180
181-- old rounding checks
182dqmng221 minmag -12345678000 1  -> 1
183dqmng222 minmag 1 -12345678000  -> 1
184dqmng223 minmag -1234567800  1  -> 1
185dqmng224 minmag 1 -1234567800   -> 1
186dqmng225 minmag -1234567890  1  -> 1
187dqmng226 minmag 1 -1234567890   -> 1
188dqmng227 minmag -1234567891  1  -> 1
189dqmng228 minmag 1 -1234567891   -> 1
190dqmng229 minmag -12345678901 1  -> 1
191dqmng230 minmag 1 -12345678901  -> 1
192dqmng231 minmag -1234567896  1  -> 1
193dqmng232 minmag 1 -1234567896   -> 1
194dqmng233 minmag 1234567891  1   -> 1
195dqmng234 minmag 1 1234567891    -> 1
196dqmng235 minmag 12345678901 1   -> 1
197dqmng236 minmag 1 12345678901   -> 1
198dqmng237 minmag 1234567896  1   -> 1
199dqmng238 minmag 1 1234567896    -> 1
200
201-- from examples
202dqmng280 minmag '3'   '2'  ->  '2'
203dqmng281 minmag '-10' '3'  ->  '3'
204dqmng282 minmag '1.0' '1'  ->  '1.0'
205dqmng283 minmag '1' '1.0'  ->  '1.0'
206dqmng284 minmag '7' 'NaN'  ->  '7'
207
208-- expanded list from min/max 754r purple prose
209-- [explicit tests for exponent ordering]
210dqmng401 minmag  Inf    1.1     ->  1.1
211dqmng402 minmag  1.1    1       ->  1
212dqmng403 minmag  1      1.0     ->  1.0
213dqmng404 minmag  1.0    0.1     ->  0.1
214dqmng405 minmag  0.1    0.10    ->  0.10
215dqmng406 minmag  0.10   0.100   ->  0.100
216dqmng407 minmag  0.10   0       ->  0
217dqmng408 minmag  0      0.0     ->  0.0
218dqmng409 minmag  0.0   -0       -> -0
219dqmng410 minmag  0.0   -0.0     -> -0.0
220dqmng411 minmag  0.00  -0.0     -> -0.0
221dqmng412 minmag  0.0   -0.00    -> -0.00
222dqmng413 minmag  0     -0.0     -> -0.0
223dqmng414 minmag  0     -0       -> -0
224dqmng415 minmag -0.0   -0       -> -0
225dqmng416 minmag -0     -0.100   -> -0
226dqmng417 minmag -0.100 -0.10    -> -0.10
227dqmng418 minmag -0.10  -0.1     -> -0.1
228dqmng419 minmag -0.1   -1.0     -> -0.1
229dqmng420 minmag -1.0   -1       -> -1
230dqmng421 minmag -1     -1.1     -> -1
231dqmng423 minmag -1.1   -Inf     -> -1.1
232-- same with operands reversed
233dqmng431 minmag  1.1    Inf     ->  1.1
234dqmng432 minmag  1      1.1     ->  1
235dqmng433 minmag  1.0    1       ->  1.0
236dqmng434 minmag  0.1    1.0     ->  0.1
237dqmng435 minmag  0.10   0.1     ->  0.10
238dqmng436 minmag  0.100  0.10    ->  0.100
239dqmng437 minmag  0      0.10    ->  0
240dqmng438 minmag  0.0    0       ->  0.0
241dqmng439 minmag -0      0.0     -> -0
242dqmng440 minmag -0.0    0.0     -> -0.0
243dqmng441 minmag -0.0    0.00    -> -0.0
244dqmng442 minmag -0.00   0.0     -> -0.00
245dqmng443 minmag -0.0    0       -> -0.0
246dqmng444 minmag -0      0       -> -0
247dqmng445 minmag -0     -0.0     -> -0
248dqmng446 minmag -0.100 -0       -> -0
249dqmng447 minmag -0.10  -0.100   -> -0.10
250dqmng448 minmag -0.1   -0.10    -> -0.1
251dqmng449 minmag -1.0   -0.1     -> -0.1
252dqmng450 minmag -1     -1.0     -> -1
253dqmng451 minmag -1.1   -1       -> -1
254dqmng453 minmag -Inf   -1.1     -> -1.1
255-- largies
256dqmng460 minmag  1000   1E+3    ->  1000
257dqmng461 minmag  1E+3   1000    ->  1000
258dqmng462 minmag  1000  -1E+3    -> -1E+3
259dqmng463 minmag  1E+3   -384    -> -384
260dqmng464 minmag -384    1E+3    -> -384
261dqmng465 minmag -1E+3   1000    -> -1E+3
262dqmng466 minmag -384   -1E+3    -> -384
263dqmng467 minmag -1E+3   -384    -> -384
264
265-- subnormals
266dqmng510 minmag  1.00E-6143       0  ->   0
267dqmng511 minmag  0.1E-6143        0  ->   0
268dqmng512 minmag  0.10E-6143       0  ->   0
269dqmng513 minmag  0.100E-6143      0  ->   0
270dqmng514 minmag  0.01E-6143       0  ->   0
271dqmng515 minmag  0.999E-6143      0  ->   0
272dqmng516 minmag  0.099E-6143      0  ->   0
273dqmng517 minmag  0.009E-6143      0  ->   0
274dqmng518 minmag  0.001E-6143      0  ->   0
275dqmng519 minmag  0.0009E-6143     0  ->   0
276dqmng520 minmag  0.0001E-6143     0  ->   0
277
278dqmng530 minmag -1.00E-6143       0  ->   0
279dqmng531 minmag -0.1E-6143        0  ->   0
280dqmng532 minmag -0.10E-6143       0  ->   0
281dqmng533 minmag -0.100E-6143      0  ->   0
282dqmng534 minmag -0.01E-6143       0  ->   0
283dqmng535 minmag -0.999E-6143      0  ->   0
284dqmng536 minmag -0.099E-6143      0  ->   0
285dqmng537 minmag -0.009E-6143      0  ->   0
286dqmng538 minmag -0.001E-6143      0  ->   0
287dqmng539 minmag -0.0009E-6143     0  ->   0
288dqmng540 minmag -0.0001E-6143     0  ->   0
289
290
291-- Null tests
292dqmng900 minmag 10  # -> NaN Invalid_operation
293dqmng901 minmag  # 10 -> NaN Invalid_operation
294