• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1------------------------------------------------------------------------
2-- ddMax.decTest -- decDouble 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
24precision:   16
25maxExponent: 384
26minExponent: -383
27extended:    1
28clamp:       1
29rounding:    half_even
30
31-- sanity checks
32ddmax001 max  -2  -2  -> -2
33ddmax002 max  -2  -1  -> -1
34ddmax003 max  -2   0  ->  0
35ddmax004 max  -2   1  ->  1
36ddmax005 max  -2   2  ->  2
37ddmax006 max  -1  -2  -> -1
38ddmax007 max  -1  -1  -> -1
39ddmax008 max  -1   0  ->  0
40ddmax009 max  -1   1  ->  1
41ddmax010 max  -1   2  ->  2
42ddmax011 max   0  -2  ->  0
43ddmax012 max   0  -1  ->  0
44ddmax013 max   0   0  ->  0
45ddmax014 max   0   1  ->  1
46ddmax015 max   0   2  ->  2
47ddmax016 max   1  -2  ->  1
48ddmax017 max   1  -1  ->  1
49ddmax018 max   1   0  ->  1
50ddmax019 max   1   1  ->  1
51ddmax020 max   1   2  ->  2
52ddmax021 max   2  -2  ->  2
53ddmax022 max   2  -1  ->  2
54ddmax023 max   2   0  ->  2
55ddmax025 max   2   1  ->  2
56ddmax026 max   2   2  ->  2
57
58-- extended zeros
59ddmax030 max   0     0   ->  0
60ddmax031 max   0    -0   ->  0
61ddmax032 max   0    -0.0 ->  0
62ddmax033 max   0     0.0 ->  0
63ddmax034 max  -0     0   ->  0    -- note: -0 = 0, but 0 chosen
64ddmax035 max  -0    -0   -> -0
65ddmax036 max  -0    -0.0 -> -0.0
66ddmax037 max  -0     0.0 ->  0.0
67ddmax038 max   0.0   0   ->  0
68ddmax039 max   0.0  -0   ->  0.0
69ddmax040 max   0.0  -0.0 ->  0.0
70ddmax041 max   0.0   0.0 ->  0.0
71ddmax042 max  -0.0   0   ->  0
72ddmax043 max  -0.0  -0   -> -0.0
73ddmax044 max  -0.0  -0.0 -> -0.0
74ddmax045 max  -0.0   0.0 ->  0.0
75
76ddmax050 max  -0E1   0E1 ->  0E+1
77ddmax051 max  -0E2   0E2 ->  0E+2
78ddmax052 max  -0E2   0E1 ->  0E+1
79ddmax053 max  -0E1   0E2 ->  0E+2
80ddmax054 max   0E1  -0E1 ->  0E+1
81ddmax055 max   0E2  -0E2 ->  0E+2
82ddmax056 max   0E2  -0E1 ->  0E+2
83ddmax057 max   0E1  -0E2 ->  0E+1
84
85ddmax058 max   0E1   0E1 ->  0E+1
86ddmax059 max   0E2   0E2 ->  0E+2
87ddmax060 max   0E2   0E1 ->  0E+2
88ddmax061 max   0E1   0E2 ->  0E+2
89ddmax062 max  -0E1  -0E1 -> -0E+1
90ddmax063 max  -0E2  -0E2 -> -0E+2
91ddmax064 max  -0E2  -0E1 -> -0E+1
92ddmax065 max  -0E1  -0E2 -> -0E+1
93
94-- Specials
95ddmax090 max  Inf  -Inf   ->  Infinity
96ddmax091 max  Inf  -1000  ->  Infinity
97ddmax092 max  Inf  -1     ->  Infinity
98ddmax093 max  Inf  -0     ->  Infinity
99ddmax094 max  Inf   0     ->  Infinity
100ddmax095 max  Inf   1     ->  Infinity
101ddmax096 max  Inf   1000  ->  Infinity
102ddmax097 max  Inf   Inf   ->  Infinity
103ddmax098 max -1000  Inf   ->  Infinity
104ddmax099 max -Inf   Inf   ->  Infinity
105ddmax100 max -1     Inf   ->  Infinity
106ddmax101 max -0     Inf   ->  Infinity
107ddmax102 max  0     Inf   ->  Infinity
108ddmax103 max  1     Inf   ->  Infinity
109ddmax104 max  1000  Inf   ->  Infinity
110ddmax105 max  Inf   Inf   ->  Infinity
111
112ddmax120 max -Inf  -Inf   -> -Infinity
113ddmax121 max -Inf  -1000  -> -1000
114ddmax122 max -Inf  -1     -> -1
115ddmax123 max -Inf  -0     -> -0
116ddmax124 max -Inf   0     ->  0
117ddmax125 max -Inf   1     ->  1
118ddmax126 max -Inf   1000  ->  1000
119ddmax127 max -Inf   Inf   ->  Infinity
120ddmax128 max -Inf  -Inf   ->  -Infinity
121ddmax129 max -1000 -Inf   ->  -1000
122ddmax130 max -1    -Inf   ->  -1
123ddmax131 max -0    -Inf   ->  -0
124ddmax132 max  0    -Inf   ->  0
125ddmax133 max  1    -Inf   ->  1
126ddmax134 max  1000 -Inf   ->  1000
127ddmax135 max  Inf  -Inf   ->  Infinity
128
129-- 2004.08.02 754r chooses number over NaN in mixed cases
130ddmax141 max  NaN -Inf    -> -Infinity
131ddmax142 max  NaN -1000   -> -1000
132ddmax143 max  NaN -1      -> -1
133ddmax144 max  NaN -0      -> -0
134ddmax145 max  NaN  0      ->  0
135ddmax146 max  NaN  1      ->  1
136ddmax147 max  NaN  1000   ->  1000
137ddmax148 max  NaN  Inf    ->  Infinity
138ddmax149 max  NaN  NaN    ->  NaN
139ddmax150 max -Inf  NaN    -> -Infinity
140ddmax151 max -1000 NaN    -> -1000
141ddmax152 max -1    NaN    -> -1
142ddmax153 max -0    NaN    -> -0
143ddmax154 max  0    NaN    ->  0
144ddmax155 max  1    NaN    ->  1
145ddmax156 max  1000 NaN    ->  1000
146ddmax157 max  Inf  NaN    ->  Infinity
147
148ddmax161 max  sNaN -Inf   ->  NaN  Invalid_operation
149ddmax162 max  sNaN -1000  ->  NaN  Invalid_operation
150ddmax163 max  sNaN -1     ->  NaN  Invalid_operation
151ddmax164 max  sNaN -0     ->  NaN  Invalid_operation
152ddmax165 max  sNaN  0     ->  NaN  Invalid_operation
153ddmax166 max  sNaN  1     ->  NaN  Invalid_operation
154ddmax167 max  sNaN  1000  ->  NaN  Invalid_operation
155ddmax168 max  sNaN  NaN   ->  NaN  Invalid_operation
156ddmax169 max  sNaN sNaN   ->  NaN  Invalid_operation
157ddmax170 max  NaN  sNaN   ->  NaN  Invalid_operation
158ddmax171 max -Inf  sNaN   ->  NaN  Invalid_operation
159ddmax172 max -1000 sNaN   ->  NaN  Invalid_operation
160ddmax173 max -1    sNaN   ->  NaN  Invalid_operation
161ddmax174 max -0    sNaN   ->  NaN  Invalid_operation
162ddmax175 max  0    sNaN   ->  NaN  Invalid_operation
163ddmax176 max  1    sNaN   ->  NaN  Invalid_operation
164ddmax177 max  1000 sNaN   ->  NaN  Invalid_operation
165ddmax178 max  Inf  sNaN   ->  NaN  Invalid_operation
166ddmax179 max  NaN  sNaN   ->  NaN  Invalid_operation
167
168-- propagating NaNs
169ddmax181 max  NaN9  -Inf   -> -Infinity
170ddmax182 max  NaN8     9   ->  9
171ddmax183 max -NaN7   Inf   ->  Infinity
172
173ddmax184 max -NaN1   NaN11 -> -NaN1
174ddmax185 max  NaN2   NaN12 ->  NaN2
175ddmax186 max -NaN13 -NaN7  -> -NaN13
176ddmax187 max  NaN14 -NaN5  ->  NaN14
177
178ddmax188 max -Inf    NaN4  -> -Infinity
179ddmax189 max -9     -NaN3  -> -9
180ddmax190 max  Inf    NaN2  ->  Infinity
181
182ddmax191 max  sNaN99 -Inf    ->  NaN99 Invalid_operation
183ddmax192 max  sNaN98 -1      ->  NaN98 Invalid_operation
184ddmax193 max -sNaN97  NaN    -> -NaN97 Invalid_operation
185ddmax194 max  sNaN96 sNaN94  ->  NaN96 Invalid_operation
186ddmax195 max  NaN95  sNaN93  ->  NaN93 Invalid_operation
187ddmax196 max -Inf    sNaN92  ->  NaN92 Invalid_operation
188ddmax197 max  0      sNaN91  ->  NaN91 Invalid_operation
189ddmax198 max  Inf   -sNaN90  -> -NaN90 Invalid_operation
190ddmax199 max  NaN    sNaN89  ->  NaN89 Invalid_operation
191
192-- old rounding checks
193ddmax221 max 12345678000 1  -> 12345678000
194ddmax222 max 1 12345678000  -> 12345678000
195ddmax223 max 1234567800  1  -> 1234567800
196ddmax224 max 1 1234567800   -> 1234567800
197ddmax225 max 1234567890  1  -> 1234567890
198ddmax226 max 1 1234567890   -> 1234567890
199ddmax227 max 1234567891  1  -> 1234567891
200ddmax228 max 1 1234567891   -> 1234567891
201ddmax229 max 12345678901 1  -> 12345678901
202ddmax230 max 1 12345678901  -> 12345678901
203ddmax231 max 1234567896  1  -> 1234567896
204ddmax232 max 1 1234567896   -> 1234567896
205ddmax233 max -1234567891  1 -> 1
206ddmax234 max 1 -1234567891  -> 1
207ddmax235 max -12345678901 1 -> 1
208ddmax236 max 1 -12345678901 -> 1
209ddmax237 max -1234567896  1 -> 1
210ddmax238 max 1 -1234567896  -> 1
211
212-- from examples
213ddmax280 max '3'   '2'  ->  '3'
214ddmax281 max '-10' '3'  ->  '3'
215ddmax282 max '1.0' '1'  ->  '1'
216ddmax283 max '1' '1.0'  ->  '1'
217ddmax284 max '7' 'NaN'  ->  '7'
218
219-- expanded list from min/max 754r purple prose
220-- [explicit tests for exponent ordering]
221ddmax401 max  Inf    1.1     ->  Infinity
222ddmax402 max  1.1    1       ->  1.1
223ddmax403 max  1      1.0     ->  1
224ddmax404 max  1.0    0.1     ->  1.0
225ddmax405 max  0.1    0.10    ->  0.1
226ddmax406 max  0.10   0.100   ->  0.10
227ddmax407 max  0.10   0       ->  0.10
228ddmax408 max  0      0.0     ->  0
229ddmax409 max  0.0   -0       ->  0.0
230ddmax410 max  0.0   -0.0     ->  0.0
231ddmax411 max  0.00  -0.0     ->  0.00
232ddmax412 max  0.0   -0.00    ->  0.0
233ddmax413 max  0     -0.0     ->  0
234ddmax414 max  0     -0       ->  0
235ddmax415 max -0.0   -0       -> -0.0
236ddmax416 max -0     -0.100   -> -0
237ddmax417 max -0.100 -0.10    -> -0.100
238ddmax418 max -0.10  -0.1     -> -0.10
239ddmax419 max -0.1   -1.0     -> -0.1
240ddmax420 max -1.0   -1       -> -1.0
241ddmax421 max -1     -1.1     -> -1
242ddmax423 max -1.1   -Inf     -> -1.1
243-- same with operands reversed
244ddmax431 max  1.1    Inf     ->  Infinity
245ddmax432 max  1      1.1     ->  1.1
246ddmax433 max  1.0    1       ->  1
247ddmax434 max  0.1    1.0     ->  1.0
248ddmax435 max  0.10   0.1     ->  0.1
249ddmax436 max  0.100  0.10    ->  0.10
250ddmax437 max  0      0.10    ->  0.10
251ddmax438 max  0.0    0       ->  0
252ddmax439 max -0      0.0     ->  0.0
253ddmax440 max -0.0    0.0     ->  0.0
254ddmax441 max -0.0    0.00    ->  0.00
255ddmax442 max -0.00   0.0     ->  0.0
256ddmax443 max -0.0    0       ->  0
257ddmax444 max -0      0       ->  0
258ddmax445 max -0     -0.0     -> -0.0
259ddmax446 max -0.100 -0       -> -0
260ddmax447 max -0.10  -0.100   -> -0.100
261ddmax448 max -0.1   -0.10    -> -0.10
262ddmax449 max -1.0   -0.1     -> -0.1
263ddmax450 max -1     -1.0     -> -1.0
264ddmax451 max -1.1   -1       -> -1
265ddmax453 max -Inf   -1.1     -> -1.1
266-- largies
267ddmax460 max  1000   1E+3    ->  1E+3
268ddmax461 max  1E+3   1000    ->  1E+3
269ddmax462 max  1000  -1E+3    ->  1000
270ddmax463 max  1E+3  -1000    ->  1E+3
271ddmax464 max -1000   1E+3    ->  1E+3
272ddmax465 max -1E+3   1000    ->  1000
273ddmax466 max -1000  -1E+3    -> -1000
274ddmax467 max -1E+3  -1000    -> -1000
275
276-- misalignment traps for little-endian
277ddmax471 max      1.0       0.1  -> 1.0
278ddmax472 max      0.1       1.0  -> 1.0
279ddmax473 max     10.0       0.1  -> 10.0
280ddmax474 max      0.1      10.0  -> 10.0
281ddmax475 max      100       1.0  -> 100
282ddmax476 max      1.0       100  -> 100
283ddmax477 max     1000      10.0  -> 1000
284ddmax478 max     10.0      1000  -> 1000
285ddmax479 max    10000     100.0  -> 10000
286ddmax480 max    100.0     10000  -> 10000
287ddmax481 max   100000    1000.0  -> 100000
288ddmax482 max   1000.0    100000  -> 100000
289ddmax483 max  1000000   10000.0  -> 1000000
290ddmax484 max  10000.0   1000000  -> 1000000
291
292-- subnormals
293ddmax510 max  1.00E-383       0  ->   1.00E-383
294ddmax511 max  0.1E-383        0  ->   1E-384    Subnormal
295ddmax512 max  0.10E-383       0  ->   1.0E-384  Subnormal
296ddmax513 max  0.100E-383      0  ->   1.00E-384 Subnormal
297ddmax514 max  0.01E-383       0  ->   1E-385    Subnormal
298ddmax515 max  0.999E-383      0  ->   9.99E-384 Subnormal
299ddmax516 max  0.099E-383      0  ->   9.9E-385  Subnormal
300ddmax517 max  0.009E-383      0  ->   9E-386    Subnormal
301ddmax518 max  0.001E-383      0  ->   1E-386    Subnormal
302ddmax519 max  0.0009E-383     0  ->   9E-387    Subnormal
303ddmax520 max  0.0001E-383     0  ->   1E-387    Subnormal
304
305ddmax530 max -1.00E-383       0  ->   0
306ddmax531 max -0.1E-383        0  ->   0
307ddmax532 max -0.10E-383       0  ->   0
308ddmax533 max -0.100E-383      0  ->   0
309ddmax534 max -0.01E-383       0  ->   0
310ddmax535 max -0.999E-383      0  ->   0
311ddmax536 max -0.099E-383      0  ->   0
312ddmax537 max -0.009E-383      0  ->   0
313ddmax538 max -0.001E-383      0  ->   0
314ddmax539 max -0.0009E-383     0  ->   0
315ddmax540 max -0.0001E-383     0  ->   0
316
317-- Null tests
318ddmax900 max 10  #  -> NaN Invalid_operation
319ddmax901 max  # 10  -> NaN Invalid_operation
320
321
322
323