Home | History | Annotate | Download | only in decimaltestdata
      1 ------------------------------------------------------------------------
      2 -- scaleb.decTest -- scale a number by powers of 10                   --
      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 extended:    1
     23 precision:   9
     24 rounding:    half_up
     25 maxExponent: 999
     26 minExponent: -999
     27 
     28 -- Max |rhs| is 2*(999+9) = 2016
     29 
     30 -- Sanity checks
     31 scbx001 scaleb       7.50   10 -> 7.50E+10
     32 scbx002 scaleb       7.50    3 -> 7.50E+3
     33 scbx003 scaleb       7.50    2 -> 750
     34 scbx004 scaleb       7.50    1 -> 75.0
     35 scbx005 scaleb       7.50    0 -> 7.50
     36 scbx006 scaleb       7.50   -1 -> 0.750
     37 scbx007 scaleb       7.50   -2 -> 0.0750
     38 scbx008 scaleb       7.50  -10 -> 7.50E-10
     39 scbx009 scaleb      -7.50    3 -> -7.50E+3
     40 scbx010 scaleb      -7.50    2 -> -750
     41 scbx011 scaleb      -7.50    1 -> -75.0
     42 scbx012 scaleb      -7.50    0 -> -7.50
     43 scbx013 scaleb      -7.50   -1 -> -0.750
     44 
     45 -- Infinities
     46 scbx014 scaleb  Infinity   1 -> Infinity
     47 scbx015 scaleb  -Infinity  2 -> -Infinity
     48 scbx016 scaleb  Infinity  -1 -> Infinity
     49 scbx017 scaleb  -Infinity -2 -> -Infinity
     50 
     51 -- Next two are somewhat undefined in 754r; treat as non-integer
     52 scbx018 scaleb  10  Infinity -> NaN Invalid_operation
     53 scbx019 scaleb  10 -Infinity -> NaN Invalid_operation
     54 
     55 -- NaNs are undefined in 754r; assume usual processing
     56 -- NaNs, 0 payload
     57 scbx021 scaleb         NaN  1 -> NaN
     58 scbx022 scaleb        -NaN -1 -> -NaN
     59 scbx023 scaleb        sNaN  1 -> NaN Invalid_operation
     60 scbx024 scaleb       -sNaN  1 -> -NaN Invalid_operation
     61 scbx025 scaleb    4    NaN    -> NaN
     62 scbx026 scaleb -Inf   -NaN    -> -NaN
     63 scbx027 scaleb    4   sNaN    -> NaN Invalid_operation
     64 scbx028 scaleb  Inf  -sNaN    -> -NaN Invalid_operation
     65 
     66 -- non-integer RHS
     67 scbx030 scaleb  1.23    1    ->  12.3
     68 scbx031 scaleb  1.23    1.00 ->  NaN Invalid_operation
     69 scbx032 scaleb  1.23    1.1  ->  NaN Invalid_operation
     70 scbx033 scaleb  1.23    1.01 ->  NaN Invalid_operation
     71 scbx034 scaleb  1.23    0.01 ->  NaN Invalid_operation
     72 scbx035 scaleb  1.23    0.11 ->  NaN Invalid_operation
     73 scbx036 scaleb  1.23    0.999999999 ->  NaN Invalid_operation
     74 scbx037 scaleb  1.23   -1    ->  0.123
     75 scbx038 scaleb  1.23   -1.00 ->  NaN Invalid_operation
     76 scbx039 scaleb  1.23   -1.1  ->  NaN Invalid_operation
     77 scbx040 scaleb  1.23   -1.01 ->  NaN Invalid_operation
     78 scbx041 scaleb  1.23   -0.01 ->  NaN Invalid_operation
     79 scbx042 scaleb  1.23   -0.11 ->  NaN Invalid_operation
     80 scbx043 scaleb  1.23   -0.999999999 ->  NaN Invalid_operation
     81 scbx044 scaleb  1.23    0.1         ->  NaN Invalid_operation
     82 scbx045 scaleb  1.23    1E+1        ->  NaN Invalid_operation
     83 scbx046 scaleb  1.23    1.1234E+6   ->  NaN Invalid_operation
     84 scbx047 scaleb  1.23    1.123E+4    ->  NaN Invalid_operation
     85 
     86 
     87 scbx120 scaleb  1.23    2015        ->  Infinity Overflow Inexact Rounded
     88 scbx121 scaleb  1.23    2016        ->  Infinity Overflow Inexact Rounded
     89 scbx122 scaleb  1.23    2017        ->  NaN Invalid_operation
     90 scbx123 scaleb  1.23    2018        ->  NaN Invalid_operation
     91 scbx124 scaleb  1.23   -2015        ->  0E-1007 Underflow Subnormal Inexact Rounded Clamped
     92 scbx125 scaleb  1.23   -2016        ->  0E-1007 Underflow Subnormal Inexact Rounded Clamped
     93 scbx126 scaleb  1.23   -2017        ->  NaN Invalid_operation
     94 scbx127 scaleb  1.23   -2018        ->  NaN Invalid_operation
     95 
     96 -- NaNs, non-0 payload
     97 -- propagating NaNs
     98 scbx861 scaleb  NaN01   -Inf     ->  NaN1
     99 scbx862 scaleb -NaN02   -1000    -> -NaN2
    100 scbx863 scaleb  NaN03    1000    ->  NaN3
    101 scbx864 scaleb  NaN04    Inf     ->  NaN4
    102 scbx865 scaleb  NaN05    NaN61   ->  NaN5
    103 scbx866 scaleb -Inf     -NaN71   -> -NaN71
    104 scbx867 scaleb -1000     NaN81   ->  NaN81
    105 scbx868 scaleb  1000     NaN91   ->  NaN91
    106 scbx869 scaleb  Inf      NaN101  ->  NaN101
    107 scbx871 scaleb  sNaN011  -Inf    ->  NaN11  Invalid_operation
    108 scbx872 scaleb  sNaN012  -1000   ->  NaN12  Invalid_operation
    109 scbx873 scaleb -sNaN013   1000   -> -NaN13  Invalid_operation
    110 scbx874 scaleb  sNaN014   NaN171 ->  NaN14  Invalid_operation
    111 scbx875 scaleb  sNaN015  sNaN181 ->  NaN15  Invalid_operation
    112 scbx876 scaleb  NaN016   sNaN191 ->  NaN191 Invalid_operation
    113 scbx877 scaleb -Inf      sNaN201 ->  NaN201 Invalid_operation
    114 scbx878 scaleb -1000     sNaN211 ->  NaN211 Invalid_operation
    115 scbx879 scaleb  1000    -sNaN221 -> -NaN221 Invalid_operation
    116 scbx880 scaleb  Inf      sNaN231 ->  NaN231 Invalid_operation
    117 scbx881 scaleb  NaN025   sNaN241 ->  NaN241 Invalid_operation
    118 
    119 -- finites
    120 scbx051 scaleb          7   -2  -> 0.07
    121 scbx052 scaleb         -7   -2  -> -0.07
    122 scbx053 scaleb         75   -2  -> 0.75
    123 scbx054 scaleb        -75   -2  -> -0.75
    124 scbx055 scaleb       7.50   -2  -> 0.0750
    125 scbx056 scaleb      -7.50   -2  -> -0.0750
    126 scbx057 scaleb       7.500  -2  -> 0.07500
    127 scbx058 scaleb      -7.500  -2  -> -0.07500
    128 scbx061 scaleb          7   -1  -> 0.7
    129 scbx062 scaleb         -7   -1  -> -0.7
    130 scbx063 scaleb         75   -1  -> 7.5
    131 scbx064 scaleb        -75   -1  -> -7.5
    132 scbx065 scaleb       7.50   -1  -> 0.750
    133 scbx066 scaleb      -7.50   -1  -> -0.750
    134 scbx067 scaleb       7.500  -1  -> 0.7500
    135 scbx068 scaleb      -7.500  -1  -> -0.7500
    136 scbx071 scaleb          7    0  -> 7
    137 scbx072 scaleb         -7    0  -> -7
    138 scbx073 scaleb         75    0  -> 75
    139 scbx074 scaleb        -75    0  -> -75
    140 scbx075 scaleb       7.50    0  -> 7.50
    141 scbx076 scaleb      -7.50    0  -> -7.50
    142 scbx077 scaleb       7.500   0  -> 7.500
    143 scbx078 scaleb      -7.500   0  -> -7.500
    144 scbx081 scaleb          7    1  -> 7E+1
    145 scbx082 scaleb         -7    1  -> -7E+1
    146 scbx083 scaleb         75    1  -> 7.5E+2
    147 scbx084 scaleb        -75    1  -> -7.5E+2
    148 scbx085 scaleb       7.50    1  -> 75.0
    149 scbx086 scaleb      -7.50    1  -> -75.0
    150 scbx087 scaleb       7.500   1  -> 75.00
    151 scbx088 scaleb      -7.500   1  -> -75.00
    152 scbx091 scaleb          7    2  -> 7E+2
    153 scbx092 scaleb         -7    2  -> -7E+2
    154 scbx093 scaleb         75    2  -> 7.5E+3
    155 scbx094 scaleb        -75    2  -> -7.5E+3
    156 scbx095 scaleb       7.50    2  -> 750
    157 scbx096 scaleb      -7.50    2  -> -750
    158 scbx097 scaleb       7.500   2  -> 750.0
    159 scbx098 scaleb      -7.500   2  -> -750.0
    160 
    161 -- zeros
    162 scbx111 scaleb          0  1 -> 0E+1
    163 scbx112 scaleb         -0  2 -> -0E+2
    164 scbx113 scaleb       0E+4  3 -> 0E+7
    165 scbx114 scaleb      -0E+4  4 -> -0E+8
    166 scbx115 scaleb     0.0000  5 -> 0E+1
    167 scbx116 scaleb    -0.0000  6 -> -0E+2
    168 scbx117 scaleb      0E-141 7 -> 0E-134
    169 scbx118 scaleb     -0E-141 8 -> -0E-133
    170 
    171 -- Nmax, Nmin, Ntiny
    172 scbx132 scaleb  9.99999999E+999 +999 -> Infinity    Overflow Inexact Rounded
    173 scbx133 scaleb  9.99999999E+999  +10 -> Infinity     Overflow Inexact Rounded
    174 scbx134 scaleb  9.99999999E+999  +1  -> Infinity     Overflow Inexact Rounded
    175 scbx135 scaleb  9.99999999E+999   0  -> 9.99999999E+999
    176 scbx136 scaleb  9.99999999E+999  -1  -> 9.99999999E+998
    177 scbx137 scaleb  1E-999           +1  -> 1E-998
    178 scbx138 scaleb  1E-999           -0  -> 1E-999
    179 scbx139 scaleb  1E-999           -1  -> 1E-1000         Subnormal
    180 scbx140 scaleb  1.00000000E-999  +1  -> 1.00000000E-998
    181 scbx141 scaleb  1.00000000E-999   0  -> 1.00000000E-999
    182 scbx142 scaleb  1.00000000E-999  -1  -> 1.0000000E-1000 Subnormal Rounded
    183 scbx143 scaleb  1E-1007          +1  -> 1E-1006         Subnormal
    184 scbx144 scaleb  1E-1007          -0  -> 1E-1007         Subnormal
    185 scbx145 scaleb  1E-1007          -1  -> 0E-1007         Underflow Subnormal Inexact Rounded Clamped
    186 
    187 scbx150 scaleb  -1E-1007         +1  -> -1E-1006        Subnormal
    188 scbx151 scaleb  -1E-1007         -0  -> -1E-1007        Subnormal
    189 scbx152 scaleb  -1E-1007         -1  -> -0E-1007        Underflow Subnormal Inexact Rounded Clamped
    190 scbx153 scaleb  -1.00000000E-999 +1  -> -1.00000000E-998
    191 scbx154 scaleb  -1.00000000E-999 +0  -> -1.00000000E-999
    192 scbx155 scaleb  -1.00000000E-999 -1  -> -1.0000000E-1000 Subnormal Rounded
    193 scbx156 scaleb  -1E-999          +1  -> -1E-998
    194 scbx157 scaleb  -1E-999          -0  -> -1E-999
    195 scbx158 scaleb  -1E-999          -1  -> -1E-1000         Subnormal
    196 scbx159 scaleb  -9.99999999E+999 +1  -> -Infinity        Overflow Inexact Rounded
    197 scbx160 scaleb  -9.99999999E+999 +0  -> -9.99999999E+999
    198 scbx161 scaleb  -9.99999999E+999 -1  -> -9.99999999E+998
    199 scbx162 scaleb  -9E+999          +1  -> -Infinity        Overflow Inexact Rounded
    200 scbx163 scaleb  -1E+999          +1  -> -Infinity        Overflow Inexact Rounded
    201 
    202 -- Krah examples
    203 precision:   34
    204 maxExponent: 999999999
    205 minExponent: -999999999
    206 -- integer overflow in 3.61 or earlier
    207 scbx164 scaleb  1E-999999999  -1200000000  -> NaN Invalid_operation
    208 -- out of range
    209 scbx165 scaleb  -1E-999999999  +1200000000  -> NaN Invalid_operation
    210