PageRenderTime 37ms CodeModel.GetById 20ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Lib/test/decimaltestdata/min.decTest

http://unladen-swallow.googlecode.com/
Unknown | 407 lines | 380 code | 27 blank | 0 comment | 0 complexity | b6f194e145756ba40f6f97e1c220c510 MD5 | raw file
  1------------------------------------------------------------------------
  2-- min.decTest -- decimal minimum                                     --
  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.58
 21
 22-- we assume that base comparison is tested in compare.decTest, so
 23-- these mainly cover special cases and rounding
 24
 25extended:    1
 26precision:   9
 27rounding:    half_up
 28maxExponent: 384
 29minexponent: -383
 30
 31-- sanity checks
 32mnmx001 min  -2  -2  -> -2
 33mnmx002 min  -2  -1  -> -2
 34mnmx003 min  -2   0  -> -2
 35mnmx004 min  -2   1  -> -2
 36mnmx005 min  -2   2  -> -2
 37mnmx006 min  -1  -2  -> -2
 38mnmx007 min  -1  -1  -> -1
 39mnmx008 min  -1   0  -> -1
 40mnmx009 min  -1   1  -> -1
 41mnmx010 min  -1   2  -> -1
 42mnmx011 min   0  -2  -> -2
 43mnmx012 min   0  -1  -> -1
 44mnmx013 min   0   0  ->  0
 45mnmx014 min   0   1  ->  0
 46mnmx015 min   0   2  ->  0
 47mnmx016 min   1  -2  -> -2
 48mnmx017 min   1  -1  -> -1
 49mnmx018 min   1   0  ->  0
 50mnmx019 min   1   1  ->  1
 51mnmx020 min   1   2  ->  1
 52mnmx021 min   2  -2  -> -2
 53mnmx022 min   2  -1  -> -1
 54mnmx023 min   2   0  ->  0
 55mnmx025 min   2   1  ->  1
 56mnmx026 min   2   2  ->  2
 57
 58-- extended zeros
 59mnmx030 min   0     0   ->  0
 60mnmx031 min   0    -0   -> -0
 61mnmx032 min   0    -0.0 -> -0.0
 62mnmx033 min   0     0.0 ->  0.0
 63mnmx034 min  -0     0   -> -0
 64mnmx035 min  -0    -0   -> -0
 65mnmx036 min  -0    -0.0 -> -0
 66mnmx037 min  -0     0.0 -> -0
 67mnmx038 min   0.0   0   ->  0.0
 68mnmx039 min   0.0  -0   -> -0
 69mnmx040 min   0.0  -0.0 -> -0.0
 70mnmx041 min   0.0   0.0 ->  0.0
 71mnmx042 min  -0.0   0   -> -0.0
 72mnmx043 min  -0.0  -0   -> -0
 73mnmx044 min  -0.0  -0.0 -> -0.0
 74mnmx045 min  -0.0   0.0 -> -0.0
 75
 76mnmx046 min   0E1  -0E1 -> -0E+1
 77mnmx047 min  -0E1   0E2 -> -0E+1
 78mnmx048 min   0E2   0E1 ->  0E+1
 79mnmx049 min   0E1   0E2 ->  0E+1
 80mnmx050 min  -0E3  -0E2 -> -0E+3
 81mnmx051 min  -0E2  -0E3 -> -0E+3
 82
 83-- Specials
 84precision: 9
 85mnmx090 min  Inf  -Inf   -> -Infinity
 86mnmx091 min  Inf  -1000  -> -1000
 87mnmx092 min  Inf  -1     -> -1
 88mnmx093 min  Inf  -0     -> -0
 89mnmx094 min  Inf   0     ->  0
 90mnmx095 min  Inf   1     ->  1
 91mnmx096 min  Inf   1000  ->  1000
 92mnmx097 min  Inf   Inf   ->  Infinity
 93mnmx098 min -1000  Inf   -> -1000
 94mnmx099 min -Inf   Inf   -> -Infinity
 95mnmx100 min -1     Inf   -> -1
 96mnmx101 min -0     Inf   -> -0
 97mnmx102 min  0     Inf   ->  0
 98mnmx103 min  1     Inf   ->  1
 99mnmx104 min  1000  Inf   ->  1000
