Georg Brandl | faa9ad2 | 2011-03-05 15:06:13 +0100 | [diff] [blame] | 1 | ------------------------------------------------------------------------ |
| 2 | -- rotate.decTest -- rotate coefficient left or right -- |
| 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@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 | -- Sanity check |
| 29 | rotx001 rotate 0 0 -> 0 |
| 30 | rotx002 rotate 0 2 -> 0 |
| 31 | rotx003 rotate 1 2 -> 100 |
| 32 | rotx004 rotate 34 8 -> 400000003 |
| 33 | rotx005 rotate 1 9 -> 1 |
| 34 | rotx006 rotate 1 -1 -> 100000000 |
| 35 | rotx007 rotate 123456789 -1 -> 912345678 |
| 36 | rotx008 rotate 123456789 -8 -> 234567891 |
| 37 | rotx009 rotate 123456789 -9 -> 123456789 |
| 38 | rotx010 rotate 0 -2 -> 0 |
| 39 | |
| 40 | -- rhs must be an integer |
| 41 | rotx011 rotate 1 1.5 -> NaN Invalid_operation |
| 42 | rotx012 rotate 1 1.0 -> NaN Invalid_operation |
| 43 | rotx013 rotate 1 0.1 -> NaN Invalid_operation |
| 44 | rotx014 rotate 1 0.0 -> NaN Invalid_operation |
| 45 | rotx015 rotate 1 1E+1 -> NaN Invalid_operation |
| 46 | rotx016 rotate 1 1E+99 -> NaN Invalid_operation |
| 47 | rotx017 rotate 1 Inf -> NaN Invalid_operation |
| 48 | rotx018 rotate 1 -Inf -> NaN Invalid_operation |
| 49 | -- and |rhs| <= precision |
| 50 | rotx020 rotate 1 -1000 -> NaN Invalid_operation |
| 51 | rotx021 rotate 1 -10 -> NaN Invalid_operation |
| 52 | rotx022 rotate 1 10 -> NaN Invalid_operation |
| 53 | rotx023 rotate 1 1000 -> NaN Invalid_operation |
| 54 | |
| 55 | -- full pattern |
| 56 | rotx030 rotate 123456789 -9 -> 123456789 |
| 57 | rotx031 rotate 123456789 -8 -> 234567891 |
| 58 | rotx032 rotate 123456789 -7 -> 345678912 |
| 59 | rotx033 rotate 123456789 -6 -> 456789123 |
| 60 | rotx034 rotate 123456789 -5 -> 567891234 |
| 61 | rotx035 rotate 123456789 -4 -> 678912345 |
| 62 | rotx036 rotate 123456789 -3 -> 789123456 |
| 63 | rotx037 rotate 123456789 -2 -> 891234567 |
| 64 | rotx038 rotate 123456789 -1 -> 912345678 |
| 65 | rotx039 rotate 123456789 -0 -> 123456789 |
| 66 | rotx040 rotate 123456789 +0 -> 123456789 |
| 67 | rotx041 rotate 123456789 +1 -> 234567891 |
| 68 | rotx042 rotate 123456789 +2 -> 345678912 |
| 69 | rotx043 rotate 123456789 +3 -> 456789123 |
| 70 | rotx044 rotate 123456789 +4 -> 567891234 |
| 71 | rotx045 rotate 123456789 +5 -> 678912345 |
| 72 | rotx046 rotate 123456789 +6 -> 789123456 |
| 73 | rotx047 rotate 123456789 +7 -> 891234567 |
| 74 | rotx048 rotate 123456789 +8 -> 912345678 |
| 75 | rotx049 rotate 123456789 +9 -> 123456789 |
| 76 | |
| 77 | -- zeros |
| 78 | rotx060 rotate 0E-10 +9 -> 0E-10 |
| 79 | rotx061 rotate 0E-10 -9 -> 0E-10 |
| 80 | rotx062 rotate 0.000 +9 -> 0.000 |
| 81 | rotx063 rotate 0.000 -9 -> 0.000 |
| 82 | rotx064 rotate 0E+10 +9 -> 0E+10 |
| 83 | rotx065 rotate 0E+10 -9 -> 0E+10 |
| 84 | rotx066 rotate -0E-10 +9 -> -0E-10 |
| 85 | rotx067 rotate -0E-10 -9 -> -0E-10 |
| 86 | rotx068 rotate -0.000 +9 -> -0.000 |
| 87 | rotx069 rotate -0.000 -9 -> -0.000 |
| 88 | rotx070 rotate -0E+10 +9 -> -0E+10 |
| 89 | rotx071 rotate -0E+10 -9 -> -0E+10 |
| 90 | |
| 91 | -- Nmax, Nmin, Ntiny |
| 92 | rotx141 rotate 9.99999999E+999 -1 -> 9.99999999E+999 |
| 93 | rotx142 rotate 9.99999999E+999 -8 -> 9.99999999E+999 |
| 94 | rotx143 rotate 9.99999999E+999 1 -> 9.99999999E+999 |
| 95 | rotx144 rotate 9.99999999E+999 8 -> 9.99999999E+999 |
| 96 | rotx145 rotate 1E-999 -1 -> 1.00000000E-991 |
| 97 | rotx146 rotate 1E-999 -8 -> 1.0E-998 |
| 98 | rotx147 rotate 1E-999 1 -> 1.0E-998 |
| 99 | rotx148 rotate 1E-999 8 -> 1.00000000E-991 |
| 100 | rotx151 rotate 1.00000000E-999 -1 -> 1.0000000E-1000 |
| 101 | rotx152 rotate 1.00000000E-999 -8 -> 1E-1007 |
| 102 | rotx153 rotate 1.00000000E-999 1 -> 1E-1007 |
| 103 | rotx154 rotate 1.00000000E-999 8 -> 1.0000000E-1000 |
| 104 | rotx155 rotate 9.00000000E-999 -1 -> 9.0000000E-1000 |
| 105 | rotx156 rotate 9.00000000E-999 -8 -> 9E-1007 |
| 106 | rotx157 rotate 9.00000000E-999 1 -> 9E-1007 |
| 107 | rotx158 rotate 9.00000000E-999 8 -> 9.0000000E-1000 |
| 108 | rotx160 rotate 1E-1007 -1 -> 1.00000000E-999 |
| 109 | rotx161 rotate 1E-1007 -8 -> 1.0E-1006 |
| 110 | rotx162 rotate 1E-1007 1 -> 1.0E-1006 |
| 111 | rotx163 rotate 1E-1007 8 -> 1.00000000E-999 |
| 112 | -- negatives |
| 113 | rotx171 rotate -9.99999999E+999 -1 -> -9.99999999E+999 |
| 114 | rotx172 rotate -9.99999999E+999 -8 -> -9.99999999E+999 |
| 115 | rotx173 rotate -9.99999999E+999 1 -> -9.99999999E+999 |
| 116 | rotx174 rotate -9.99999999E+999 8 -> -9.99999999E+999 |
| 117 | rotx175 rotate -1E-999 -1 -> -1.00000000E-991 |
| 118 | rotx176 rotate -1E-999 -8 -> -1.0E-998 |
| 119 | rotx177 rotate -1E-999 1 -> -1.0E-998 |
| 120 | rotx178 rotate -1E-999 8 -> -1.00000000E-991 |
| 121 | rotx181 rotate -1.00000000E-999 -1 -> -1.0000000E-1000 |
| 122 | rotx182 rotate -1.00000000E-999 -8 -> -1E-1007 |
| 123 | rotx183 rotate -1.00000000E-999 1 -> -1E-1007 |
| 124 | rotx184 rotate -1.00000000E-999 8 -> -1.0000000E-1000 |
| 125 | rotx185 rotate -9.00000000E-999 -1 -> -9.0000000E-1000 |
| 126 | rotx186 rotate -9.00000000E-999 -8 -> -9E-1007 |
| 127 | rotx187 rotate -9.00000000E-999 1 -> -9E-1007 |
| 128 | rotx188 rotate -9.00000000E-999 8 -> -9.0000000E-1000 |
| 129 | rotx190 rotate -1E-1007 -1 -> -1.00000000E-999 |
| 130 | rotx191 rotate -1E-1007 -8 -> -1.0E-1006 |
| 131 | rotx192 rotate -1E-1007 1 -> -1.0E-1006 |
| 132 | rotx193 rotate -1E-1007 8 -> -1.00000000E-999 |
| 133 | |
| 134 | -- more negatives (of sanities) |
| 135 | rotx201 rotate -0 0 -> -0 |
| 136 | rotx202 rotate -0 2 -> -0 |
| 137 | rotx203 rotate -1 2 -> -100 |
| 138 | rotx204 rotate -1 8 -> -100000000 |
| 139 | rotx205 rotate -1 9 -> -1 |
| 140 | rotx206 rotate -1 -1 -> -100000000 |
| 141 | rotx207 rotate -123456789 -1 -> -912345678 |
| 142 | rotx208 rotate -123456789 -8 -> -234567891 |
| 143 | rotx209 rotate -123456789 -9 -> -123456789 |
| 144 | rotx210 rotate -0 -2 -> -0 |
| 145 | |
| 146 | -- Specials; NaNs are handled as usual |
| 147 | rotx781 rotate -Inf -8 -> -Infinity |
| 148 | rotx782 rotate -Inf -1 -> -Infinity |
| 149 | rotx783 rotate -Inf -0 -> -Infinity |
| 150 | rotx784 rotate -Inf 0 -> -Infinity |
| 151 | rotx785 rotate -Inf 1 -> -Infinity |
| 152 | rotx786 rotate -Inf 8 -> -Infinity |
| 153 | rotx787 rotate -1000 -Inf -> NaN Invalid_operation |
| 154 | rotx788 rotate -Inf -Inf -> NaN Invalid_operation |
| 155 | rotx789 rotate -1 -Inf -> NaN Invalid_operation |
| 156 | rotx790 rotate -0 -Inf -> NaN Invalid_operation |
| 157 | rotx791 rotate 0 -Inf -> NaN Invalid_operation |
| 158 | rotx792 rotate 1 -Inf -> NaN Invalid_operation |
| 159 | rotx793 rotate 1000 -Inf -> NaN Invalid_operation |
| 160 | rotx794 rotate Inf -Inf -> NaN Invalid_operation |
| 161 | |
| 162 | rotx800 rotate Inf -Inf -> NaN Invalid_operation |
| 163 | rotx801 rotate Inf -8 -> Infinity |
| 164 | rotx802 rotate Inf -1 -> Infinity |
| 165 | rotx803 rotate Inf -0 -> Infinity |
| 166 | rotx804 rotate Inf 0 -> Infinity |
| 167 | rotx805 rotate Inf 1 -> Infinity |
| 168 | rotx806 rotate Inf 8 -> Infinity |
| 169 | rotx807 rotate Inf Inf -> NaN Invalid_operation |
| 170 | rotx808 rotate -1000 Inf -> NaN Invalid_operation |
| 171 | rotx809 rotate -Inf Inf -> NaN Invalid_operation |
| 172 | rotx810 rotate -1 Inf -> NaN Invalid_operation |
| 173 | rotx811 rotate -0 Inf -> NaN Invalid_operation |
| 174 | rotx812 rotate 0 Inf -> NaN Invalid_operation |
| 175 | rotx813 rotate 1 Inf -> NaN Invalid_operation |
| 176 | rotx814 rotate 1000 Inf -> NaN Invalid_operation |
| 177 | rotx815 rotate Inf Inf -> NaN Invalid_operation |
| 178 | |
| 179 | rotx821 rotate NaN -Inf -> NaN |
| 180 | rotx822 rotate NaN -1000 -> NaN |
| 181 | rotx823 rotate NaN -1 -> NaN |
| 182 | rotx824 rotate NaN -0 -> NaN |
| 183 | rotx825 rotate NaN 0 -> NaN |
| 184 | rotx826 rotate NaN 1 -> NaN |
| 185 | rotx827 rotate NaN 1000 -> NaN |
| 186 | rotx828 rotate NaN Inf -> NaN |
| 187 | rotx829 rotate NaN NaN -> NaN |
| 188 | rotx830 rotate -Inf NaN -> NaN |
| 189 | rotx831 rotate -1000 NaN -> NaN |
| 190 | rotx832 rotate -1 NaN -> NaN |
| 191 | rotx833 rotate -0 NaN -> NaN |
| 192 | rotx834 rotate 0 NaN -> NaN |
| 193 | rotx835 rotate 1 NaN -> NaN |
| 194 | rotx836 rotate 1000 NaN -> NaN |
| 195 | rotx837 rotate Inf NaN -> NaN |
| 196 | |
| 197 | |
| 198 | |
| 199 | rotx841 rotate sNaN -Inf -> NaN Invalid_operation |
| 200 | rotx842 rotate sNaN -1000 -> NaN Invalid_operation |
| 201 | rotx843 rotate sNaN -1 -> NaN Invalid_operation |
| 202 | rotx844 rotate sNaN -0 -> NaN Invalid_operation |
| 203 | rotx845 rotate sNaN 0 -> NaN Invalid_operation |
| 204 | rotx846 rotate sNaN 1 -> NaN Invalid_operation |
| 205 | rotx847 rotate sNaN 1000 -> NaN Invalid_operation |
| 206 | rotx848 rotate sNaN NaN -> NaN Invalid_operation |
| 207 | rotx849 rotate sNaN sNaN -> NaN Invalid_operation |
| 208 | rotx850 rotate NaN sNaN -> NaN Invalid_operation |
| 209 | rotx851 rotate -Inf sNaN -> NaN Invalid_operation |
| 210 | rotx852 rotate -1000 sNaN -> NaN Invalid_operation |
| 211 | rotx853 rotate -1 sNaN -> NaN Invalid_operation |
| 212 | rotx854 rotate -0 sNaN -> NaN Invalid_operation |
| 213 | rotx855 rotate 0 sNaN -> NaN Invalid_operation |
| 214 | rotx856 rotate 1 sNaN -> NaN Invalid_operation |
| 215 | rotx857 rotate 1000 sNaN -> NaN Invalid_operation |
| 216 | rotx858 rotate Inf sNaN -> NaN Invalid_operation |
| 217 | rotx859 rotate NaN sNaN -> NaN Invalid_operation |
| 218 | |
| 219 | -- propagating NaNs |
| 220 | rotx861 rotate NaN1 -Inf -> NaN1 |
| 221 | rotx862 rotate +NaN2 -1000 -> NaN2 |
| 222 | rotx863 rotate NaN3 1000 -> NaN3 |
| 223 | rotx864 rotate NaN4 Inf -> NaN4 |
| 224 | rotx865 rotate NaN5 +NaN6 -> NaN5 |
| 225 | rotx866 rotate -Inf NaN7 -> NaN7 |
| 226 | rotx867 rotate -1000 NaN8 -> NaN8 |
| 227 | rotx868 rotate 1000 NaN9 -> NaN9 |
| 228 | rotx869 rotate Inf +NaN10 -> NaN10 |
| 229 | rotx871 rotate sNaN11 -Inf -> NaN11 Invalid_operation |
| 230 | rotx872 rotate sNaN12 -1000 -> NaN12 Invalid_operation |
| 231 | rotx873 rotate sNaN13 1000 -> NaN13 Invalid_operation |
| 232 | rotx874 rotate sNaN14 NaN17 -> NaN14 Invalid_operation |
| 233 | rotx875 rotate sNaN15 sNaN18 -> NaN15 Invalid_operation |
| 234 | rotx876 rotate NaN16 sNaN19 -> NaN19 Invalid_operation |
| 235 | rotx877 rotate -Inf +sNaN20 -> NaN20 Invalid_operation |
| 236 | rotx878 rotate -1000 sNaN21 -> NaN21 Invalid_operation |
| 237 | rotx879 rotate 1000 sNaN22 -> NaN22 Invalid_operation |
| 238 | rotx880 rotate Inf sNaN23 -> NaN23 Invalid_operation |
| 239 | rotx881 rotate +NaN25 +sNaN24 -> NaN24 Invalid_operation |
| 240 | rotx882 rotate -NaN26 NaN28 -> -NaN26 |
| 241 | rotx883 rotate -sNaN27 sNaN29 -> -NaN27 Invalid_operation |
| 242 | rotx884 rotate 1000 -NaN30 -> -NaN30 |
| 243 | rotx885 rotate 1000 -sNaN31 -> -NaN31 Invalid_operation |
| 244 | |
| 245 | -- payload decapitate |
| 246 | precision: 5 |
| 247 | rotx886 rotate 11 -sNaN1234567890 -> -NaN67890 Invalid_operation |