Home | History | Annotate | Download | only in decimaltestdata
      1 ------------------------------------------------------------------------
      2 -- plus.decTest -- decimal monadic addition                           --
      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 -- This set of tests primarily tests the existence of the operator.
     23 -- Addition and rounding, and most overflows, are tested elsewhere.
     24 
     25 extended:    1
     26 precision:   9
     27 rounding:    half_up
     28 maxExponent: 384
     29 minexponent: -383
     30 
     31 plux001 plus '1'      -> '1'
     32 plux002 plus '-1'     -> '-1'
     33 plux003 plus '1.00'   -> '1.00'
     34 plux004 plus '-1.00'  -> '-1.00'
     35 plux005 plus '0'      -> '0'
     36 plux006 plus '0.00'   -> '0.00'
     37 plux007 plus '00.0'   -> '0.0'
     38 plux008 plus '00.00'  -> '0.00'
     39 plux009 plus '00'     -> '0'
     40 
     41 plux010 plus '-2'     -> '-2'
     42 plux011 plus '2'      -> '2'
     43 plux012 plus '-2.00'  -> '-2.00'
     44 plux013 plus '2.00'   -> '2.00'
     45 plux014 plus '-0'     -> '0'
     46 plux015 plus '-0.00'  -> '0.00'
     47 plux016 plus '-00.0'  -> '0.0'
     48 plux017 plus '-00.00' -> '0.00'
     49 plux018 plus '-00'    -> '0'
     50 
     51 plux020 plus '-2000000' -> '-2000000'
     52 plux021 plus '2000000'  -> '2000000'
     53 precision: 7
     54 plux022 plus '-2000000' -> '-2000000'
     55 plux023 plus '2000000'  -> '2000000'
     56 precision: 6
     57 plux024 plus '-2000000' -> '-2.00000E+6' Rounded
     58 plux025 plus '2000000'  -> '2.00000E+6' Rounded
     59 precision: 3
     60 plux026 plus '-2000000' -> '-2.00E+6' Rounded
     61 plux027 plus '2000000'  -> '2.00E+6' Rounded
     62 
     63 -- more fixed, potential LHS swaps if done by add 0
     64 precision: 9
     65 plux060 plus '56267E-10'   -> '0.0000056267'
     66 plux061 plus '56267E-5'    -> '0.56267'
     67 plux062 plus '56267E-2'    -> '562.67'
     68 plux063 plus '56267E-1'    -> '5626.7'
     69 plux065 plus '56267E-0'    -> '56267'
     70 plux066 plus '56267E+0'    -> '56267'
     71 plux067 plus '56267E+1'    -> '5.6267E+5'
     72 plux068 plus '56267E+2'    -> '5.6267E+6'
     73 plux069 plus '56267E+3'    -> '5.6267E+7'
     74 plux070 plus '56267E+4'    -> '5.6267E+8'
     75 plux071 plus '56267E+5'    -> '5.6267E+9'
     76 plux072 plus '56267E+6'    -> '5.6267E+10'
     77 plux080 plus '-56267E-10'  -> '-0.0000056267'
     78 plux081 plus '-56267E-5'   -> '-0.56267'
     79 plux082 plus '-56267E-2'   -> '-562.67'
     80 plux083 plus '-56267E-1'   -> '-5626.7'
     81 plux085 plus '-56267E-0'   -> '-56267'
     82 plux086 plus '-56267E+0'   -> '-56267'
     83 plux087 plus '-56267E+1'   -> '-5.6267E+5'
     84 plux088 plus '-56267E+2'   -> '-5.6267E+6'
     85 plux089 plus '-56267E+3'   -> '-5.6267E+7'
     86 plux090 plus '-56267E+4'   -> '-5.6267E+8'
     87 plux091 plus '-56267E+5'   -> '-5.6267E+9'
     88 plux092 plus '-56267E+6'   -> '-5.6267E+10'
     89 
     90 -- "lhs" zeros in plus and minus have exponent = operand
     91 plux120 plus '-0E3'   -> '0E+3'
     92 plux121 plus '-0E2'   -> '0E+2'
     93 plux122 plus '-0E1'   -> '0E+1'
     94 plux123 plus '-0E0'   -> '0'
     95 plux124 plus '+0E0'   -> '0'
     96 plux125 plus '+0E1'   -> '0E+1'
     97 plux126 plus '+0E2'   -> '0E+2'
     98 plux127 plus '+0E3'   -> '0E+3'
     99 
    100 plux130 plus '-5E3'   -> '-5E+3'
    101 plux131 plus '-5E8'   -> '-5E+8'
    102 plux132 plus '-5E13'  -> '-5E+13'
    103 plux133 plus '-5E18'  -> '-5E+18'
    104 plux134 plus '+5E3'   -> '5E+3'
    105 plux135 plus '+5E8'   -> '5E+8'
    106 plux136 plus '+5E13'  -> '5E+13'
    107 plux137 plus '+5E18'  -> '5E+18'
    108 
    109 -- specials
    110 plux150 plus 'Inf'    -> 'Infinity'
    111 plux151 plus '-Inf'   -> '-Infinity'
    112 plux152 plus   NaN    ->  NaN
    113 plux153 plus  sNaN    ->  NaN   Invalid_operation
    114 plux154 plus   NaN77  ->  NaN77
    115 plux155 plus  sNaN88  ->  NaN88 Invalid_operation
    116 plux156 plus  -NaN    -> -NaN
    117 plux157 plus -sNaN    -> -NaN   Invalid_operation
    118 plux158 plus  -NaN77  -> -NaN77
    119 plux159 plus -sNaN88  -> -NaN88 Invalid_operation
    120 
    121 -- overflow tests
    122 maxexponent: 999999999
    123 minexponent: -999999999
    124 precision: 3
    125 plux160 plus 9.999E+999999999  ->  Infinity Inexact Overflow Rounded
    126 plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded
    127 
    128 -- subnormals and underflow
    129 precision: 3
    130 maxexponent: 999
    131 minexponent: -999
    132 plux210 plus  1.00E-999        ->   1.00E-999
    133 plux211 plus  0.1E-999         ->   1E-1000   Subnormal
    134 plux212 plus  0.10E-999        ->   1.0E-1000 Subnormal
    135 plux213 plus  0.100E-999       ->   1.0E-1000 Subnormal Rounded
    136 plux214 plus  0.01E-999        ->   1E-1001   Subnormal
    137 -- next is rounded to Emin
    138 plux215 plus  0.999E-999       ->   1.00E-999 Inexact Rounded Subnormal Underflow
    139 plux216 plus  0.099E-999       ->   1.0E-1000 Inexact Rounded Subnormal Underflow
    140 plux217 plus  0.009E-999       ->   1E-1001   Inexact Rounded Subnormal Underflow
    141 plux218 plus  0.001E-999       ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
    142 plux219 plus  0.0009E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
    143 plux220 plus  0.0001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
    144 
    145 plux230 plus -1.00E-999        ->  -1.00E-999
    146 plux231 plus -0.1E-999         ->  -1E-1000   Subnormal
    147 plux232 plus -0.10E-999        ->  -1.0E-1000 Subnormal
    148 plux233 plus -0.100E-999       ->  -1.0E-1000 Subnormal Rounded
    149 plux234 plus -0.01E-999        ->  -1E-1001   Subnormal
    150 -- next is rounded to Emin
    151 plux235 plus -0.999E-999       ->  -1.00E-999 Inexact Rounded Subnormal Underflow
    152 plux236 plus -0.099E-999       ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
    153 plux237 plus -0.009E-999       ->  -1E-1001   Inexact Rounded Subnormal Underflow
    154 plux238 plus -0.001E-999       ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
    155 plux239 plus -0.0009E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
    156 plux240 plus -0.0001E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
    157 
    158 -- subnormals clamped to 0-Etiny
    159 precision:   16
    160 maxExponent: 384
    161 minExponent: -383
    162 plux251 plus 7E-398     -> 7E-398 Subnormal
    163 plux252 plus 0E-398     -> 0E-398
    164 plux253 plus 7E-399     -> 1E-398 Subnormal Underflow Inexact Rounded
    165 plux254 plus 4E-399     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    166 plux255 plus 7E-400     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    167 plux256 plus 7E-401     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
    168 plux257 plus 0E-399     -> 0E-398 Clamped
    169 plux258 plus 0E-400     -> 0E-398 Clamped
    170 plux259 plus 0E-401     -> 0E-398 Clamped
    171 
    172 -- long operand checks
    173 maxexponent: 999
    174 minexponent: -999
    175 precision: 9
    176 plux301 plus 12345678000  -> 1.23456780E+10 Rounded
    177 plux302 plus 1234567800   -> 1.23456780E+9 Rounded
    178 plux303 plus 1234567890   -> 1.23456789E+9 Rounded
    179 plux304 plus 1234567891   -> 1.23456789E+9 Inexact Rounded
    180 plux305 plus 12345678901  -> 1.23456789E+10 Inexact Rounded
    181 plux306 plus 1234567896   -> 1.23456790E+9 Inexact Rounded
    182 
    183 -- still checking
    184 precision: 15
    185 plux321 plus 12345678000  -> 12345678000
    186 plux322 plus 1234567800   -> 1234567800
    187 plux323 plus 1234567890   -> 1234567890
    188 plux324 plus 1234567891   -> 1234567891
    189 plux325 plus 12345678901  -> 12345678901
    190 plux326 plus 1234567896   -> 1234567896
    191 precision: 9
    192 
    193 -- Null tests
    194 plu900 plus  # -> NaN Invalid_operation
    195 
    196