100mnmx105 min  Inf   Inf   ->  Infinity
101
102mnmx120 min -Inf  -Inf   -> -Infinity
103mnmx121 min -Inf  -1000  -> -Infinity
104mnmx122 min -Inf  -1     -> -Infinity
105mnmx123 min -Inf  -0     -> -Infinity
106mnmx124 min -Inf   0     -> -Infinity
107mnmx125 min -Inf   1     -> -Infinity
108mnmx126 min -Inf   1000  -> -Infinity
109mnmx127 min -Inf   Inf   -> -Infinity
110mnmx128 min -Inf  -Inf   -> -Infinity
111mnmx129 min -1000 -Inf   -> -Infinity
112mnmx130 min -1    -Inf   -> -Infinity
113mnmx131 min -0    -Inf   -> -Infinity
114mnmx132 min  0    -Inf   -> -Infinity
115mnmx133 min  1    -Inf   -> -Infinity
116mnmx134 min  1000 -Inf   -> -Infinity
117mnmx135 min  Inf  -Inf   -> -Infinity
118
119-- 2004.08.02 754r chooses number over NaN in mixed cases
120mnmx141 min  NaN -Inf    ->  -Infinity
121mnmx142 min  NaN -1000   ->  -1000
122mnmx143 min  NaN -1      ->  -1
123mnmx144 min  NaN -0      ->  -0
124mnmx145 min  NaN  0      ->  0
125mnmx146 min  NaN  1      ->  1
126mnmx147 min  NaN  1000   ->  1000
127mnmx148 min  NaN  Inf    ->  Infinity
128mnmx149 min  NaN  NaN    ->  NaN
129mnmx150 min -Inf  NaN    -> -Infinity
130mnmx151 min -1000 NaN    -> -1000
131mnmx152 min -1   -NaN    -> -1
132mnmx153 min -0    NaN    -> -0
133mnmx154 min  0   -NaN    ->  0
134mnmx155 min  1    NaN    ->  1
135mnmx156 min  1000 NaN    ->  1000
136mnmx157 min  Inf  NaN    ->  Infinity
137
138mnmx161 min  sNaN -Inf   ->  NaN  Invalid_operation
139mnmx162 min  sNaN -1000  ->  NaN  Invalid_operation
140mnmx163 min  sNaN -1     ->  NaN  Invalid_operation
141mnmx164 min  sNaN -0     ->  NaN  Invalid_operation
142mnmx165 min -sNaN  0     -> -NaN  Invalid_operation
143mnmx166 min -sNaN  1     -> -NaN  Invalid_operation
144mnmx167 min  sNaN  1000  ->  NaN  Invalid_operation
145mnmx168 min  sNaN  NaN   ->  NaN  Invalid_operation
146mnmx169 min  sNaN sNaN   ->  NaN  Invalid_operation
147mnmx170 min  NaN  sNaN   ->  NaN  Invalid_operation
148mnmx171 min -Inf  sNaN   ->  NaN  Invalid_operation
149mnmx172 min -1000 sNaN   ->  NaN  Invalid_operation
150mnmx173 min -1    sNaN   ->  NaN  Invalid_operation
151mnmx174 min -0    sNaN   ->  NaN  Invalid_operation
152mnmx175 min  0    sNaN   ->  NaN  Invalid_operation
153mnmx176 min  1    sNaN   ->  NaN  Invalid_operation
154mnmx177 min  1000 sNaN   ->  NaN  Invalid_operation
155mnmx178 min  Inf  sNaN   ->  NaN  Invalid_operation
156mnmx179 min  NaN  sNaN   ->  NaN  Invalid_operation
157
158-- propagating NaNs
159mnmx181 min  NaN9   -Inf   -> -Infinity
160mnmx182 min -NaN8    9990  ->  9990
161mnmx183 min  NaN71   Inf   ->  Infinity
162
163mnmx184 min  NaN1    NaN54 ->  NaN1
164mnmx185 min  NaN22  -NaN53 ->  NaN22
165mnmx186 min -NaN3    NaN6  -> -NaN3
166mnmx187 min -NaN44   NaN7  -> -NaN44
167
168mnmx188 min -Inf     NaN41 -> -Infinity
169mnmx189 min -9999   -NaN33 -> -9999
170mnmx190 min  Inf     NaN2  ->  Infinity
171
172mnmx191 min  sNaN99 -Inf    ->  NaN99 Invalid_operation
173mnmx192 min  sNaN98 -11     ->  NaN98 Invalid_operation
174mnmx193 min -sNaN97  NaN8   -> -NaN97 Invalid_operation
175mnmx194 min  sNaN69 sNaN94  ->  NaN69 Invalid_operation
176mnmx195 min  NaN95  sNaN93  ->  NaN93 Invalid_operation
177mnmx196 min -Inf    sNaN92  ->  NaN92 Invalid_operation
178mnmx197 min  088    sNaN91  ->  NaN91 Invalid_operation
179mnmx198 min  Inf   -sNaN90  -> -NaN90 Invalid_operation
180mnmx199 min  NaN    sNaN86  ->  NaN86 Invalid_operation
181
182-- rounding checks -- chosen is rounded, or not
183maxExponent: 999
184minexponent: -999
185precision: 9
186mnmx201 min -12345678000 1  -> -1.23456780E+10 Rounded
187mnmx202 min 1 -12345678000  -> -1.23456780E+10 Rounded
188mnmx203 min -1234567800  1  -> -1.23456780E+9 Rounded
189mnmx204 min 1 -1234567800   -> -1.23456780E+9 Rounded
190mnmx205 min -1234567890  1  -> -1.23456789E+9 Rounded
191mnmx206 min 1 -1234567890   -> -1.23456789E+9 Rounded
192mnmx207 min -1234567891  1  -> -1.23456789E+9 Inexact Rounded
193mnmx208 min 1 -1234567891   -> -1.23456789E+9 Inexact Rounded
194mnmx209 min -12345678901 1  -> -1.23456789E+10 Inexact Rounded
195mnmx210 min 1 -12345678901  -> -1.23456789E+10 Inexact Rounded
196mnmx211 min -1234567896  1  -> -1.23456790E+9 Inexact Rounded
197mnmx212 min 1 -1234567896   -> -1.23456790E+9 Inexact Rounded
198mnmx213 min 1234567891  1   -> 1
199mnmx214 min 1 1234567891    -> 1
200mnmx215 min 12345678901 1   -> 1
201mnmx216 min 1 12345678901   -> 1
202mnmx217 min 1234567896  1   -> 1
203mnmx218 min 1 1234567896    -> 1
204
205precision: 15
206mnmx221 min -12345678000 1  -> -12345678000
207mnmx222 min 1 -12345678000  -> -12345678000
208mnmx223 min -1234567800  1  -> -1234567800
209mnmx224 min 1 -1234567800   -> -1234567800
210mnmx225 min -1234567890  1  -> -1234567890
211mnmx226 min 1 -1234567890   -> -1234567890
212mnmx227 min -1234567891  1  -> -1234567891
213mnmx228 min 1 -1234567891   -> -1234567891
214mnmx229 min -12345678901 1  -> -12345678901
215mnmx230 min 1 -12345678901  -> -12345678901
216mnmx231 min -1234567896  1  -> -1234567896
217mnmx232 min 1 -1234567896   -> -1234567896
218mnmx233 min 1234567891  1   -> 1
219mnmx234 min 1 1234567891    -> 1
220mnmx235 min 12345678901 1   -> 1
221mnmx236 min 1 12345678901   -> 1
222mnmx237 min 1234567896  1   -> 1
223mnmx238 min 1 1234567896    -> 1
224
225-- from examples
226mnmx280 min '3'   '2'  ->  '2'
227mnmx281 min '-10' '3'  ->  '-10'
228mnmx282 min '1.0' '1'  ->  '1.0'
229mnmx283 min '1' '1.0'  ->  '1.0'
230mnmx284 min '7' 'NaN'  ->  '7'
231
232-- overflow and underflow tests .. subnormal results [inputs] now allowed
233maxExponent: 999999999
234minexponent: -999999999
235mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999
236mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999
237mnmx332 min -0.100 -9E-999999999               -> -0.100
238mnmx333 min -9E-999999999 -0.100               -> -0.100
239mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999
240mnmx336 min -9E+999999999 1.23456789012345E-0  -> -9E+999999999
241mnmx337 min +0.100 -9E-999999999               -> -9E-999999999
242mnmx338 min -9E-999999999 0.100                -> -9E-999999999
243
244mnmx339 min -1e-599999999 -1e-400000001   ->  -1E-400000001
245mnmx340 min -1e-599999999 -1e-400000000   ->  -1E-400000000
246mnmx341 min -1e-600000000 -1e-400000000   ->  -1E-400000000
247mnmx342 min -9e-999999998 -0.01           ->  -0.01
248mnmx343 min -9e-999999998 -0.1            ->  -0.1
249mnmx344 min -0.01         -9e-999999998   ->  -0.01
250mnmx345 min -1e599999999  -1e400000001    ->  -1E+599999999
251mnmx346 min -1e599999999  -1e400000000    ->  -1E+599999999
252mnmx347 min -1e600000000  -1e400000000    ->  -1E+600000000
253mnmx348 min -9e999999998  -100            ->  -9E+999999998
254mnmx349 min -9e999999998  -10             ->  -9E+999999998
255mnmx350 min -100          -9e999999998    ->  -9E+999999998
256-- signs
257mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777
258mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777
259mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111
260mnmx354 min +1e+777777777 +1e+411111111 ->  1E+411111111
261mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111
262mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777
263mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111
264mnmx358 min +1e-777777777 +1e-411111111 ->  1E-777777777
265
266-- expanded list from min/max 754r purple prose
267-- [explicit tests for exponent ordering]
268mnmx401 min  Inf    1.1     ->  1.1
269mnmx402 min  1.1    1       ->  1
270mnmx403 min  1      1.0     ->  1.0
271mnmx404 min  1.0    0.1     ->  0.1
272mnmx405 min  0.1    0.10    ->  0.10
273mnmx406 min  0.10   0.100   ->  0.100
274mnmx407 min  0.10   0       ->  0
275mnmx408 min  0      0.0     ->  0.0
276mnmx409 min  0.0   -0       -> -0
277mnmx410 min  0.0   -0.0     -> -0.0
278mnmx411 min  0.00  -0.0     -> -0.0
279mnmx412 min  0.0   -0.00    -> -0.00
280mnmx413 min  0     -0.0     -> -0.0
281mnmx414 min  0     -0       -> -0
282mnmx415 min -0.0   -0       -> -0
283mnmx416 min -0     -0.100   -> -0.100
284mnmx417 min -0.100 -0.10    -> -0.10
285mnmx418 min -0.10  -0.1     -> -0.1
286mnmx419 min -0.1   -1.0     -> -1.0
287mnmx420 min -1.0   -1       -> -1
288mnmx421 min -1     -1.1     -> -1.1
289mnmx423 min -1.1   -Inf     -> -Infinity
290-- same with operands reversed
291mnmx431 min  1.1    Inf     ->  1.1
292mnmx432 min  1      1.1     ->  1
293mnmx433 min  1.0    1       ->  1.0
294mnmx434 min  0.1    1.0     ->  0.1
295mnmx435 min  0.10   0.1     ->  0.10
296mnmx436 min  0.100  0.10    ->  0.100
297mnmx437 min  0      0.10    ->  0
298mnmx438 min  0.0    0       ->  0.0
299mnmx439 min -0      0.0     -> -0
300mnmx440 min -0.0    0.0     -> -0.0
301mnmx441 min -0.0    0.00    -> -0.0
302mnmx442 min -0.00   0.0     -> -0.00
303mnmx443 min -0.0    0       -> -0.0
304mnmx444 min -0      0       -> -0
305mnmx445 min -0     -0.0     -> -0
306mnmx446 min -0.100 -0       -> -0.100
307mnmx447 min -0.10  -0.100   -> -0.10
308mnmx448 min -0.1   -0.10    -> -0.1
309mnmx449 min -1.0   -0.1     -> -1.0
310mnmx450 min -1     -1.0     -> -1
311mnmx451 min -1.1   -1       -> -1.1
312mnmx453 min -Inf   -1.1     -> -Infinity
313-- largies
314mnmx460 min  1000   1E+3    ->  1000
315mnmx461 min  1E+3   1000    ->  1000
316mnmx462 min  1000  -1E+3    -> -1E+3
317mnmx463 min  1E+3  -1000    -> -1000
318mnmx464 min -1000   1E+3    -> -1000
319mnmx465 min -1E+3   1000    -> -1E+3
320mnmx466 min -1000  -1E+3    -> -1E+3
321mnmx467 min -1E+3  -1000    -> -1E+3
322
323-- rounding (results treated as though plus)
324maxexponent: 999999999
325minexponent: -999999999
326precision: 3
327
328mnmx470 min  1      5      ->  1
329mnmx471 min  10     50     ->  10
330mnmx472 min  100    500    ->  100
331mnmx473 min  1000   5000   ->  1.00E+3 Rounded
332mnmx474 min  10000  50000  ->  1.00E+4 Rounded
333mnmx475 min  6      50     ->  6
334mnmx476 min  66     500    ->  66
335mnmx477 min  666    5000   ->  666
336mnmx478 min  6666   50000  ->  6.67E+3 Rounded Inexact
337mnmx479 min  66666  500000 ->  6.67E+4 Rounded Inexact
338mnmx480 min  33333  500000 ->  3.33E+4 Rounded Inexact
339mnmx481 min  75401  1      ->  1
340mnmx482 min  75402  10     ->  10
341mnmx483 min  75403  100    ->  100
342mnmx484 min  75404  1000   ->  1.00E+3 Rounded
343mnmx485 min  75405  10000  ->  1.00E+4 Rounded
344mnmx486 min  75406  6      ->  6
345mnmx487 min  75407  66     ->  66
346mnmx488 min  75408  666    ->  666
347mnmx489 min  75409  6666   ->  6.67E+3 Rounded Inexact
348mnmx490 min  75410  66666  ->  6.67E+4 Rounded Inexact
349mnmx491 min  75411  33333  ->  3.33E+4 Rounded Inexact
350
351
352-- overflow tests
353maxexponent: 999999999
354minexponent: -999999999
355precision: 3
356mnmx500 min 9.999E+999999999  0 ->  0
357mnmx501 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded
358
359-- subnormals and underflow
360precision: 3
361maxexponent: 999
362minexponent: -999
363mnmx510 min  1.00E-999       0  ->   0
364mnmx511 min  0.1E-999        0  ->   0
365mnmx512 min  0.10E-999       0  ->   0
366mnmx513 min  0.100E-999      0  ->   0
367mnmx514 min  0.01E-999       0  ->   0
368mnmx515 min  0.999E-999      0  ->   0
369mnmx516 min  0.099E-999      0  ->   0
370mnmx517 min  0.009E-999      0  ->   0
371mnmx518 min  0.001E-999      0  ->   0
372mnmx519 min  0.0009E-999     0  ->   0
373mnmx520 min  0.0001E-999     0  ->   0
374
375mnmx530 min -1.00E-999       0  ->  -1.00E-999
376mnmx531 min -0.1E-999        0  ->  -1E-1000   Subnormal
377mnmx532 min -0.10E-999       0  ->  -1.0E-1000 Subnormal
378mnmx533 min -0.100E-999      0  ->  -1.0E-1000 Subnormal Rounded
379mnmx534 min -0.01E-999       0  ->  -1E-1001   Subnormal
380-- next is rounded to Nmin
381mnmx535 min -0.999E-999      0  ->  -1.00E-999 Inexact Rounded Subnormal Underflow
382mnmx536 min -0.099E-999      0  ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
383mnmx537 min -0.009E-999      0  ->  -1E-1001   Inexact Rounded Subnormal Underflow
384mnmx538 min -0.001E-999      0  ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
385mnmx539 min -0.0009E-999     0  ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
386mnmx540 min -0.0001E-999     0  ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
387
388-- misalignment traps for little-endian
389precision: 9
390mnmx551 min      1.0       0.1  -> 0.1
391mnmx552 min      0.1       1.0  -> 0.1
392mnmx553 min     10.0       0.1  -> 0.1
393mnmx554 min      0.1      10.0  -> 0.1
394mnmx555 min      100       1.0  -> 1.0
395mnmx556 min      1.0       100  -> 1.0
396mnmx557 min     1000      10.0  -> 10.0
397mnmx558 min     10.0      1000  -> 10.0
398mnmx559 min    10000     100.0  -> 100.0
399mnmx560 min    100.0     10000  -> 100.0
400mnmx561 min   100000    1000.0  -> 1000.0
401mnmx562 min   1000.0    100000  -> 1000.0
402mnmx563 min  1000000   10000.0  -> 10000.0
403mnmx564 min  10000.0   1000000  -> 10000.0
404
405-- Null tests
406mnm900 min 10  # -> NaN Invalid_operation
407mnm901 min  # 10 -> NaN Invalid_operation