Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | ------------------------------------------------------------------------ |
2 | -- decimal32.decTest -- decimal four-byte format testcases -- | |
3 | -- Copyright (c) IBM Corporation, 2000, 2003. 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 | ------------------------------------------------------------------------ | |
20 | version: 2.39 | |
21 | ||
22 | -- This set of tests is for the four-byte concrete representation. | |
23 | -- Its characteristics are: | |
24 | -- | |
25 | -- 1 bit sign | |
26 | -- 5 bits combination field | |
27 | -- 6 bits exponent continuation | |
28 | -- 20 bits coefficient continuation | |
29 | -- | |
30 | -- Total exponent length 8 bits | |
31 | -- Total coefficient length 24 bits (7 digits) | |
32 | -- | |
33 | -- Elimit = 191 (maximum encoded exponent) | |
34 | -- Emax = 96 (largest exponent value) | |
35 | -- Emin = -95 (smallest exponent value) | |
36 | -- bias = 101 (subtracted from encoded exponent) = -Etiny | |
37 | ||
38 | extended: 1 | |
39 | precision: 7 | |
40 | rounding: half_up | |
41 | maxExponent: 96 | |
42 | minExponent: -95 | |
43 | ||
44 | -- General testcases | |
45 | -- (mostly derived from the Strawman 4 document and examples) | |
46 | decd001 apply #A23003D0 -> -7.50 | |
47 | decd002 apply -7.50 -> #A23003D0 | |
48 | ||
49 | -- Normality | |
50 | decd010 apply 1234567 -> #2654d2e7 | |
51 | decd011 apply 1234567.0 -> #2654d2e7 Rounded | |
52 | decd012 apply 1234567.1 -> #2654d2e7 Rounded Inexact | |
53 | decd013 apply -1234567 -> #a654d2e7 | |
54 | decd014 apply -1234567.0 -> #a654d2e7 Rounded | |
55 | decd015 apply -1234567.1 -> #a654d2e7 Rounded Inexact | |
56 | ||
57 | ||
58 | -- Nmax and similar | |
59 | decd022 apply 9.999999E+96 -> #77f3fcff | |
60 | decd023 apply #77f3fcff -> 9.999999E+96 | |
61 | decd024 apply 1.234567E+96 -> #47f4d2e7 | |
62 | decd025 apply #47f4d2e7 -> 1.234567E+96 | |
63 | -- fold-downs (more below) | |
64 | decd030 apply 1.23E+96 -> #47f4c000 Clamped | |
65 | decd031 apply #47f4c000 -> 1.230000E+96 | |
66 | decd032 apply 1E+96 -> #47f00000 Clamped | |
67 | decd033 apply #47f00000 -> 1.000000E+96 | |
68 | ||
69 | -- overflows | |
70 | maxExponent: 999 -- set high so conversion causes the overflow | |
71 | minExponent: -999 | |
72 | decd040 apply 10E+96 -> #78000000 Overflow Rounded Inexact | |
73 | decd041 apply 1.000000E+97 -> #78000000 Overflow Rounded Inexact | |
74 | maxExponent: 96 | |
75 | minExponent: -95 | |
76 | ||
77 | decd051 apply 12345 -> #225049c5 | |
78 | decd052 apply #225049c5 -> 12345 | |
79 | decd053 apply 1234 -> #22500534 | |
80 | decd054 apply #22500534 -> 1234 | |
81 | decd055 apply 123 -> #225000a3 | |
82 | decd056 apply #225000a3 -> 123 | |
83 | decd057 apply 12 -> #22500012 | |
84 | decd058 apply #22500012 -> 12 | |
85 | decd059 apply 1 -> #22500001 | |
86 | decd060 apply #22500001 -> 1 | |
87 | decd061 apply 1.23 -> #223000a3 | |
88 | decd062 apply #223000a3 -> 1.23 | |
89 | decd063 apply 123.45 -> #223049c5 | |
90 | decd064 apply #223049c5 -> 123.45 | |
91 | ||
92 | -- Nmin and below | |
93 | decd071 apply 1E-95 -> #00600001 | |
94 | decd072 apply #00600001 -> 1E-95 | |
95 | decd073 apply 1.000000E-95 -> #04000000 | |
96 | decd074 apply #04000000 -> 1.000000E-95 | |
97 | decd075 apply 1.000001E-95 -> #04000001 | |
98 | decd076 apply #04000001 -> 1.000001E-95 | |
99 | ||
100 | decd077 apply 0.100000E-95 -> #00020000 Subnormal | |
101 | decd07x apply 1.00000E-96 -> 1.00000E-96 Subnormal | |
102 | decd078 apply #00020000 -> 1.00000E-96 Subnormal | |
103 | decd079 apply 0.000010E-95 -> #00000010 Subnormal | |
104 | decd080 apply #00000010 -> 1.0E-100 Subnormal | |
105 | decd081 apply 0.000001E-95 -> #00000001 Subnormal | |
106 | decd082 apply #00000001 -> 1E-101 Subnormal | |
107 | decd083 apply 1e-101 -> #00000001 Subnormal | |
108 | decd084 apply #00000001 -> 1E-101 Subnormal | |
109 | decd08x apply 1e-101 -> 1E-101 Subnormal | |
110 | ||
111 | -- underflows | |
112 | decd090 apply 1e-101 -> #00000001 Subnormal | |
113 | decd091 apply 1.9e-101 -> #00000002 Subnormal Underflow Inexact Rounded | |
114 | decd092 apply 1.1e-101 -> #00000001 Subnormal Underflow Inexact Rounded | |
115 | decd093 apply 1.001e-101 -> #00000001 Subnormal Underflow Inexact Rounded | |
116 | decd094 apply 1.000001e-101 -> #00000001 Subnormal Underflow Inexact Rounded | |
117 | decd095 apply 1.0000001e-101 -> #00000001 Subnormal Underflow Inexact Rounded | |
118 | decd096 apply 0.1e-101 -> #00000000 Subnormal Underflow Inexact Rounded | |
119 | decd097 apply 0.001e-101 -> #00000000 Subnormal Underflow Inexact Rounded | |
120 | decd098 apply 0.000001e-101 -> #00000000 Subnormal Underflow Inexact Rounded | |
121 | decd099 apply 0.0000001e-101 -> #00000000 Subnormal Underflow Inexact Rounded | |
122 | ||
123 | -- same again, negatives -- | |
124 | ||
125 | -- Nmax and similar | |
126 | decd122 apply -9.999999E+96 -> #f7f3fcff | |
127 | decd123 apply #f7f3fcff -> -9.999999E+96 | |
128 | decd124 apply -1.234567E+96 -> #c7f4d2e7 | |
129 | decd125 apply #c7f4d2e7 -> -1.234567E+96 | |
130 | -- fold-downs (more below) | |
131 | decd130 apply -1.23E+96 -> #c7f4c000 Clamped | |
132 | decd131 apply #c7f4c000 -> -1.230000E+96 | |
133 | decd132 apply -1E+96 -> #c7f00000 Clamped | |
134 | decd133 apply #c7f00000 -> -1.000000E+96 | |
135 | ||
136 | -- overflows | |
137 | maxExponent: 999 -- set high so conversion causes the overflow | |
138 | minExponent: -999 | |
139 | decd140 apply -10E+96 -> #f8000000 Overflow Rounded Inexact | |
140 | decd141 apply -1.000000E+97 -> #f8000000 Overflow Rounded Inexact | |
141 | maxExponent: 96 | |
142 | minExponent: -95 | |
143 | ||
144 | decd151 apply -12345 -> #a25049c5 | |
145 | decd152 apply #a25049c5 -> -12345 | |
146 | decd153 apply -1234 -> #a2500534 | |
147 | decd154 apply #a2500534 -> -1234 | |
148 | decd155 apply -123 -> #a25000a3 | |
149 | decd156 apply #a25000a3 -> -123 | |
150 | decd157 apply -12 -> #a2500012 | |
151 | decd158 apply #a2500012 -> -12 | |
152 | decd159 apply -1 -> #a2500001 | |
153 | decd160 apply #a2500001 -> -1 | |
154 | decd161 apply -1.23 -> #a23000a3 | |
155 | decd162 apply #a23000a3 -> -1.23 | |
156 | decd163 apply -123.45 -> #a23049c5 | |
157 | decd164 apply #a23049c5 -> -123.45 | |
158 | ||
159 | -- Nmin and below | |
160 | decd171 apply -1E-95 -> #80600001 | |
161 | decd172 apply #80600001 -> -1E-95 | |
162 | decd173 apply -1.000000E-95 -> #84000000 | |
163 | decd174 apply #84000000 -> -1.000000E-95 | |
164 | decd175 apply -1.000001E-95 -> #84000001 | |
165 | decd176 apply #84000001 -> -1.000001E-95 | |
166 | ||
167 | decd177 apply -0.100000E-95 -> #80020000 Subnormal | |
168 | decd178 apply #80020000 -> -1.00000E-96 Subnormal | |
169 | decd179 apply -0.000010E-95 -> #80000010 Subnormal | |
170 | decd180 apply #80000010 -> -1.0E-100 Subnormal | |
171 | decd181 apply -0.000001E-95 -> #80000001 Subnormal | |
172 | decd182 apply #80000001 -> -1E-101 Subnormal | |
173 | decd183 apply -1e-101 -> #80000001 Subnormal | |
174 | decd184 apply #80000001 -> -1E-101 Subnormal | |
175 | ||
176 | -- underflows | |
177 | decd190 apply -1e-101 -> #80000001 Subnormal | |
178 | decd191 apply -1.9e-101 -> #80000002 Subnormal Underflow Inexact Rounded | |
179 | decd192 apply -1.1e-101 -> #80000001 Subnormal Underflow Inexact Rounded | |
180 | decd193 apply -1.001e-101 -> #80000001 Subnormal Underflow Inexact Rounded | |
181 | decd194 apply -1.000001e-101 -> #80000001 Subnormal Underflow Inexact Rounded | |
182 | decd195 apply -1.0000001e-101 -> #80000001 Subnormal Underflow Inexact Rounded | |
183 | decd196 apply -0.1e-101 -> #80000000 Subnormal Underflow Inexact Rounded | |
184 | decd197 apply -0.001e-101 -> #80000000 Subnormal Underflow Inexact Rounded | |
185 | decd198 apply -0.000001e-101 -> #80000000 Subnormal Underflow Inexact Rounded | |
186 | decd199 apply -0.0000001e-101 -> #80000000 Subnormal Underflow Inexact Rounded | |
187 | ||
188 | -- zeros | |
189 | decd400 apply 0E-400 -> #00000000 Clamped | |
190 | decd401 apply 0E-101 -> #00000000 | |
191 | decd402 apply #00000000 -> 0E-101 | |
192 | decd403 apply 0.000000E-95 -> #00000000 | |
193 | decd404 apply #00000000 -> 0E-101 | |
194 | decd405 apply 0E-2 -> #22300000 | |
195 | decd406 apply #22300000 -> 0.00 | |
196 | decd407 apply 0 -> #22500000 | |
197 | decd408 apply #22500000 -> 0 | |
198 | decd409 apply 0E+3 -> #22800000 | |
199 | decd410 apply #22800000 -> 0E+3 | |
200 | decd411 apply 0E+90 -> #43f00000 | |
201 | decd412 apply #43f00000 -> 0E+90 | |
202 | -- clamped zeros... | |
203 | decd413 apply 0E+91 -> #43f00000 Clamped | |
204 | decd414 apply #43f00000 -> 0E+90 | |
205 | decd415 apply 0E+96 -> #43f00000 Clamped | |
206 | decd416 apply #43f00000 -> 0E+90 | |
207 | decd417 apply 0E+400 -> #43f00000 Clamped | |
208 | decd418 apply #43f00000 -> 0E+90 | |
209 | ||
210 | -- negative zeros | |
211 | decd420 apply -0E-400 -> #80000000 Clamped | |
212 | decd421 apply -0E-101 -> #80000000 | |
213 | decd422 apply #80000000 -> -0E-101 | |
214 | decd423 apply -0.000000E-95 -> #80000000 | |
215 | decd424 apply #80000000 -> -0E-101 | |
216 | decd425 apply -0E-2 -> #a2300000 | |
217 | decd426 apply #a2300000 -> -0.00 | |
218 | decd427 apply -0 -> #a2500000 | |
219 | decd428 apply #a2500000 -> -0 | |
220 | decd429 apply -0E+3 -> #a2800000 | |
221 | decd430 apply #a2800000 -> -0E+3 | |
222 | decd431 apply -0E+90 -> #c3f00000 | |
223 | decd432 apply #c3f00000 -> -0E+90 | |
224 | -- clamped zeros... | |
225 | decd433 apply -0E+91 -> #c3f00000 Clamped | |
226 | decd434 apply #c3f00000 -> -0E+90 | |
227 | decd435 apply -0E+96 -> #c3f00000 Clamped | |
228 | decd436 apply #c3f00000 -> -0E+90 | |
229 | decd437 apply -0E+400 -> #c3f00000 Clamped | |
230 | decd438 apply #c3f00000 -> -0E+90 | |
231 | ||
232 | -- Specials | |
233 | decd500 apply Infinity -> #78000000 | |
234 | decd501 apply #78787878 -> #78000000 | |
235 | decd502 apply #78000000 -> Infinity | |
236 | decd503 apply #79797979 -> #78000000 | |
237 | decd504 apply #79000000 -> Infinity | |
238 | decd505 apply #7a7a7a7a -> #78000000 | |
239 | decd506 apply #7a000000 -> Infinity | |
240 | decd507 apply #7b7b7b7b -> #78000000 | |
241 | decd508 apply #7b000000 -> Infinity | |
242 | decd509 apply #7c7c7c7c -> #7c0c7c7c | |
243 | ||
244 | decd510 apply NaN -> #7c000000 | |
245 | decd511 apply #7c000000 -> NaN | |
246 | decd512 apply #7d7d7d7d -> #7c0d7d7d | |
247 | decd513 apply #7d000000 -> NaN | |
248 | decd514 apply #7e7e7e7e -> #7e0e7c7e | |
249 | decd515 apply #7e000000 -> sNaN | |
250 | decd516 apply #7f7f7f7f -> #7e0f7c7f | |
251 | decd517 apply #7f000000 -> sNaN | |
252 | decd518 apply #7fffffff -> sNaN999999 | |
253 | decd519 apply #7fffffff -> #7e03fcff | |
254 | ||
255 | decd520 apply -Infinity -> #f8000000 | |
256 | decd521 apply #f8787878 -> #f8000000 | |
257 | decd522 apply #f8000000 -> -Infinity | |
258 | decd523 apply #f9797979 -> #f8000000 | |
259 | decd524 apply #f9000000 -> -Infinity | |
260 | decd525 apply #fa7a7a7a -> #f8000000 | |
261 | decd526 apply #fa000000 -> -Infinity | |
262 | decd527 apply #fb7b7b7b -> #f8000000 | |
263 | decd528 apply #fb000000 -> -Infinity | |
264 | ||
265 | decd529 apply -NaN -> #fc000000 | |
266 | decd530 apply #fc7c7c7c -> #fc0c7c7c | |
267 | decd531 apply #fc000000 -> -NaN | |
268 | decd532 apply #fd7d7d7d -> #fc0d7d7d | |
269 | decd533 apply #fd000000 -> -NaN | |
270 | decd534 apply #fe7e7e7e -> #fe0e7c7e | |
271 | decd535 apply #fe000000 -> -sNaN | |
272 | decd536 apply #ff7f7f7f -> #fe0f7c7f | |
273 | decd537 apply #ff000000 -> -sNaN | |
274 | decd538 apply #ffffffff -> -sNaN999999 | |
275 | decd539 apply #ffffffff -> #fe03fcff | |
276 | ||
277 | -- diagnostic NaNs | |
278 | decd540 apply NaN -> #7c000000 | |
279 | decd541 apply NaN0 -> #7c000000 | |
280 | decd542 apply NaN1 -> #7c000001 | |
281 | decd543 apply NaN12 -> #7c000012 | |
282 | decd544 apply NaN79 -> #7c000079 | |
283 | decd545 apply NaN12345 -> #7c0049c5 | |
284 | decd546 apply NaN123456 -> #7c028e56 | |
285 | decd547 apply NaN799799 -> #7c0f7fdf | |
286 | decd548 apply NaN999999 -> #7c03fcff | |
287 | decd549 apply NaN1234567 -> #7c000000 -- too many digits | |
288 | ||
289 | ||
290 | -- fold-down full sequence | |
291 | decd601 apply 1E+96 -> #47f00000 Clamped | |
292 | decd602 apply #47f00000 -> 1.000000E+96 | |
293 | decd603 apply 1E+95 -> #43f20000 Clamped | |
294 | decd604 apply #43f20000 -> 1.00000E+95 | |
295 | decd605 apply 1E+94 -> #43f04000 Clamped | |
296 | decd606 apply #43f04000 -> 1.0000E+94 | |
297 | decd607 apply 1E+93 -> #43f00400 Clamped | |
298 | decd608 apply #43f00400 -> 1.000E+93 | |
299 | decd609 apply 1E+92 -> #43f00080 Clamped | |
300 | decd610 apply #43f00080 -> 1.00E+92 | |
301 | decd611 apply 1E+91 -> #43f00010 Clamped | |
302 | decd612 apply #43f00010 -> 1.0E+91 | |
303 | decd613 apply 1E+90 -> #43f00001 | |
304 | decd614 apply #43f00001 -> 1E+90 | |
305 | ||
306 | ||
307 | -- Selected DPD codes | |
308 | decd700 apply #22500000 -> 0 | |
309 | decd701 apply #22500009 -> 9 | |
310 | decd702 apply #22500010 -> 10 | |
311 | decd703 apply #22500019 -> 19 | |
312 | decd704 apply #22500020 -> 20 | |
313 | decd705 apply #22500029 -> 29 | |
314 | decd706 apply #22500030 -> 30 | |
315 | decd707 apply #22500039 -> 39 | |
316 | decd708 apply #22500040 -> 40 | |
317 | decd709 apply #22500049 -> 49 | |
318 | decd710 apply #22500050 -> 50 | |
319 | decd711 apply #22500059 -> 59 | |
320 | decd712 apply #22500060 -> 60 | |
321 | decd713 apply #22500069 -> 69 | |
322 | decd714 apply #22500070 -> 70 | |
323 | decd715 apply #22500071 -> 71 | |
324 | decd716 apply #22500072 -> 72 | |
325 | decd717 apply #22500073 -> 73 | |
326 | decd718 apply #22500074 -> 74 | |
327 | decd719 apply #22500075 -> 75 | |
328 | decd720 apply #22500076 -> 76 | |
329 | decd721 apply #22500077 -> 77 | |
330 | decd722 apply #22500078 -> 78 | |
331 | decd723 apply #22500079 -> 79 | |
332 | ||
333 | decd730 apply #2250029e -> 994 | |
334 | decd731 apply #2250029f -> 995 | |
335 | decd732 apply #225002a0 -> 520 | |
336 | decd733 apply #225002a1 -> 521 | |
337 | ||
338 | -- DPD: one of each of the huffman groups | |
339 | decd740 apply #225003f7 -> 777 | |
340 | decd741 apply #225003f8 -> 778 | |
341 | decd742 apply #225003eb -> 787 | |
342 | decd743 apply #2250037d -> 877 | |
343 | decd744 apply #2250039f -> 997 | |
344 | decd745 apply #225003bf -> 979 | |
345 | decd746 apply #225003df -> 799 | |
346 | decd747 apply #2250006e -> 888 | |
347 | ||
348 | ||
349 | -- DPD all-highs cases (includes the 24 redundant codes) | |
350 | decd750 apply #2250006e -> 888 | |
351 | decd751 apply #2250016e -> 888 | |
352 | decd752 apply #2250026e -> 888 | |
353 | decd753 apply #2250036e -> 888 | |
354 | decd754 apply #2250006f -> 889 | |
355 | decd755 apply #2250016f -> 889 | |
356 | decd756 apply #2250026f -> 889 | |
357 | decd757 apply #2250036f -> 889 | |
358 | ||
359 | decd760 apply #2250007e -> 898 | |
360 | decd761 apply #2250017e -> 898 | |
361 | decd762 apply #2250027e -> 898 | |
362 | decd763 apply #2250037e -> 898 | |
363 | decd764 apply #2250007f -> 899 | |
364 | decd765 apply #2250017f -> 899 | |
365 | decd766 apply #2250027f -> 899 | |
366 | decd767 apply #2250037f -> 899 | |
367 | ||
368 | decd770 apply #225000ee -> 988 | |
369 | decd771 apply #225001ee -> 988 | |
370 | decd772 apply #225002ee -> 988 | |
371 | decd773 apply #225003ee -> 988 | |
372 | decd774 apply #225000ef -> 989 | |
373 | decd775 apply #225001ef -> 989 | |
374 | decd776 apply #225002ef -> 989 | |
375 | decd777 apply #225003ef -> 989 | |
376 | ||
377 | decd780 apply #225000fe -> 998 | |
378 | decd781 apply #225001fe -> 998 | |
379 | decd782 apply #225002fe -> 998 | |
380 | decd783 apply #225003fe -> 998 | |
381 | decd784 apply #225000ff -> 999 | |
382 | decd785 apply #225001ff -> 999 | |
383 | decd786 apply #225002ff -> 999 | |
384 | decd787 apply #225003ff -> 999 | |
385 |