PageRenderTime 407ms CodeModel.GetById 181ms app.highlight 4ms RepoModel.GetById 217ms app.codeStats 1ms

/Lib/test/decimaltestdata/minmag.decTest

http://unladen-swallow.googlecode.com/
Unknown | 390 lines | 363 code | 27 blank | 0 comment | 0 complexity | 60150947be5e712e689b064d9134f8a8 MD5 | raw file
  1------------------------------------------------------------------------
  2-- minmag.decTest -- decimal minimum by magnitude                     --
  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
 32mngx001 minmag  -2  -2  -> -2
 33mngx002 minmag  -2  -1  -> -1
 34mngx003 minmag  -2   0  ->  0
 35mngx004 minmag  -2   1  ->  1
 36mngx005 minmag  -2   2  -> -2
 37mngx006 minmag  -1  -2  -> -1
 38mngx007 minmag  -1  -1  -> -1
 39mngx008 minmag  -1   0  ->  0
 40mngx009 minmag  -1   1  -> -1
 41mngx010 minmag  -1   2  -> -1
 42mngx011 minmag   0  -2  ->  0
 43mngx012 minmag   0  -1  ->  0
 44mngx013 minmag   0   0  ->  0
 45mngx014 minmag   0   1  ->  0
 46mngx015 minmag   0   2  ->  0
 47mngx016 minmag   1  -2  ->  1
 48mngx017 minmag   1  -1  -> -1
 49mngx018 minmag   1   0  ->  0
 50mngx019 minmag   1   1  ->  1
 51mngx020 minmag   1   2  ->  1
 52mngx021 minmag   2  -2  -> -2
 53mngx022 minmag   2  -1  -> -1
 54mngx023 minmag   2   0  ->  0
 55mngx025 minmag   2   1  ->  1
 56mngx026 minmag   2   2  ->  2
 57
 58-- extended zeros
 59mngx030 minmag   0     0   ->  0
 60mngx031 minmag   0    -0   -> -0
 61mngx032 minmag   0    -0.0 -> -0.0
 62mngx033 minmag   0     0.0 ->  0.0
 63mngx034 minmag  -0     0   -> -0
 64mngx035 minmag  -0    -0   -> -0
 65mngx036 minmag  -0    -0.0 -> -0
 66mngx037 minmag  -0     0.0 -> -0
 67mngx038 minmag   0.0   0   ->  0.0
 68mngx039 minmag   0.0  -0   -> -0
 69mngx040 minmag   0.0  -0.0 -> -0.0
 70mngx041 minmag   0.0   0.0 ->  0.0
 71mngx042 minmag  -0.0   0   -> -0.0
 72mngx043 minmag  -0.0  -0   -> -0
 73mngx044 minmag  -0.0  -0.0 -> -0.0
 74mngx045 minmag  -0.0   0.0 -> -0.0
 75
 76mngx046 minmag   0E1  -0E1 -> -0E+1
 77mngx047 minmag  -0E1   0E2 -> -0E+1
 78mngx048 minmag   0E2   0E1 ->  0E+1
 79mngx049 minmag   0E1   0E2 ->  0E+1
 80mngx050 minmag  -0E3  -0E2 -> -0E+3
 81mngx051 minmag  -0E2  -0E3 -> -0E+3
 82
 83-- Specials
 84precision: 9
 85mngx090 minmag  Inf  -Inf   -> -Infinity
 86mngx091 minmag  Inf  -1000  -> -1000
 87mngx092 minmag  Inf  -1     -> -1
 88mngx093 minmag  Inf  -0     -> -0
 89mngx094 minmag  Inf   0     ->  0
 90mngx095 minmag  Inf   1     ->  1
 91mngx096 minmag  Inf   1000  ->  1000
 92mngx097 minmag  Inf   Inf   ->  Infinity
 93mngx098 minmag -1000  Inf   -> -1000
 94mngx099 minmag -Inf   Inf   -> -Infinity
 95mngx100 minmag -1     Inf   -> -1
 96mngx101 minmag -0     Inf   -> -0
 97mngx102 minmag  0     Inf   ->  0
 98mngx103 minmag  1     Inf   ->  1
 99mngx104 minmag  1000  Inf   ->  1000
