1------------------------------------------------------------------------
2-- dqMin.decTest -- decQuad minnum                                    --
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
32dqmin001 min  -2  -2  -> -2
33dqmin002 min  -2  -1  -> -2
34dqmin003 min  -2   0  -> -2
35dqmin004 min  -2   1  -> -2
36dqmin005 min  -2   2  -> -2
37dqmin006 min  -1  -2  -> -2
38dqmin007 min  -1  -1  -> -1
39dqmin008 min  -1   0  -> -1
40dqmin009 min  -1   1  -> -1
41dqmin010 min  -1   2  -> -1
42dqmin011 min   0  -2  -> -2
43dqmin012 min   0  -1  -> -1
44dqmin013 min   0   0  ->  0
45dqmin014 min   0   1  ->  0
46dqmin015 min   0   2  ->  0
47dqmin016 min   1  -2  -> -2
48dqmin017 min   1  -1  -> -1
49dqmin018 min   1   0  ->  0
50dqmin019 min   1   1  ->  1
51dqmin020 min   1   2  ->  1
52dqmin021 min   2  -2  -> -2
53dqmin022 min   2  -1  -> -1
54dqmin023 min   2   0  ->  0
55dqmin025 min   2   1  ->  1
56dqmin026 min   2   2  ->  2
57
58-- extended zeros
59dqmin030 min   0     0   ->  0
60dqmin031 min   0    -0   -> -0
61dqmin032 min   0    -0.0 -> -0.0
62dqmin033 min   0     0.0 ->  0.0
63dqmin034 min  -0     0   -> -0
64dqmin035 min  -0    -0   -> -0
65dqmin036 min  -0    -0.0 -> -0
66dqmin037 min  -0     0.0 -> -0
67dqmin038 min   0.0   0   ->  0.0
68dqmin039 min   0.0  -0   -> -0
69dqmin040 min   0.0  -0.0 -> -0.0
70dqmin041 min   0.0   0.0 ->  0.0
71dqmin042 min  -0.0   0   -> -0.0
72dqmin043 min  -0.0  -0   -> -0
73dqmin044 min  -0.0  -0.0 -> -0.0
74dqmin045 min  -0.0   0.0 -> -0.0
75
76dqmin046 min   0E1  -0E1 -> -0E+1
77dqmin047 min  -0E1   0E2 -> -0E+1
78dqmin048 min   0E2   0E1 ->  0E+1
79dqmin049 min   0E1   0E2 ->  0E+1
80dqmin050 min  -0E3  -0E2 -> -0E+3
81dqmin051 min  -0E2  -0E3 -> -0E+3
82
83-- Specials
84dqmin090 min  Inf  -Inf   -> -Infinity
85dqmin091 min  Inf  -1000  -> -1000
86dqmin092 min  Inf  -1     -> -1
87dqmin093 min  Inf  -0     -> -0
88dqmin094 min  Inf   0     ->  0
89dqmin095 min  Inf   1     ->  1
90dqmin096 min  Inf   1000  ->  1000
91dqmin097 min  Inf   Inf   ->  Infinity
92dqmin098 min -1000  Inf   -> -1000
93dqmin099 min -Inf   Inf   -> -Infinity
94dqmin100 min -1     Inf   -> -1
95dqmin101 min -0     Inf   -> -0
96dqmin102 min  0     Inf   ->  0
97dqmin103 min  1     Inf   ->  1
98dqmin104 min  1000  Inf   ->  1000
99dqmin105 min  Inf   Inf   ->  Infinity
100
101dqmin120 min -Inf  -Inf   -> -Infinity
102dqmin121 min -Inf  -1000  -> -Infinity
103dqmin122 min -Inf  -1     -> -Infinity
104dqmin123 min -Inf  -0     -> -Infinity
105dqmin124 min -Inf   0     -> -Infinity
106dqmin125 min -Inf   1     -> -Infinity
107dqmin126 min -Inf   1000  -> -Infinity
108dqmin127 min -Inf   Inf   -> -Infinity
109dqmin128 min -Inf  -Inf   -> -Infinity
110dqmin129 min -1000 -Inf   -> -Infinity
111dqmin130 min -1    -Inf   -> -Infinity
112dqmin131 min -0    -Inf   -> -Infinity
113dqmin132 min  0    -Inf   -> -Infinity
114dqmin133 min  1    -Inf   -> -Infinity
115dqmin134 min  1000 -Inf   -> -Infinity
116dqmin135 min  Inf  -Inf   -> -Infinity
117
118-- 2004.08.02 754r chooses number over NaN in mixed cases
119dqmin141 min  NaN -Inf    ->  -Infinity
120dqmin142 min  NaN -1000   ->  -1000
121dqmin143 min  NaN -1      ->  -1
122dqmin144 min  NaN -0      ->  -0
123dqmin145 min  NaN  0      ->  0
124dqmin146 min  NaN  1      ->  1
125dqmin147 min  NaN  1000   ->  1000
126dqmin148 min  NaN  Inf    ->  Infinity
127dqmin149 min  NaN  NaN    ->  NaN
128dqmin150 min -Inf  NaN    -> -Infinity
129dqmin151 min -1000 NaN    -> -1000
130dqmin152 min -1   -NaN    -> -1
131dqmin153 min -0    NaN    -> -0
132dqmin154 min  0   -NaN    ->  0
133dqmin155 min  1    NaN    ->  1
134dqmin156 min  1000 NaN    ->  1000
135dqmin157 min  Inf  NaN    ->  Infinity
136
137dqmin161 min  sNaN -Inf   ->  NaN  Invalid_operation
138dqmin162 min  sNaN -1000  ->  NaN  Invalid_operation
139dqmin163 min  sNaN -1     ->  NaN  Invalid_operation
140dqmin164 min  sNaN -0     ->  NaN  Invalid_operation
141dqmin165 min -sNaN  0     -> -NaN  Invalid_operation
142dqmin166 min -sNaN  1     -> -NaN  Invalid_operation
143dqmin167 min  sNaN  1000  ->  NaN  Invalid_operation
144dqmin168 min  sNaN  NaN   ->  NaN  Invalid_operation
145dqmin169 min  sNaN sNaN   ->  NaN  Invalid_operation
146dqmin170 min  NaN  sNaN   ->  NaN  Invalid_operation
147dqmin171 min -Inf  sNaN   ->  NaN  Invalid_operation
148dqmin172 min -1000 sNaN   ->  NaN  Invalid_operation
149dqmin173 min -1    sNaN   ->  NaN  Invalid_operation
150dqmin174 min -0    sNaN   ->  NaN  Invalid_operation
151dqmin175 min  0    sNaN   ->  NaN  Invalid_operation
152dqmin176 min  1    sNaN   ->  NaN  Invalid_operation
153dqmin177 min  1000 sNaN   ->  NaN  Invalid_operation
154dqmin178 min  Inf  sNaN   ->  NaN  Invalid_operation
155dqmin179 min  NaN  sNaN   ->  NaN  Invalid_operation
156
157-- propagating NaNs
158dqmin181 min  NaN9   -Inf   -> -Infinity
159dqmin182 min -NaN8    9990  ->  9990
160dqmin183 min  NaN71   Inf   ->  Infinity
161
162dqmin184 min  NaN1    NaN54 ->  NaN1
163dqmin185 min  NaN22  -NaN53 ->  NaN22
164dqmin186 min -NaN3    NaN6  -> -NaN3
165dqmin187 min -NaN44   NaN7  -> -NaN44
166
167dqmin188 min -Inf     NaN41 -> -Infinity
168dqmin189 min -9999   -NaN33 -> -9999
169dqmin190 min  Inf     NaN2  ->  Infinity
170
171dqmin191 min  sNaN99 -Inf    ->  NaN99 Invalid_operation
172dqmin192 min  sNaN98 -11     ->  NaN98 Invalid_operation
173dqmin193 min -sNaN97  NaN8   -> -NaN97 Invalid_operation
174dqmin194 min  sNaN69 sNaN94  ->  NaN69 Invalid_operation
175dqmin195 min  NaN95  sNaN93  ->  NaN93 Invalid_operation
176dqmin196 min -Inf    sNaN92  ->  NaN92 Invalid_operation
177dqmin197 min  088    sNaN91  ->  NaN91 Invalid_operation
178dqmin198 min  Inf   -sNaN90  -> -NaN90 Invalid_operation
179dqmin199 min  NaN    sNaN86  ->  NaN86 Invalid_operation
180
181-- old rounding checks
182dqmin221 min -12345678000 1  -> -12345678000
183dqmin222 min 1 -12345678000  -> -12345678000
184dqmin223 min -1234567800  1  -> -1234567800
185dqmin224 min 1 -1234567800   -> -1234567800
186dqmin225 min -1234567890  1  -> -1234567890
187dqmin226 min 1 -1234567890   -> -1234567890
188dqmin227 min -1234567891  1  -> -1234567891
189dqmin228 min 1 -1234567891   -> -1234567891
190dqmin229 min -12345678901 1  -> -12345678901
191dqmin230 min 1 -12345678901  -> -12345678901
192dqmin231 min -1234567896  1  -> -1234567896
193dqmin232 min 1 -1234567896   -> -1234567896
194dqmin233 min 1234567891  1   -> 1
195dqmin234 min 1 1234567891    -> 1
196dqmin235 min 12345678901 1   -> 1
197dqmin236 min 1 12345678901   -> 1
198dqmin237 min 1234567896  1   -> 1
199dqmin238 min 1 1234567896    -> 1
200
201-- from examples
202dqmin280 min '3'   '2'  ->  '2'
203dqmin281 min '-10' '3'  ->  '-10'
204dqmin282 min '1.0' '1'  ->  '1.0'
205dqmin283 min '1' '1.0'  ->  '1.0'
206dqmin284 min '7' 'NaN'  ->  '7'
207
208-- expanded list from min/max 754r purple prose
209-- [explicit tests for exponent ordering]
210dqmin401 min  Inf    1.1     ->  1.1
211dqmin402 min  1.1    1       ->  1
212dqmin403 min  1      1.0     ->  1.0
213dqmin404 min  1.0    0.1     ->  0.1
214dqmin405 min  0.1    0.10    ->  0.10
215dqmin406 min  0.10   0.100   ->  0.100
216dqmin407 min  0.10   0       ->  0
217dqmin408 min  0      0.0     ->  0.0
218dqmin409 min  0.0   -0       -> -0
219dqmin410 min  0.0   -0.0     -> -0.0
220dqmin411 min  0.00  -0.0     -> -0.0
221dqmin412 min  0.0   -0.00    -> -0.00
222dqmin413 min  0     -0.0     -> -0.0
223dqmin414 min  0     -0       -> -0
224dqmin415 min -0.0   -0       -> -0
225dqmin416 min -0     -0.100   -> -0.100
226dqmin417 min -0.100 -0.10    -> -0.10
227dqmin418 min -0.10  -0.1     -> -0.1
228dqmin419 min -0.1   -1.0     -> -1.0
229dqmin420 min -1.0   -1       -> -1
230dqmin421 min -1     -1.1     -> -1.1
231dqmin423 min -1.1   -Inf     -> -Infinity
232-- same with operands reversed
233dqmin431 min  1.1    Inf     ->  1.1
234dqmin432 min  1      1.1     ->  1
235dqmin433 min  1.0    1       ->  1.0
236dqmin434 min  0.1    1.0     ->  0.1
237dqmin435 min  0.10   0.1     ->  0.10
238dqmin436 min  0.100  0.10    ->  0.100
239dqmin437 min  0      0.10    ->  0
240dqmin438 min  0.0    0       ->  0.0
241dqmin439 min -0      0.0     -> -0
242dqmin440 min -0.0    0.0     -> -0.0
243dqmin441 min -0.0    0.00    -> -0.0
244dqmin442 min -0.00   0.0     -> -0.00
245dqmin443 min -0.0    0       -> -0.0
246dqmin444 min -0      0       -> -0
247dqmin445 min -0     -0.0     -> -0
248dqmin446 min -0.100 -0       -> -0.100
249dqmin447 min -0.10  -0.100   -> -0.10
250dqmin448 min -0.1   -0.10    -> -0.1
251dqmin449 min -1.0   -0.1     -> -1.0
252dqmin450 min -1     -1.0     -> -1
253dqmin451 min -1.1   -1       -> -1.1
254dqmin453 min -Inf   -1.1     -> -Infinity
255-- largies
256dqmin460 min  1000   1E+3    ->  1000
257dqmin461 min  1E+3   1000    ->  1000
258dqmin462 min  1000  -1E+3    -> -1E+3
259dqmin463 min  1E+3  -384    -> -384
260dqmin464 min -384   1E+3    -> -384
261dqmin465 min -1E+3   1000    -> -1E+3
262dqmin466 min -384  -1E+3    -> -1E+3
263dqmin467 min -1E+3  -384    -> -1E+3
264
265-- misalignment traps for little-endian
266dqmin471 min      1.0       0.1  -> 0.1
267dqmin472 min      0.1       1.0  -> 0.1
268dqmin473 min     10.0       0.1  -> 0.1
269dqmin474 min      0.1      10.0  -> 0.1
270dqmin475 min      100       1.0  -> 1.0
271dqmin476 min      1.0       100  -> 1.0
272dqmin477 min     1000      10.0  -> 10.0
273dqmin478 min     10.0      1000  -> 10.0
274dqmin479 min    10000     100.0  -> 100.0
275dqmin480 min    100.0     10000  -> 100.0
276dqmin481 min   100000    1000.0  -> 1000.0
277dqmin482 min   1000.0    100000  -> 1000.0
278dqmin483 min  1000000   10000.0  -> 10000.0
279dqmin484 min  10000.0   1000000  -> 10000.0
280
281-- subnormals
282dqmin510 min  1.00E-6143       0  ->   0
283dqmin511 min  0.1E-6143        0  ->   0
284dqmin512 min  0.10E-6143       0  ->   0
285dqmin513 min  0.100E-6143      0  ->   0
286dqmin514 min  0.01E-6143       0  ->   0
287dqmin515 min  0.999E-6143      0  ->   0
288dqmin516 min  0.099E-6143      0  ->   0
289dqmin517 min  0.009E-6143      0  ->   0
290dqmin518 min  0.001E-6143      0  ->   0
291dqmin519 min  0.0009E-6143     0  ->   0
292dqmin520 min  0.0001E-6143     0  ->   0
293
294dqmin530 min -1.00E-6143       0  ->  -1.00E-6143
295dqmin531 min -0.1E-6143        0  ->  -1E-6144    Subnormal
296dqmin532 min -0.10E-6143       0  ->  -1.0E-6144  Subnormal
297dqmin533 min -0.100E-6143      0  ->  -1.00E-6144 Subnormal
298dqmin534 min -0.01E-6143       0  ->  -1E-6145    Subnormal
299dqmin535 min -0.999E-6143      0  ->  -9.99E-6144 Subnormal
300dqmin536 min -0.099E-6143      0  ->  -9.9E-6145  Subnormal
301dqmin537 min -0.009E-6143      0  ->  -9E-6146    Subnormal
302dqmin538 min -0.001E-6143      0  ->  -1E-6146    Subnormal
303dqmin539 min -0.0009E-6143     0  ->  -9E-6147    Subnormal
304dqmin540 min -0.0001E-6143     0  ->  -1E-6147    Subnormal
305
306
307-- Null tests
308dqmin900 min 10  # -> NaN Invalid_operation
309dqmin901 min  # 10 -> NaN Invalid_operation
310