Home | History | Annotate | Download | only in decimaltestdata
      1 ------------------------------------------------------------------------
      2 -- clamp.decTest -- clamped exponent tests (format-independent)       --
      3 -- Copyright (c) IBM Corporation, 2000, 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 -- This set of tests uses the same limits as the 8-byte concrete
     23 -- representation, but applies clamping without using format-specific
     24 -- conversions.
     25 
     26 extended:    1
     27 precision:   16
     28 rounding:    half_even
     29 maxExponent: 384
     30 minExponent: -383
     31 clamp:       1
     32 
     33 -- General testcases
     34 
     35 -- Normality
     36 clam010 apply   1234567890123456   ->  1234567890123456
     37 clam011 apply   1234567890123456.0 ->  1234567890123456 Rounded
     38 clam012 apply   1234567890123456.1 ->  1234567890123456 Rounded Inexact
     39 clam013 apply  -1234567890123456   -> -1234567890123456
     40 clam014 apply  -1234567890123456.0 -> -1234567890123456 Rounded
     41 clam015 apply  -1234567890123456.1 -> -1234567890123456 Rounded Inexact
     42 
     43 
     44 -- Nmax and similar
     45 clam022 apply   9.999999999999999E+384  -> 9.999999999999999E+384
     46 clam024 apply   1.234567890123456E+384  -> 1.234567890123456E+384
     47 -- fold-downs (more below)
     48 clam030 apply   1.23E+384               -> 1.230000000000000E+384 Clamped
     49 clam032 apply   1E+384                  -> 1.000000000000000E+384 Clamped
     50 
     51 clam051 apply   12345                   -> 12345
     52 clam053 apply   1234                    -> 1234
     53 clam055 apply   123                     -> 123
     54 clam057 apply   12                      -> 12
     55 clam059 apply   1                       -> 1
     56 clam061 apply   1.23                    -> 1.23
     57 clam063 apply   123.45                  -> 123.45
     58 
     59 -- Nmin and below
     60 clam071 apply   1E-383                  -> 1E-383
     61 clam073 apply   1.000000000000000E-383  -> 1.000000000000000E-383
     62 clam075 apply   1.000000000000001E-383  -> 1.000000000000001E-383
     63 
     64 clam077 apply   0.100000000000000E-383  -> 1.00000000000000E-384  Subnormal
     65 clam079 apply   0.000000000000010E-383  -> 1.0E-397               Subnormal
     66 clam081 apply   0.00000000000001E-383   -> 1E-397                 Subnormal
     67 clam083 apply   0.000000000000001E-383  -> 1E-398                 Subnormal
     68 
     69 -- underflows
     70 clam090 apply   1e-398                  -> #0000000000000001  Subnormal
     71 clam091 apply   1.9e-398                -> #0000000000000002  Subnormal Underflow Inexact Rounded
     72 clam092 apply   1.1e-398                -> #0000000000000001  Subnormal Underflow Inexact Rounded
     73 clam093 apply   1.00000000001e-398      -> #0000000000000001  Subnormal Underflow Inexact Rounded
     74 clam094 apply   1.00000000000001e-398   -> #0000000000000001  Subnormal Underflow Inexact Rounded
     75 clam095 apply   1.000000000000001e-398  -> #0000000000000001  Subnormal Underflow Inexact Rounded
     76 clam096 apply   0.1e-398                -> #0000000000000000  Subnormal Underflow Inexact Rounded Clamped
     77 clam097 apply   0.00000000001e-398      -> #0000000000000000  Subnormal Underflow Inexact Rounded Clamped
     78 clam098 apply   0.00000000000001e-398   -> #0000000000000000  Subnormal Underflow Inexact Rounded Clamped
     79 clam099 apply   0.000000000000001e-398  -> #0000000000000000  Subnormal Underflow Inexact Rounded Clamped
     80 
     81 -- Same again, negatives
     82 -- Nmax and similar
     83 clam122 apply  -9.999999999999999E+384  -> -9.999999999999999E+384
     84 clam124 apply  -1.234567890123456E+384  -> -1.234567890123456E+384
     85 -- fold-downs (more below)
     86 clam130 apply  -1.23E+384               -> -1.230000000000000E+384 Clamped
     87 clam132 apply  -1E+384                  -> -1.000000000000000E+384 Clamped
     88 
     89 clam151 apply  -12345                   -> -12345
     90 clam153 apply  -1234                    -> -1234
     91 clam155 apply  -123                     -> -123
     92 clam157 apply  -12                      -> -12
     93 clam159 apply  -1                       -> -1
     94 clam161 apply  -1.23                    -> -1.23
     95 clam163 apply  -123.45                  -> -123.45
     96 
     97 -- Nmin and below
     98 clam171 apply  -1E-383                  -> -1E-383
     99 clam173 apply  -1.000000000000000E-383  -> -1.000000000000000E-383
    100 clam175 apply  -1.000000000000001E-383  -> -1.000000000000001E-383
    101 
    102 clam177 apply  -0.100000000000000E-383  -> -1.00000000000000E-384  Subnormal
    103 clam179 apply  -0.000000000000010E-383  -> -1.0E-397               Subnormal
    104 clam181 apply  -0.00000000000001E-383   -> -1E-397                 Subnormal
    105 clam183 apply  -0.000000000000001E-383  -> -1E-398                 Subnormal
    106 
    107 -- underflows
    108 clam189 apply   -1e-398                 -> #8000000000000001  Subnormal
    109 clam190 apply   -1.0e-398               -> #8000000000000001  Subnormal Rounded
    110 clam191 apply   -1.9e-398               -> #8000000000000002  Subnormal Underflow Inexact Rounded
    111 clam192 apply   -1.1e-398               -> #8000000000000001  Subnormal Underflow Inexact Rounded
    112 clam193 apply   -1.00000000001e-398     -> #8000000000000001  Subnormal Underflow Inexact Rounded
    113 clam194 apply   -1.00000000000001e-398  -> #8000000000000001  Subnormal Underflow Inexact Rounded
    114 clam195 apply   -1.000000000000001e-398 -> #8000000000000001  Subnormal Underflow Inexact Rounded
    115 clam196 apply   -0.1e-398               -> #8000000000000000  Subnormal Underflow Inexact Rounded Clamped
    116 clam197 apply   -0.00000000001e-398     -> #8000000000000000  Subnormal Underflow Inexact Rounded Clamped
    117 clam198 apply   -0.00000000000001e-398  -> #8000000000000000  Subnormal Underflow Inexact Rounded Clamped
    118 clam199 apply   -0.000000000000001e-398 -> #8000000000000000  Subnormal Underflow Inexact Rounded Clamped
    119 
    120 -- zeros
    121 clam401 apply   0E-500                  -> 0E-398  Clamped
    122 clam402 apply   0E-400                  -> 0E-398  Clamped
    123 clam403 apply   0E-398                  -> 0E-398
    124 clam404 apply   0.000000000000000E-383  -> 0E-398
    125 clam405 apply   0E-2                    ->  0.00
    126 clam406 apply   0                       -> 0
    127 clam407 apply   0E+3                    -> 0E+3
    128 clam408 apply   0E+369                  -> 0E+369
    129 -- clamped zeros...
    130 clam410 apply   0E+370                  -> 0E+369 Clamped
    131 clam411 apply   0E+384                  -> 0E+369 Clamped
    132 clam412 apply   0E+400                  -> 0E+369 Clamped
    133 clam413 apply   0E+500                  -> 0E+369 Clamped
    134 
    135 -- negative zeros
    136 clam420 apply   -0E-500                 -> -0E-398 Clamped
    137 clam421 apply   -0E-400                 -> -0E-398 Clamped
    138 clam422 apply   -0E-398                 -> -0E-398
    139 clam423 apply   -0.000000000000000E-383 -> -0E-398
    140 clam424 apply   -0E-2                   -> -0.00
    141 clam425 apply   -0                      -> -0
    142 clam426 apply   -0E+3                   -> -0E+3
    143 clam427 apply   -0E+369                 -> -0E+369
    144 -- clamped zeros...
    145 clam431 apply   -0E+370                 -> -0E+369 Clamped
    146 clam432 apply   -0E+384                 -> -0E+369 Clamped
    147 clam433 apply   -0E+400                 -> -0E+369 Clamped
    148 clam434 apply   -0E+500                 -> -0E+369 Clamped
    149 
    150 -- fold-down full sequence
    151 clam601 apply   1E+384                  -> 1.000000000000000E+384 Clamped
    152 clam603 apply   1E+383                  -> 1.00000000000000E+383 Clamped
    153 clam605 apply   1E+382                  -> 1.0000000000000E+382 Clamped
    154 clam607 apply   1E+381                  -> 1.000000000000E+381 Clamped
    155 clam609 apply   1E+380                  -> 1.00000000000E+380 Clamped
    156 clam611 apply   1E+379                  -> 1.0000000000E+379 Clamped
    157 clam613 apply   1E+378                  -> 1.000000000E+378 Clamped
    158 clam615 apply   1E+377                  -> 1.00000000E+377 Clamped
    159 clam617 apply   1E+376                  -> 1.0000000E+376 Clamped
    160 clam619 apply   1E+375                  -> 1.000000E+375 Clamped
    161 clam621 apply   1E+374                  -> 1.00000E+374 Clamped
    162 clam623 apply   1E+373                  -> 1.0000E+373 Clamped
    163 clam625 apply   1E+372                  -> 1.000E+372 Clamped
    164 clam627 apply   1E+371                  -> 1.00E+371 Clamped
    165 clam629 apply   1E+370                  -> 1.0E+370 Clamped
    166 clam631 apply   1E+369                  -> 1E+369
    167 clam633 apply   1E+368                  -> 1E+368
    168 -- same with 9s
    169 clam641 apply   9E+384                  -> 9.000000000000000E+384 Clamped
    170 clam643 apply   9E+383                  -> 9.00000000000000E+383 Clamped
    171 clam645 apply   9E+382                  -> 9.0000000000000E+382 Clamped
    172 clam647 apply   9E+381                  -> 9.000000000000E+381 Clamped
    173 clam649 apply   9E+380                  -> 9.00000000000E+380 Clamped
    174 clam651 apply   9E+379                  -> 9.0000000000E+379 Clamped
    175 clam653 apply   9E+378                  -> 9.000000000E+378 Clamped
    176 clam655 apply   9E+377                  -> 9.00000000E+377 Clamped
    177 clam657 apply   9E+376                  -> 9.0000000E+376 Clamped
    178 clam659 apply   9E+375                  -> 9.000000E+375 Clamped
    179 clam661 apply   9E+374                  -> 9.00000E+374 Clamped
    180 clam663 apply   9E+373                  -> 9.0000E+373 Clamped
    181 clam665 apply   9E+372                  -> 9.000E+372 Clamped
    182 clam667 apply   9E+371                  -> 9.00E+371 Clamped
    183 clam669 apply   9E+370                  -> 9.0E+370 Clamped
    184 clam671 apply   9E+369                  -> 9E+369
    185 clam673 apply   9E+368                  -> 9E+368
    186 
    187 -- subnormals clamped to 0-Etiny
    188 precision:   16
    189 maxExponent: 384
    190 minExponent: -383
    191 clam681 apply 7E-398     -> 7E-398 Subnormal
    192 clam682 apply 0E-398     -> 0E-398
    193 clam683 apply 7E-399     -> 1E-398 Subnormal Underflow Inexact Rounded
    194 clam684 apply 4E-399     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    195 clam685 apply 7E-400     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    196 clam686 apply 7E-401     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    197 clam687 apply 0E-399     -> 0E-398 Clamped
    198 clam688 apply 0E-400     -> 0E-398 Clamped
    199 clam689 apply 0E-401     -> 0E-398 Clamped
    200 
    201 -- example from documentation
    202 precision:   7
    203 rounding:    half_even
    204 maxExponent: +96
    205 minExponent: -95
    206 
    207 clamp:       0
    208 clam700 apply   1.23E+96                -> 1.23E+96
    209 
    210 clamp:       1
    211 clam701 apply   1.23E+96                -> 1.230000E+96 Clamped
    212