1------------------------------------------------------------------------
2-- ddMin.decTest -- decDouble 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
24precision:   16
25maxExponent: 384
26minExponent: -383
27extended:    1
28clamp:       1
29rounding:    half_even
30
31-- sanity checks
32ddmin001 min  -2  -2  -> -2
33ddmin002 min  -2  -1  -> -2
34ddmin003 min  -2   0  -> -2
35ddmin004 min  -2   1  -> -2
36ddmin005 min  -2   2  -> -2
37ddmin006 min  -1  -2  -> -2
38ddmin007 min  -1  -1  -> -1
39ddmin008 min  -1   0  -> -1
40ddmin009 min  -1   1  -> -1
41ddmin010 min  -1   2  -> -1
42ddmin011 min   0  -2  -> -2
43ddmin012 min   0  -1  -> -1
44ddmin013 min   0   0  ->  0
45ddmin014 min   0   1  ->  0
46ddmin015 min   0   2  ->  0
47ddmin016 min   1  -2  -> -2
48ddmin017 min   1  -1  -> -1
49ddmin018 min   1   0  ->  0
50ddmin019 min   1   1  ->  1
51ddmin020 min   1   2  ->  1
52ddmin021 min   2  -2  -> -2
53ddmin022 min   2  -1  -> -1
54ddmin023 min   2   0  ->  0
55ddmin025 min   2   1  ->  1
56ddmin026 min   2   2  ->  2
57
58-- extended zeros
59ddmin030 min   0     0   ->  0
60ddmin031 min   0    -0   -> -0
61ddmin032 min   0    -0.0 -> -0.0
62ddmin033 min   0     0.0 ->  0.0
63ddmin034 min  -0     0   -> -0
64ddmin035 min  -0    -0   -> -0
65ddmin036 min  -0    -0.0 -> -0
66ddmin037 min  -0     0.0 -> -0
67ddmin038 min   0.0   0   ->  0.0
68ddmin039 min   0.0  -0   -> -0
69ddmin040 min   0.0  -0.0 -> -0.0
70ddmin041 min   0.0   0.0 ->  0.0
71ddmin042 min  -0.0   0   -> -0.0
72ddmin043 min  -0.0  -0   -> -0
73ddmin044 min  -0.0  -0.0 -> -0.0
74ddmin045 min  -0.0   0.0 -> -0.0
75
76ddmin046 min   0E1  -0E1 -> -0E+1
77ddmin047 min  -0E1   0E2 -> -0E+1
78ddmin048 min   0E2   0E1 ->  0E+1
79ddmin049 min   0E1   0E2 ->  0E+1
80ddmin050 min  -0E3  -0E2 -> -0E+3
81ddmin051 min  -0E2  -0E3 -> -0E+3
82
83-- Specials
84ddmin090 min  Inf  -Inf   -> -Infinity
85ddmin091 min  Inf  -1000  -> -1000
86ddmin092 min  Inf  -1     -> -1
87ddmin093 min  Inf  -0     -> -0
88ddmin094 min  Inf   0     ->  0
89ddmin095 min  Inf   1     ->  1
90ddmin096 min  Inf   1000  ->  1000
91ddmin097 min  Inf   Inf   ->  Infinity
92ddmin098 min -1000  Inf   -> -1000
93ddmin099 min -Inf   Inf   -> -Infinity
94ddmin100 min -1     Inf   -> -1
95ddmin101 min -0     Inf   -> -0
96ddmin102 min  0     Inf   ->  0
97ddmin103 min  1     Inf   ->  1
98ddmin104 min  1000  Inf   ->  1000
99ddmin105 min  Inf   Inf   ->  Infinity
100
101ddmin120 min -Inf  -Inf   -> -Infinity
102ddmin121 min -Inf  -1000  -> -Infinity
103ddmin122 min -Inf  -1     -> -Infinity
104ddmin123 min -Inf  -0     -> -Infinity
105ddmin124 min -Inf   0     -> -Infinity
106ddmin125 min -Inf   1     -> -Infinity
107ddmin126 min -Inf   1000  -> -Infinity
108ddmin127 min -Inf   Inf   -> -Infinity
109ddmin128 min -Inf  -Inf   -> -Infinity
110ddmin129 min -1000 -Inf   -> -Infinity
111ddmin130 min -1    -Inf   -> -Infinity
112ddmin131 min -0    -Inf   -> -Infinity
113ddmin132 min  0    -Inf   -> -Infinity
114ddmin133 min  1    -Inf   -> -Infinity
115ddmin134 min  1000 -Inf   -> -Infinity
116ddmin135 min  Inf  -Inf   -> -Infinity
117
118-- 2004.08.02 754r chooses number over NaN in mixed cases
119ddmin141 min  NaN -Inf    ->  -Infinity
120ddmin142 min  NaN -1000   ->  -1000
121ddmin143 min  NaN -1      ->  -1
122ddmin144 min  NaN -0      ->  -0
123ddmin145 min  NaN  0      ->  0
124ddmin146 min  NaN  1      ->  1
125ddmin147 min  NaN  1000   ->  1000
126ddmin148 min  NaN  Inf    ->  Infinity
127ddmin149 min  NaN  NaN    ->  NaN
128ddmin150 min -Inf  NaN    -> -Infinity
129ddmin151 min -1000 NaN    -> -1000
130ddmin152 min -1   -NaN    -> -1
131ddmin153 min -0    NaN    -> -0
132ddmin154 min  0   -NaN    ->  0
133ddmin155 min  1    NaN    ->  1
134ddmin156 min  1000 NaN    ->  1000
135ddmin157 min  Inf  NaN    ->  Infinity
136
137ddmin161 min  sNaN -Inf   ->  NaN  Invalid_operation
138ddmin162 min  sNaN -1000  ->  NaN  Invalid_operation
139ddmin163 min  sNaN -1     ->  NaN  Invalid_operation
140ddmin164 min  sNaN -0     ->  NaN  Invalid_operation
141ddmin165 min -sNaN  0     -> -NaN  Invalid_operation
142ddmin166 min -sNaN  1     -> -NaN  Invalid_operation
143ddmin167 min  sNaN  1000  ->  NaN  Invalid_operation
144ddmin168 min  sNaN  NaN   ->  NaN  Invalid_operation
145ddmin169 min  sNaN sNaN   ->  NaN  Invalid_operation
146ddmin170 min  NaN  sNaN   ->  NaN  Invalid_operation
147ddmin171 min -Inf  sNaN   ->  NaN  Invalid_operation
148ddmin172 min -1000 sNaN   ->  NaN  Invalid_operation
149ddmin173 min -1    sNaN   ->  NaN  Invalid_operation
150ddmin174 min -0    sNaN   ->  NaN  Invalid_operation
151ddmin175 min  0    sNaN   ->  NaN  Invalid_operation
152ddmin176 min  1    sNaN   ->  NaN  Invalid_operation
153ddmin177 min  1000 sNaN   ->  NaN  Invalid_operation
154ddmin178 min  Inf  sNaN   ->  NaN  Invalid_operation
155ddmin179 min  NaN  sNaN   ->  NaN  Invalid_operation
156
157-- propagating NaNs
158ddmin181 min  NaN9   -Inf   -> -Infinity
159ddmin182 min -NaN8    9990  ->  9990
160ddmin183 min  NaN71   Inf   ->  Infinity
161
162ddmin184 min  NaN1    NaN54 ->  NaN1
163ddmin185 min  NaN22  -NaN53 ->  NaN22
164ddmin186 min -NaN3    NaN6  -> -NaN3
165ddmin187 min -NaN44   NaN7  -> -NaN44
166
167ddmin188 min -Inf     NaN41 -> -Infinity
168ddmin189 min -9999   -NaN33 -> -9999
169ddmin190 min  Inf     NaN2  ->  Infinity
170
171ddmin191 min  sNaN99 -Inf    ->  NaN99 Invalid_operation
172ddmin192 min  sNaN98 -11     ->  NaN98 Invalid_operation
173ddmin193 min -sNaN97  NaN8   -> -NaN97 Invalid_operation
174ddmin194 min  sNaN69 sNaN94  ->  NaN69 Invalid_operation
175ddmin195 min  NaN95  sNaN93  ->  NaN93 Invalid_operation
176ddmin196 min -Inf    sNaN92  ->  NaN92 Invalid_operation
177ddmin197 min  088    sNaN91  ->  NaN91 Invalid_operation
178ddmin198 min  Inf   -sNaN90  -> -NaN90 Invalid_operation
179ddmin199 min  NaN    sNaN86  ->  NaN86 Invalid_operation
180
181-- old rounding checks
182ddmin221 min -12345678000 1  -> -12345678000
183ddmin222 min 1 -12345678000  -> -12345678000
184ddmin223 min -1234567800  1  -> -1234567800
185ddmin224 min 1 -1234567800   -> -1234567800
186ddmin225 min -1234567890  1  -> -1234567890
187ddmin226 min 1 -1234567890   -> -1234567890
188ddmin227 min -1234567891  1  -> -1234567891
189ddmin228 min 1 -1234567891   -> -1234567891
190ddmin229 min -12345678901 1  -> -12345678901
191ddmin230 min 1 -12345678901  -> -12345678901
192ddmin231 min -1234567896  1  -> -1234567896
193ddmin232 min 1 -1234567896   -> -1234567896
194ddmin233 min 1234567891  1   -> 1
195ddmin234 min 1 1234567891    -> 1
196ddmin235 min 12345678901 1   -> 1
197ddmin236 min 1 12345678901   -> 1
198ddmin237 min 1234567896  1   -> 1
199ddmin238 min 1 1234567896    -> 1
200
201-- from examples
202ddmin280 min '3'   '2'  ->  '2'
203ddmin281 min '-10' '3'  ->  '-10'
204ddmin282 min '1.0' '1'  ->  '1.0'
205ddmin283 min '1' '1.0'  ->  '1.0'
206ddmin284 min '7' 'NaN'  ->  '7'
207
208-- expanded list from min/max 754r purple prose
209-- [explicit tests for exponent ordering]
210ddmin401 min  Inf    1.1     ->  1.1
211ddmin402 min  1.1    1       ->  1
212ddmin403 min  1      1.0     ->  1.0
213ddmin404 min  1.0    0.1     ->  0.1
214ddmin405 min  0.1    0.10    ->  0.10
215ddmin406 min  0.10   0.100   ->  0.100
216ddmin407 min  0.10   0       ->  0
217ddmin408 min  0      0.0     ->  0.0
218ddmin409 min  0.0   -0       -> -0
219ddmin410 min  0.0   -0.0     -> -0.0
220ddmin411 min  0.00  -0.0     -> -0.0
221ddmin412 min  0.0   -0.00    -> -0.00
222ddmin413 min  0     -0.0     -> -0.0
223ddmin414 min  0     -0       -> -0
224ddmin415 min -0.0   -0       -> -0
225ddmin416 min -0     -0.100   -> -0.100
226ddmin417 min -0.100 -0.10    -> -0.10
227ddmin418 min -0.10  -0.1     -> -0.1
228ddmin419 min -0.1   -1.0     -> -1.0
229ddmin420 min -1.0   -1       -> -1
230ddmin421 min -1     -1.1     -> -1.1
231ddmin423 min -1.1   -Inf     -> -Infinity
232-- same with operands reversed
233ddmin431 min  1.1    Inf     ->  1.1
234ddmin432 min  1      1.1     ->  1
235ddmin433 min  1.0    1       ->  1.0
236ddmin434 min  0.1    1.0     ->  0.1
237ddmin435 min  0.10   0.1     ->  0.10
238ddmin436 min  0.100  0.10    ->  0.100
239ddmin437 min  0      0.10    ->  0
240ddmin438 min  0.0    0       ->  0.0
241ddmin439 min -0      0.0     -> -0
242ddmin440 min -0.0    0.0     -> -0.0
243ddmin441 min -0.0    0.00    -> -0.0
244ddmin442 min -0.00   0.0     -> -0.00
245ddmin443 min -0.0    0       -> -0.0
246ddmin444 min -0      0       -> -0
247ddmin445 min -0     -0.0     -> -0
248ddmin446 min -0.100 -0       -> -0.100
249ddmin447 min -0.10  -0.100   -> -0.10
250ddmin448 min -0.1   -0.10    -> -0.1
251ddmin449 min -1.0   -0.1     -> -1.0
252ddmin450 min -1     -1.0     -> -1
253ddmin451 min -1.1   -1       -> -1.1
254ddmin453 min -Inf   -1.1     -> -Infinity
255-- largies
256ddmin460 min  1000   1E+3    ->  1000
257ddmin461 min  1E+3   1000    ->  1000
258ddmin462 min  1000  -1E+3    -> -1E+3
259ddmin463 min  1E+3  -384    -> -384
260ddmin464 min -384   1E+3    -> -384
261ddmin465 min -1E+3   1000    -> -1E+3
262ddmin466 min -384  -1E+3    -> -1E+3
263ddmin467 min -1E+3  -384    -> -1E+3
264
265-- misalignment traps for little-endian
266ddmin471 min      1.0       0.1  -> 0.1
267ddmin472 min      0.1       1.0  -> 0.1
268ddmin473 min     10.0       0.1  -> 0.1
269ddmin474 min      0.1      10.0  -> 0.1
270ddmin475 min      100       1.0  -> 1.0
271ddmin476 min      1.0       100  -> 1.0
272ddmin477 min     1000      10.0  -> 10.0
273ddmin478 min     10.0      1000  -> 10.0
274ddmin479 min    10000     100.0  -> 100.0
275ddmin480 min    100.0     10000  -> 100.0
276ddmin481 min   100000    1000.0  -> 1000.0
277ddmin482 min   1000.0    100000  -> 1000.0
278ddmin483 min  1000000   10000.0  -> 10000.0
279ddmin484 min  10000.0   1000000  -> 10000.0
280
281-- subnormals
282ddmin510 min  1.00E-383       0  ->   0
283ddmin511 min  0.1E-383        0  ->   0
284ddmin512 min  0.10E-383       0  ->   0
285ddmin513 min  0.100E-383      0  ->   0
286ddmin514 min  0.01E-383       0  ->   0
287ddmin515 min  0.999E-383      0  ->   0
288ddmin516 min  0.099E-383      0  ->   0
289ddmin517 min  0.009E-383      0  ->   0
290ddmin518 min  0.001E-383      0  ->   0
291ddmin519 min  0.0009E-383     0  ->   0
292ddmin520 min  0.0001E-383     0  ->   0
293
294ddmin530 min -1.00E-383       0  ->  -1.00E-383
295ddmin531 min -0.1E-383        0  ->  -1E-384    Subnormal
296ddmin532 min -0.10E-383       0  ->  -1.0E-384  Subnormal
297ddmin533 min -0.100E-383      0  ->  -1.00E-384 Subnormal
298ddmin534 min -0.01E-383       0  ->  -1E-385    Subnormal
299ddmin535 min -0.999E-383      0  ->  -9.99E-384 Subnormal
300ddmin536 min -0.099E-383      0  ->  -9.9E-385  Subnormal
301ddmin537 min -0.009E-383      0  ->  -9E-386    Subnormal
302ddmin538 min -0.001E-383      0  ->  -1E-386    Subnormal
303ddmin539 min -0.0009E-383     0  ->  -9E-387    Subnormal
304ddmin540 min -0.0001E-383     0  ->  -1E-387    Subnormal
305
306
307-- Null tests
308ddmin900 min 10  # -> NaN Invalid_operation
309ddmin901 min  # 10 -> NaN Invalid_operation
310