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