Home | History | Annotate | Download | only in decimaltestdata
      1 ------------------------------------------------------------------------
      2 -- ddReduce.decTest -- remove trailing zeros from a decDouble         --
      3 -- Copyright (c) IBM Corporation, 2003, 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 precision:   16
     23 maxExponent: 384
     24 minExponent: -383
     25 extended:    1
     26 clamp:       1
     27 rounding:    half_even
     28 
     29 ddred001 reduce '1'      -> '1'
     30 ddred002 reduce '-1'     -> '-1'
     31 ddred003 reduce '1.00'   -> '1'
     32 ddred004 reduce '-1.00'  -> '-1'
     33 ddred005 reduce '0'      -> '0'
     34 ddred006 reduce '0.00'   -> '0'
     35 ddred007 reduce '00.0'   -> '0'
     36 ddred008 reduce '00.00'  -> '0'
     37 ddred009 reduce '00'     -> '0'
     38 ddred010 reduce '0E+1'   -> '0'
     39 ddred011 reduce '0E+5'   -> '0'
     40 
     41 ddred012 reduce '-2'     -> '-2'
     42 ddred013 reduce '2'      -> '2'
     43 ddred014 reduce '-2.00'  -> '-2'
     44 ddred015 reduce '2.00'   -> '2'
     45 ddred016 reduce '-0'     -> '-0'
     46 ddred017 reduce '-0.00'  -> '-0'
     47 ddred018 reduce '-00.0'  -> '-0'
     48 ddred019 reduce '-00.00' -> '-0'
     49 ddred020 reduce '-00'    -> '-0'
     50 ddred021 reduce '-0E+5'   -> '-0'
     51 ddred022 reduce '-0E+1'  -> '-0'
     52 
     53 ddred030 reduce '+0.1'            -> '0.1'
     54 ddred031 reduce '-0.1'            -> '-0.1'
     55 ddred032 reduce '+0.01'           -> '0.01'
     56 ddred033 reduce '-0.01'           -> '-0.01'
     57 ddred034 reduce '+0.001'          -> '0.001'
     58 ddred035 reduce '-0.001'          -> '-0.001'
     59 ddred036 reduce '+0.000001'       -> '0.000001'
     60 ddred037 reduce '-0.000001'       -> '-0.000001'
     61 ddred038 reduce '+0.000000000001' -> '1E-12'
     62 ddred039 reduce '-0.000000000001' -> '-1E-12'
     63 
     64 ddred041 reduce 1.1        -> 1.1
     65 ddred042 reduce 1.10       -> 1.1
     66 ddred043 reduce 1.100      -> 1.1
     67 ddred044 reduce 1.110      -> 1.11
     68 ddred045 reduce -1.1       -> -1.1
     69 ddred046 reduce -1.10      -> -1.1
     70 ddred047 reduce -1.100     -> -1.1
     71 ddred048 reduce -1.110     -> -1.11
     72 ddred049 reduce 9.9        -> 9.9
     73 ddred050 reduce 9.90       -> 9.9
     74 ddred051 reduce 9.900      -> 9.9
     75 ddred052 reduce 9.990      -> 9.99
     76 ddred053 reduce -9.9       -> -9.9
     77 ddred054 reduce -9.90      -> -9.9
     78 ddred055 reduce -9.900     -> -9.9
     79 ddred056 reduce -9.990     -> -9.99
     80 
     81 -- some trailing fractional zeros with zeros in units
     82 ddred060 reduce  10.0        -> 1E+1
     83 ddred061 reduce  10.00       -> 1E+1
     84 ddred062 reduce  100.0       -> 1E+2
     85 ddred063 reduce  100.00      -> 1E+2
     86 ddred064 reduce  1.1000E+3   -> 1.1E+3
     87 ddred065 reduce  1.10000E+3  -> 1.1E+3
     88 ddred066 reduce -10.0        -> -1E+1
     89 ddred067 reduce -10.00       -> -1E+1
     90 ddred068 reduce -100.0       -> -1E+2
     91 ddred069 reduce -100.00      -> -1E+2
     92 ddred070 reduce -1.1000E+3   -> -1.1E+3
     93 ddred071 reduce -1.10000E+3  -> -1.1E+3
     94 
     95 -- some insignificant trailing zeros with positive exponent
     96 ddred080 reduce  10E+1       -> 1E+2
     97 ddred081 reduce  100E+1      -> 1E+3
     98 ddred082 reduce  1.0E+2      -> 1E+2
     99 ddred083 reduce  1.0E+3      -> 1E+3
    100 ddred084 reduce  1.1E+3      -> 1.1E+3
    101 ddred085 reduce  1.00E+3     -> 1E+3
    102 ddred086 reduce  1.10E+3     -> 1.1E+3
    103 ddred087 reduce -10E+1       -> -1E+2
    104 ddred088 reduce -100E+1      -> -1E+3
    105 ddred089 reduce -1.0E+2      -> -1E+2
    106 ddred090 reduce -1.0E+3      -> -1E+3
    107 ddred091 reduce -1.1E+3      -> -1.1E+3
    108 ddred092 reduce -1.00E+3     -> -1E+3
    109 ddred093 reduce -1.10E+3     -> -1.1E+3
    110 
    111 -- some significant trailing zeros, were we to be trimming
    112 ddred100 reduce  11          -> 11
    113 ddred101 reduce  10          -> 1E+1
    114 ddred102 reduce  10.         -> 1E+1
    115 ddred103 reduce  1.1E+1      -> 11
    116 ddred104 reduce  1.0E+1      -> 1E+1
    117 ddred105 reduce  1.10E+2     -> 1.1E+2
    118 ddred106 reduce  1.00E+2     -> 1E+2
    119 ddred107 reduce  1.100E+3    -> 1.1E+3
    120 ddred108 reduce  1.000E+3    -> 1E+3
    121 ddred109 reduce  1.000000E+6 -> 1E+6
    122 ddred110 reduce -11          -> -11
    123 ddred111 reduce -10          -> -1E+1
    124 ddred112 reduce -10.         -> -1E+1
    125 ddred113 reduce -1.1E+1      -> -11
    126 ddred114 reduce -1.0E+1      -> -1E+1
    127 ddred115 reduce -1.10E+2     -> -1.1E+2
    128 ddred116 reduce -1.00E+2     -> -1E+2
    129 ddred117 reduce -1.100E+3    -> -1.1E+3
    130 ddred118 reduce -1.000E+3    -> -1E+3
    131 ddred119 reduce -1.00000E+5  -> -1E+5
    132 ddred120 reduce -1.000000E+6 -> -1E+6
    133 ddred121 reduce -10.00000E+6 -> -1E+7
    134 ddred122 reduce -100.0000E+6 -> -1E+8
    135 ddred123 reduce -1000.000E+6 -> -1E+9
    136 ddred124 reduce -10000.00E+6 -> -1E+10
    137 ddred125 reduce -100000.0E+6 -> -1E+11
    138 ddred126 reduce -1000000.E+6 -> -1E+12
    139 
    140 -- examples from decArith
    141 ddred140 reduce '2.1'     ->  '2.1'
    142 ddred141 reduce '-2.0'    ->  '-2'
    143 ddred142 reduce '1.200'   ->  '1.2'
    144 ddred143 reduce '-120'    ->  '-1.2E+2'
    145 ddred144 reduce '120.00'  ->  '1.2E+2'
    146 ddred145 reduce '0.00'    ->  '0'
    147 
    148 -- Nmax, Nmin, Ntiny
    149 -- note origami effect on some of these
    150 ddred151 reduce  9.999999999999999E+384   -> 9.999999999999999E+384
    151 ddred152 reduce  9.999999000000000E+380   -> 9.99999900000E+380
    152 ddred153 reduce  9.999999999990000E+384   -> 9.999999999990000E+384
    153 ddred154 reduce  1E-383                   -> 1E-383
    154 ddred155 reduce  1.000000000000000E-383   -> 1E-383
    155 ddred156 reduce  2.000E-395               -> 2E-395   Subnormal
    156 ddred157 reduce  1E-398                   -> 1E-398   Subnormal
    157 
    158 ddred161 reduce  -1E-398                  -> -1E-398  Subnormal
    159 ddred162 reduce  -2.000E-395              -> -2E-395  Subnormal
    160 ddred163 reduce  -1.000000000000000E-383  -> -1E-383
    161 ddred164 reduce  -1E-383                  -> -1E-383
    162 ddred165 reduce  -9.999999000000000E+380  -> -9.99999900000E+380
    163 ddred166 reduce  -9.999999999990000E+384  -> -9.999999999990000E+384
    164 ddred167 reduce  -9.999999999999990E+384  -> -9.999999999999990E+384
    165 ddred168 reduce  -9.999999999999999E+384  -> -9.999999999999999E+384
    166 ddred169 reduce  -9.999999999999990E+384  -> -9.999999999999990E+384
    167 
    168 
    169 -- specials (reduce does not affect payload)
    170 ddred820 reduce 'Inf'    -> 'Infinity'
    171 ddred821 reduce '-Inf'   -> '-Infinity'
    172 ddred822 reduce   NaN    ->  NaN
    173 ddred823 reduce  sNaN    ->  NaN    Invalid_operation
    174 ddred824 reduce   NaN101 ->  NaN101
    175 ddred825 reduce  sNaN010 ->  NaN10  Invalid_operation
    176 ddred827 reduce  -NaN    -> -NaN
    177 ddred828 reduce -sNaN    -> -NaN    Invalid_operation
    178 ddred829 reduce  -NaN101 -> -NaN101
    179 ddred830 reduce -sNaN010 -> -NaN10  Invalid_operation
    180 
    181 -- Null test
    182 ddred900 reduce  # -> NaN Invalid_operation
    183