Home | History | Annotate | Download | only in decimaltestdata
      1 ------------------------------------------------------------------------
      2 -- tointegralx.decTest -- round decimal to integral value, exact      --
      3 -- Copyright (c) IBM Corporation, 2001, 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 tests the extended specification 'round-to-integral
     23 -- value' operation (from IEEE 854, later modified in 754r).
     24 -- All non-zero results are defined as being those from either copy or
     25 -- quantize, so those are assumed to have been tested.
     26 
     27 -- This tests toIntegraExact, which may set Inexact
     28 
     29 extended:    1
     30 precision:   9
     31 rounding:    half_up
     32 maxExponent: 999
     33 minExponent: -999
     34 
     35 intxx001 tointegralx      0     ->  0
     36 intxx002 tointegralx      0.0   ->  0
     37 intxx003 tointegralx      0.1   ->  0 Inexact Rounded
     38 intxx004 tointegralx      0.2   ->  0 Inexact Rounded
     39 intxx005 tointegralx      0.3   ->  0 Inexact Rounded
     40 intxx006 tointegralx      0.4   ->  0 Inexact Rounded
     41 intxx007 tointegralx      0.5   ->  1 Inexact Rounded
     42 intxx008 tointegralx      0.6   ->  1 Inexact Rounded
     43 intxx009 tointegralx      0.7   ->  1 Inexact Rounded
     44 intxx010 tointegralx      0.8   ->  1 Inexact Rounded
     45 intxx011 tointegralx      0.9   ->  1 Inexact Rounded
     46 intxx012 tointegralx      1     ->  1
     47 intxx013 tointegralx      1.0   ->  1 Rounded
     48 intxx014 tointegralx      1.1   ->  1 Inexact Rounded
     49 intxx015 tointegralx      1.2   ->  1 Inexact Rounded
     50 intxx016 tointegralx      1.3   ->  1 Inexact Rounded
     51 intxx017 tointegralx      1.4   ->  1 Inexact Rounded
     52 intxx018 tointegralx      1.5   ->  2 Inexact Rounded
     53 intxx019 tointegralx      1.6   ->  2 Inexact Rounded
     54 intxx020 tointegralx      1.7   ->  2 Inexact Rounded
     55 intxx021 tointegralx      1.8   ->  2 Inexact Rounded
     56 intxx022 tointegralx      1.9   ->  2 Inexact Rounded
     57 -- negatives
     58 intxx031 tointegralx     -0     -> -0
     59 intxx032 tointegralx     -0.0   -> -0
     60 intxx033 tointegralx     -0.1   -> -0 Inexact Rounded
     61 intxx034 tointegralx     -0.2   -> -0 Inexact Rounded
     62 intxx035 tointegralx     -0.3   -> -0 Inexact Rounded
     63 intxx036 tointegralx     -0.4   -> -0 Inexact Rounded
     64 intxx037 tointegralx     -0.5   -> -1 Inexact Rounded
     65 intxx038 tointegralx     -0.6   -> -1 Inexact Rounded
     66 intxx039 tointegralx     -0.7   -> -1 Inexact Rounded
     67 intxx040 tointegralx     -0.8   -> -1 Inexact Rounded
     68 intxx041 tointegralx     -0.9   -> -1 Inexact Rounded
     69 intxx042 tointegralx     -1     -> -1
     70 intxx043 tointegralx     -1.0   -> -1 Rounded
     71 intxx044 tointegralx     -1.1   -> -1 Inexact Rounded
     72 intxx045 tointegralx     -1.2   -> -1 Inexact Rounded
     73 intxx046 tointegralx     -1.3   -> -1 Inexact Rounded
     74 intxx047 tointegralx     -1.4   -> -1 Inexact Rounded
     75 intxx048 tointegralx     -1.5   -> -2 Inexact Rounded
     76 intxx049 tointegralx     -1.6   -> -2 Inexact Rounded
     77 intxx050 tointegralx     -1.7   -> -2 Inexact Rounded
     78 intxx051 tointegralx     -1.8   -> -2 Inexact Rounded
     79 intxx052 tointegralx     -1.9   -> -2 Inexact Rounded
     80 -- next two would be NaN using quantize(x, 0)
     81 intxx053 tointegralx    10E+30  -> 1.0E+31
     82 intxx054 tointegralx   -10E+30  -> -1.0E+31
     83 
     84 -- numbers around precision
     85 precision: 9
     86 intxx060 tointegralx '56267E-10'   -> '0'               Inexact Rounded
     87 intxx061 tointegralx '56267E-5'    -> '1'               Inexact Rounded
     88 intxx062 tointegralx '56267E-2'    -> '563'             Inexact Rounded
     89 intxx063 tointegralx '56267E-1'    -> '5627'            Inexact Rounded
     90 intxx065 tointegralx '56267E-0'    -> '56267'
     91 intxx066 tointegralx '56267E+0'    -> '56267'
     92 intxx067 tointegralx '56267E+1'    -> '5.6267E+5'
     93 intxx068 tointegralx '56267E+2'    -> '5.6267E+6'
     94 intxx069 tointegralx '56267E+3'    -> '5.6267E+7'
     95 intxx070 tointegralx '56267E+4'    -> '5.6267E+8'
     96 intxx071 tointegralx '56267E+5'    -> '5.6267E+9'
     97 intxx072 tointegralx '56267E+6'    -> '5.6267E+10'
     98 intxx073 tointegralx '1.23E+96'    -> '1.23E+96'
     99 intxx074 tointegralx '1.23E+384'   -> '1.23E+384'
    100 intxx075 tointegralx '1.23E+999'   -> '1.23E+999'
    101 
    102 intxx080 tointegralx '-56267E-10'  -> '-0'              Inexact Rounded
    103 intxx081 tointegralx '-56267E-5'   -> '-1'              Inexact Rounded
    104 intxx082 tointegralx '-56267E-2'   -> '-563'            Inexact Rounded
    105 intxx083 tointegralx '-56267E-1'   -> '-5627'           Inexact Rounded
    106 intxx085 tointegralx '-56267E-0'   -> '-56267'
    107 intxx086 tointegralx '-56267E+0'   -> '-56267'
    108 intxx087 tointegralx '-56267E+1'   -> '-5.6267E+5'
    109 intxx088 tointegralx '-56267E+2'   -> '-5.6267E+6'
    110 intxx089 tointegralx '-56267E+3'   -> '-5.6267E+7'
    111 intxx090 tointegralx '-56267E+4'   -> '-5.6267E+8'
    112 intxx091 tointegralx '-56267E+5'   -> '-5.6267E+9'
    113 intxx092 tointegralx '-56267E+6'   -> '-5.6267E+10'
    114 intxx093 tointegralx '-1.23E+96'   -> '-1.23E+96'
    115 intxx094 tointegralx '-1.23E+384'  -> '-1.23E+384'
    116 intxx095 tointegralx '-1.23E+999'  -> '-1.23E+999'
    117 
    118 -- subnormal inputs
    119 intxx100 tointegralx        1E-999 -> 0                 Inexact Rounded
    120 intxx101 tointegralx      0.1E-999 -> 0                 Inexact Rounded
    121 intxx102 tointegralx     0.01E-999 -> 0                 Inexact Rounded
    122 intxx103 tointegralx        0E-999 -> 0
    123 
    124 -- specials and zeros
    125 intxx120 tointegralx 'Inf'       ->  Infinity
    126 intxx121 tointegralx '-Inf'      -> -Infinity
    127 intxx122 tointegralx   NaN       ->  NaN
    128 intxx123 tointegralx  sNaN       ->  NaN  Invalid_operation
    129 intxx124 tointegralx     0       ->  0
    130 intxx125 tointegralx    -0       -> -0
    131 intxx126 tointegralx     0.000   ->  0
    132 intxx127 tointegralx     0.00    ->  0
    133 intxx128 tointegralx     0.0     ->  0
    134 intxx129 tointegralx     0       ->  0
    135 intxx130 tointegralx     0E-3    ->  0
    136 intxx131 tointegralx     0E-2    ->  0
    137 intxx132 tointegralx     0E-1    ->  0
    138 intxx133 tointegralx     0E-0    ->  0
    139 intxx134 tointegralx     0E+1    ->  0E+1
    140 intxx135 tointegralx     0E+2    ->  0E+2
    141 intxx136 tointegralx     0E+3    ->  0E+3
    142 intxx137 tointegralx     0E+4    ->  0E+4
    143 intxx138 tointegralx     0E+5    ->  0E+5
    144 intxx139 tointegralx    -0.000   -> -0
    145 intxx140 tointegralx    -0.00    -> -0
    146 intxx141 tointegralx    -0.0     -> -0
    147 intxx142 tointegralx    -0       -> -0
    148 intxx143 tointegralx    -0E-3    -> -0
    149 intxx144 tointegralx    -0E-2    -> -0
    150 intxx145 tointegralx    -0E-1    -> -0
    151 intxx146 tointegralx    -0E-0    -> -0
    152 intxx147 tointegralx    -0E+1    -> -0E+1
    153 intxx148 tointegralx    -0E+2    -> -0E+2
    154 intxx149 tointegralx    -0E+3    -> -0E+3
    155 intxx150 tointegralx    -0E+4    -> -0E+4
    156 intxx151 tointegralx    -0E+5    -> -0E+5
    157 -- propagating NaNs
    158 intxx152 tointegralx   NaN808    ->  NaN808
    159 intxx153 tointegralx  sNaN080    ->  NaN80  Invalid_operation
    160 intxx154 tointegralx  -NaN808    -> -NaN808
    161 intxx155 tointegralx -sNaN080    -> -NaN80  Invalid_operation
    162 intxx156 tointegralx  -NaN       -> -NaN
    163 intxx157 tointegralx -sNaN       -> -NaN    Invalid_operation
    164 
    165 -- examples
    166 rounding:    half_up
    167 precision:   9
    168 intxx200 tointegralx     2.1    -> 2                    Inexact Rounded
    169 intxx201 tointegralx   100      -> 100
    170 intxx202 tointegralx   100.0    -> 100                  Rounded
    171 intxx203 tointegralx   101.5    -> 102                  Inexact Rounded
    172 intxx204 tointegralx  -101.5    -> -102                 Inexact Rounded
    173 intxx205 tointegralx   10E+5    -> 1.0E+6
    174 intxx206 tointegralx  7.89E+77  -> 7.89E+77
    175 intxx207 tointegralx   -Inf     -> -Infinity
    176 
    177 
    178 -- all rounding modes
    179 rounding:    half_even
    180 
    181 intxx210 tointegralx     55.5   ->  56   Inexact Rounded
    182 intxx211 tointegralx     56.5   ->  56   Inexact Rounded
    183 intxx212 tointegralx     57.5   ->  58   Inexact Rounded
    184 intxx213 tointegralx    -55.5   -> -56   Inexact Rounded
    185 intxx214 tointegralx    -56.5   -> -56   Inexact Rounded
    186 intxx215 tointegralx    -57.5   -> -58   Inexact Rounded
    187 
    188 rounding:    half_up
    189 
    190 intxx220 tointegralx     55.5   ->  56   Inexact Rounded
    191 intxx221 tointegralx     56.5   ->  57   Inexact Rounded
    192 intxx222 tointegralx     57.5   ->  58   Inexact Rounded
    193 intxx223 tointegralx    -55.5   -> -56   Inexact Rounded
    194 intxx224 tointegralx    -56.5   -> -57   Inexact Rounded
    195 intxx225 tointegralx    -57.5   -> -58   Inexact Rounded
    196 
    197 rounding:    half_down
    198 
    199 intxx230 tointegralx     55.5   ->  55   Inexact Rounded
    200 intxx231 tointegralx     56.5   ->  56   Inexact Rounded
    201 intxx232 tointegralx     57.5   ->  57   Inexact Rounded
    202 intxx233 tointegralx    -55.5   -> -55   Inexact Rounded
    203 intxx234 tointegralx    -56.5   -> -56   Inexact Rounded
    204 intxx235 tointegralx    -57.5   -> -57   Inexact Rounded
    205 
    206 rounding:    up
    207 
    208 intxx240 tointegralx     55.3   ->  56   Inexact Rounded
    209 intxx241 tointegralx     56.3   ->  57   Inexact Rounded
    210 intxx242 tointegralx     57.3   ->  58   Inexact Rounded
    211 intxx243 tointegralx    -55.3   -> -56   Inexact Rounded
    212 intxx244 tointegralx    -56.3   -> -57   Inexact Rounded
    213 intxx245 tointegralx    -57.3   -> -58   Inexact Rounded
    214 
    215 rounding:    down
    216 
    217 intxx250 tointegralx     55.7   ->  55   Inexact Rounded
    218 intxx251 tointegralx     56.7   ->  56   Inexact Rounded
    219 intxx252 tointegralx     57.7   ->  57   Inexact Rounded
    220 intxx253 tointegralx    -55.7   -> -55   Inexact Rounded
    221 intxx254 tointegralx    -56.7   -> -56   Inexact Rounded
    222 intxx255 tointegralx    -57.7   -> -57   Inexact Rounded
    223 
    224 rounding:    ceiling
    225 
    226 intxx260 tointegralx     55.3   ->  56   Inexact Rounded
    227 intxx261 tointegralx     56.3   ->  57   Inexact Rounded
    228 intxx262 tointegralx     57.3   ->  58   Inexact Rounded
    229 intxx263 tointegralx    -55.3   -> -55   Inexact Rounded
    230 intxx264 tointegralx    -56.3   -> -56   Inexact Rounded
    231 intxx265 tointegralx    -57.3   -> -57   Inexact Rounded
    232 
    233 rounding:    floor
    234 
    235 intxx270 tointegralx     55.7   ->  55   Inexact Rounded
    236 intxx271 tointegralx     56.7   ->  56   Inexact Rounded
    237 intxx272 tointegralx     57.7   ->  57   Inexact Rounded
    238 intxx273 tointegralx    -55.7   -> -56   Inexact Rounded
    239 intxx274 tointegralx    -56.7   -> -57   Inexact Rounded
    240 intxx275 tointegralx    -57.7   -> -58   Inexact Rounded
    241 
    242 -- Int and uInt32 edge values for testing conversions
    243 precision: 16
    244 intxx300 tointegralx -2147483646  -> -2147483646
    245 intxx301 tointegralx -2147483647  -> -2147483647
    246 intxx302 tointegralx -2147483648  -> -2147483648
    247 intxx303 tointegralx -2147483649  -> -2147483649
    248 intxx304 tointegralx  2147483646  ->  2147483646
    249 intxx305 tointegralx  2147483647  ->  2147483647
    250 intxx306 tointegralx  2147483648  ->  2147483648
    251 intxx307 tointegralx  2147483649  ->  2147483649
    252 intxx308 tointegralx  4294967294  ->  4294967294
    253 intxx309 tointegralx  4294967295  ->  4294967295
    254 intxx310 tointegralx  4294967296  ->  4294967296
    255 intxx311 tointegralx  4294967297  ->  4294967297
    256