100mngx105 minmag  Inf   Inf   ->  Infinity
101
102mngx120 minmag -Inf  -Inf   -> -Infinity
103mngx121 minmag -Inf  -1000  -> -1000
104mngx122 minmag -Inf  -1     -> -1
105mngx123 minmag -Inf  -0     -> -0
106mngx124 minmag -Inf   0     ->  0
107mngx125 minmag -Inf   1     ->  1
108mngx126 minmag -Inf   1000  ->  1000
109mngx127 minmag -Inf   Inf   -> -Infinity
110mngx128 minmag -Inf  -Inf   -> -Infinity
111mngx129 minmag -1000 -Inf   -> -1000
112mngx130 minmag -1    -Inf   -> -1
113mngx131 minmag -0    -Inf   -> -0
114mngx132 minmag  0    -Inf   ->  0
115mngx133 minmag  1    -Inf   ->  1
116mngx134 minmag  1000 -Inf   ->  1000
117mngx135 minmag  Inf  -Inf   -> -Infinity
118
119-- 2004.08.02 754r chooses number over NaN in mixed cases
120mngx141 minmag  NaN -Inf    ->  -Infinity
121mngx142 minmag  NaN -1000   ->  -1000
122mngx143 minmag  NaN -1      ->  -1
123mngx144 minmag  NaN -0      ->  -0
124mngx145 minmag  NaN  0      ->  0
125mngx146 minmag  NaN  1      ->  1
126mngx147 minmag  NaN  1000   ->  1000
127mngx148 minmag  NaN  Inf    ->  Infinity
128mngx149 minmag  NaN  NaN    ->  NaN
129mngx150 minmag -Inf  NaN    -> -Infinity
130mngx151 minmag -1000 NaN    -> -1000
131mngx152 minmag -1   -NaN    -> -1
132mngx153 minmag -0    NaN    -> -0
133mngx154 minmag  0   -NaN    ->  0
134mngx155 minmag  1    NaN    ->  1
135mngx156 minmag  1000 NaN    ->  1000
136mngx157 minmag  Inf  NaN    ->  Infinity
137
138mngx161 minmag  sNaN -Inf   ->  NaN  Invalid_operation
139mngx162 minmag  sNaN -1000  ->  NaN  Invalid_operation
140mngx163 minmag  sNaN -1     ->  NaN  Invalid_operation
141mngx164 minmag  sNaN -0     ->  NaN  Invalid_operation
142mngx165 minmag -sNaN  0     -> -NaN  Invalid_operation
143mngx166 minmag -sNaN  1     -> -NaN  Invalid_operation
144mngx167 minmag  sNaN  1000  ->  NaN  Invalid_operation
145mngx168 minmag  sNaN  NaN   ->  NaN  Invalid_operation
146mngx169 minmag  sNaN sNaN   ->  NaN  Invalid_operation
147mngx170 minmag  NaN  sNaN   ->  NaN  Invalid_operation
148mngx171 minmag -Inf  sNaN   ->  NaN  Invalid_operation
149mngx172 minmag -1000 sNaN   ->  NaN  Invalid_operation
150mngx173 minmag -1    sNaN   ->  NaN  Invalid_operation
151mngx174 minmag -0    sNaN   ->  NaN  Invalid_operation
152mngx175 minmag  0    sNaN   ->  NaN  Invalid_operation
153mngx176 minmag  1    sNaN   ->  NaN  Invalid_operation
154mngx177 minmag  1000 sNaN   ->  NaN  Invalid_operation
155mngx178 minmag  Inf  sNaN   ->  NaN  Invalid_operation
156mngx179 minmag  NaN  sNaN   ->  NaN  Invalid_operation
157
158-- propagating NaNs
159mngx181 minmag  NaN9   -Inf   -> -Infinity
160mngx182 minmag -NaN8    9990  ->  9990
161mngx183 minmag  NaN71   Inf   ->  Infinity
162
163mngx184 minmag  NaN1    NaN54 ->  NaN1
164mngx185 minmag  NaN22  -NaN53 ->  NaN22
165mngx186 minmag -NaN3    NaN6  -> -NaN3
166mngx187 minmag -NaN44   NaN7  -> -NaN44
167
168mngx188 minmag -Inf     NaN41 -> -Infinity
169mngx189 minmag -9999   -NaN33 -> -9999
170mngx190 minmag  Inf     NaN2  ->  Infinity
171
172mngx191 minmag  sNaN99 -Inf    ->  NaN99 Invalid_operation
173mngx192 minmag  sNaN98 -11     ->  NaN98 Invalid_operation
174mngx193 minmag -sNaN97  NaN8   -> -NaN97 Invalid_operation
175mngx194 minmag  sNaN69 sNaN94  ->  NaN69 Invalid_operation
176mngx195 minmag  NaN95  sNaN93  ->  NaN93 Invalid_operation
177mngx196 minmag -Inf    sNaN92  ->  NaN92 Invalid_operation
178mngx197 minmag  088    sNaN91  ->  NaN91 Invalid_operation
179mngx198 minmag  Inf   -sNaN90  -> -NaN90 Invalid_operation
180mngx199 minmag  NaN    sNaN86  ->  NaN86 Invalid_operation
181
182-- rounding checks -- chosen is rounded, or not
183maxExponent: 999
184minexponent: -999
185precision: 9
186mngx201 minmag -12345678000 1  -> 1
187mngx202 minmag 1 -12345678000  -> 1
188mngx203 minmag -1234567800  1  -> 1
189mngx204 minmag 1 -1234567800   -> 1
190mngx205 minmag -1234567890  1  -> 1
191mngx206 minmag 1 -1234567890   -> 1
192mngx207 minmag -1234567891  1  -> 1
193mngx208 minmag 1 -1234567891   -> 1
194mngx209 minmag -12345678901 1  -> 1
195mngx210 minmag 1 -12345678901  -> 1
196mngx211 minmag -1234567896  1  -> 1
197mngx212 minmag 1 -1234567896   -> 1
198mngx213 minmag 1234567891  1   -> 1
199mngx214 minmag 1 1234567891    -> 1
200mngx215 minmag 12345678901 1   -> 1
201mngx216 minmag 1 12345678901   -> 1
202mngx217 minmag 1234567896  1   -> 1
203mngx218 minmag 1 1234567896    -> 1
204
205precision: 15
206mngx221 minmag -12345678000 1  -> 1
207mngx222 minmag 1 -12345678000  -> 1
208mngx223 minmag -1234567800  1  -> 1
209mngx224 minmag 1 -1234567800   -> 1
210mngx225 minmag -1234567890  1  -> 1
211mngx226 minmag 1 -1234567890   -> 1
212mngx227 minmag -1234567891  1  -> 1
213mngx228 minmag 1 -1234567891   -> 1
214mngx229 minmag -12345678901 1  -> 1
215mngx230 minmag 1 -12345678901  -> 1
216mngx231 minmag -1234567896  1  -> 1
217mngx232 minmag 1 -1234567896   -> 1
218mngx233 minmag 1234567891  1   -> 1
219mngx234 minmag 1 1234567891    -> 1
220mngx235 minmag 12345678901 1   -> 1
221mngx236 minmag 1 12345678901   -> 1
222mngx237 minmag 1234567896  1   -> 1
223mngx238 minmag 1 1234567896    -> 1
224
225-- from examples
226mngx280 minmag '3'   '2'  ->  '2'
227mngx281 minmag '-10' '3'  ->  '3'
228mngx282 minmag '1.0' '1'  ->  '1.0'
229mngx283 minmag '1' '1.0'  ->  '1.0'
230mngx284 minmag '7' 'NaN'  ->  '7'
231
232-- overflow and underflow tests .. subnormal results [inputs] now allowed
233maxExponent: 999999999
234minexponent: -999999999
235mngx330 minmag -1.23456789012345E-0 -9E+999999999 -> -1.23456789012345
236mngx331 minmag -9E+999999999 -1.23456789012345E-0 -> -1.23456789012345
237mngx332 minmag -0.100 -9E-999999999               -> -9E-999999999
238mngx333 minmag -9E-999999999 -0.100               -> -9E-999999999
239mngx335 minmag +1.23456789012345E-0 -9E+999999999 ->  1.23456789012345
240mngx336 minmag -9E+999999999 1.23456789012345E-0  ->  1.23456789012345
241mngx337 minmag +0.100 -9E-999999999               -> -9E-999999999
242mngx338 minmag -9E-999999999 0.100                -> -9E-999999999
243
244mngx339 minmag -1e-599999999 -1e-400000001   ->  -1E-599999999
245mngx340 minmag -1e-599999999 -1e-400000000   ->  -1E-599999999
246mngx341 minmag -1e-600000000 -1e-400000000   ->  -1E-600000000
247mngx342 minmag -9e-999999998 -0.01           ->  -9E-999999998
248mngx343 minmag -9e-999999998 -0.1            ->  -9E-999999998
249mngx344 minmag -0.01         -9e-999999998   ->  -9E-999999998
250mngx345 minmag -1e599999999  -1e400000001    ->  -1E+400000001
251mngx346 minmag -1e599999999  -1e400000000    ->  -1E+400000000
252mngx347 minmag -1e600000000  -1e400000000    ->  -1E+400000000
253mngx348 minmag -9e999999998  -100            ->  -100
254mngx349 minmag -9e999999998  -10             ->  -10
255mngx350 minmag -100          -9e999999998    ->  -100
256-- signs
257mngx351 minmag -1e+777777777 -1e+411111111 -> -1E+411111111
258mngx352 minmag -1e+777777777 +1e+411111111 ->  1E+411111111
259mngx353 minmag +1e+777777777 -1e+411111111 -> -1E+411111111
260mngx354 minmag +1e+777777777 +1e+411111111 ->  1E+411111111
261mngx355 minmag -1e-777777777 -1e-411111111 -> -1E-777777777
262mngx356 minmag -1e-777777777 +1e-411111111 -> -1E-777777777
263mngx357 minmag +1e-777777777 -1e-411111111 ->  1E-777777777
264mngx358 minmag +1e-777777777 +1e-411111111 ->  1E-777777777
265
266-- expanded list from min/max 754r purple prose
267-- [explicit tests for exponent ordering]
268mngx401 minmag  Inf    1.1     ->  1.1
269mngx402 minmag  1.1    1       ->  1
270mngx403 minmag  1      1.0     ->  1.0
271mngx404 minmag  1.0    0.1     ->  0.1
272mngx405 minmag  0.1    0.10    ->  0.10
273mngx406 minmag  0.10   0.100   ->  0.100
274mngx407 minmag  0.10   0       ->  0
275mngx408 minmag  0      0.0     ->  0.0
276mngx409 minmag  0.0   -0       -> -0
277mngx410 minmag  0.0   -0.0     -> -0.0
278mngx411 minmag  0.00  -0.0     -> -0.0
279mngx412 minmag  0.0   -0.00    -> -0.00
280mngx413 minmag  0     -0.0     -> -0.0
281mngx414 minmag  0     -0       -> -0
282mngx415 minmag -0.0   -0       -> -0
283mngx416 minmag -0     -0.100   -> -0
284mngx417 minmag -0.100 -0.10    -> -0.10
285mngx418 minmag -0.10  -0.1     -> -0.1
286mngx419 minmag -0.1   -1.0     -> -0.1
287mngx420 minmag -1.0   -1       -> -1
288mngx421 minmag -1     -1.1     -> -1
289mngx423 minmag -1.1   -Inf     -> -1.1
290-- same with operands reversed
291mngx431 minmag  1.1    Inf     ->  1.1
292mngx432 minmag  1      1.1     ->  1
293mngx433 minmag  1.0    1       ->  1.0
294mngx434 minmag  0.1    1.0     ->  0.1
295mngx435 minmag  0.10   0.1     ->  0.10
296mngx436 minmag  0.100  0.10    ->  0.100
297mngx437 minmag  0      0.10    ->  0
298mngx438 minmag  0.0    0       ->  0.0
299mngx439 minmag -0      0.0     -> -0
300mngx440 minmag -0.0    0.0     -> -0.0
301mngx441 minmag -0.0    0.00    -> -0.0
302mngx442 minmag -0.00   0.0     -> -0.00
303mngx443 minmag -0.0    0       -> -0.0
304mngx444 minmag -0      0       -> -0
305mngx445 minmag -0     -0.0     -> -0
306mngx446 minmag -0.100 -0       -> -0
307mngx447 minmag -0.10  -0.100   -> -0.10
308mngx448 minmag -0.1   -0.10    -> -0.1
309mngx449 minmag -1.0   -0.1     -> -0.1
310mngx450 minmag -1     -1.0     -> -1
311mngx451 minmag -1.1   -1       -> -1
312mngx453 minmag -Inf   -1.1     -> -1.1
313-- largies
314mngx460 minmag  1000   1E+3    ->  1000
315mngx461 minmag  1E+3   1000    ->  1000
316mngx462 minmag  1000  -1E+3    -> -1E+3
317mngx463 minmag  1E+3  -1000    -> -1000
318mngx464 minmag -1000   1E+3    -> -1000
319mngx465 minmag -1E+3   1000    -> -1E+3
320mngx466 minmag -1000  -1E+3    -> -1E+3
321mngx467 minmag -1E+3  -1000    -> -1E+3
322
323-- rounding (results treated as though plus)
324maxexponent: 999999999
325minexponent: -999999999
326precision: 3
327
328mngx470 minmag  1      5      ->  1
329mngx471 minmag  10     50     ->  10
330mngx472 minmag  100    500    ->  100
331mngx473 minmag  1000   5000   ->  1.00E+3 Rounded
332mngx474 minmag  10000  50000  ->  1.00E+4 Rounded
333mngx475 minmag  6      50     ->  6
334mngx476 minmag  66     500    ->  66
335mngx477 minmag  666    5000   ->  666
336mngx478 minmag  6666   50000  ->  6.67E+3 Rounded Inexact
337mngx479 minmag  66666  500000 ->  6.67E+4 Rounded Inexact
338mngx480 minmag  33333  500000 ->  3.33E+4 Rounded Inexact
339mngx481 minmag  75401  1      ->  1
340mngx482 minmag  75402  10     ->  10
341mngx483 minmag  75403  100    ->  100
342mngx484 minmag  75404  1000   ->  1.00E+3 Rounded
343mngx485 minmag  75405  10000  ->  1.00E+4 Rounded
344mngx486 minmag  75406  6      ->  6
345mngx487 minmag  75407  66     ->  66
346mngx488 minmag  75408  666    ->  666
347mngx489 minmag  75409  6666   ->  6.67E+3 Rounded Inexact
348mngx490 minmag  75410  66666  ->  6.67E+4 Rounded Inexact
349mngx491 minmag  75411  33333  ->  3.33E+4 Rounded Inexact
350
351
352-- overflow tests
353maxexponent: 999999999
354minexponent: -999999999
355precision: 3
356mngx500 minmag 9.999E+999999999  0 ->  0
357mngx501 minmag -9.999E+999999999 0 ->  0
358
359-- subnormals and underflow
360precision: 3
361maxexponent: 999
362minexponent: -999
363mngx510 minmag  1.00E-999       0  ->   0
364mngx511 minmag  0.1E-999        0  ->   0
365mngx512 minmag  0.10E-999       0  ->   0
366mngx513 minmag  0.100E-999      0  ->   0
367mngx514 minmag  0.01E-999       0  ->   0
368mngx515 minmag  0.999E-999      0  ->   0
369mngx516 minmag  0.099E-999      0  ->   0
370mngx517 minmag  0.009E-999      0  ->   0
371mngx518 minmag  0.001E-999      0  ->   0
372mngx519 minmag  0.0009E-999     0  ->   0
373mngx520 minmag  0.0001E-999     0  ->   0
374
375mngx530 minmag -1.00E-999       0  ->   0
376mngx531 minmag -0.1E-999        0  ->   0
377mngx532 minmag -0.10E-999       0  ->   0
378mngx533 minmag -0.100E-999      0  ->   0
379mngx534 minmag -0.01E-999       0  ->   0
380mngx535 minmag -0.999E-999      0  ->   0
381mngx536 minmag -0.099E-999      0  ->   0
382mngx537 minmag -0.009E-999      0  ->   0
383mngx538 minmag -0.001E-999      0  ->   0
384mngx539 minmag -0.0009E-999     0  ->   0
385mngx540 minmag -0.0001E-999     0  ->   0
386
387
388-- Null tests
389mng900 minmag 10  # -> NaN Invalid_operation
390mng901 minmag  # 10 -> NaN Invalid_operation