1 ------------------------------------------------------------------------ 2 -- ddRotate.decTest -- rotate a decDouble 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 (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 -- Sanity check 30 ddrot001 rotate 0 0 -> 0 31 ddrot002 rotate 0 2 -> 0 32 ddrot003 rotate 1 2 -> 100 33 ddrot004 rotate 1 15 -> 1000000000000000 34 ddrot005 rotate 1 16 -> 1 35 ddrot006 rotate 1 -1 -> 1000000000000000 36 ddrot007 rotate 0 -2 -> 0 37 ddrot008 rotate 1234567890123456 -1 -> 6123456789012345 38 ddrot009 rotate 1234567890123456 -15 -> 2345678901234561 39 ddrot010 rotate 1234567890123456 -16 -> 1234567890123456 40 ddrot011 rotate 9934567890123456 -15 -> 9345678901234569 41 ddrot012 rotate 9934567890123456 -16 -> 9934567890123456 42 43 -- rhs must be an integer 44 ddrot015 rotate 1 1.5 -> NaN Invalid_operation 45 ddrot016 rotate 1 1.0 -> NaN Invalid_operation 46 ddrot017 rotate 1 0.1 -> NaN Invalid_operation 47 ddrot018 rotate 1 0.0 -> NaN Invalid_operation 48 ddrot019 rotate 1 1E+1 -> NaN Invalid_operation 49 ddrot020 rotate 1 1E+99 -> NaN Invalid_operation 50 ddrot021 rotate 1 Inf -> NaN Invalid_operation 51 ddrot022 rotate 1 -Inf -> NaN Invalid_operation 52 -- and |rhs| <= precision 53 ddrot025 rotate 1 -1000 -> NaN Invalid_operation 54 ddrot026 rotate 1 -17 -> NaN Invalid_operation 55 ddrot027 rotate 1 17 -> NaN Invalid_operation 56 ddrot028 rotate 1 1000 -> NaN Invalid_operation 57 58 -- full pattern 59 ddrot030 rotate 1234567890123456 -16 -> 1234567890123456 60 ddrot031 rotate 1234567890123456 -15 -> 2345678901234561 61 ddrot032 rotate 1234567890123456 -14 -> 3456789012345612 62 ddrot033 rotate 1234567890123456 -13 -> 4567890123456123 63 ddrot034 rotate 1234567890123456 -12 -> 5678901234561234 64 ddrot035 rotate 1234567890123456 -11 -> 6789012345612345 65 ddrot036 rotate 1234567890123456 -10 -> 7890123456123456 66 ddrot037 rotate 1234567890123456 -9 -> 8901234561234567 67 ddrot038 rotate 1234567890123456 -8 -> 9012345612345678 68 ddrot039 rotate 1234567890123456 -7 -> 123456123456789 69 ddrot040 rotate 1234567890123456 -6 -> 1234561234567890 70 ddrot041 rotate 1234567890123456 -5 -> 2345612345678901 71 ddrot042 rotate 1234567890123456 -4 -> 3456123456789012 72 ddrot043 rotate 1234567890123456 -3 -> 4561234567890123 73 ddrot044 rotate 1234567890123456 -2 -> 5612345678901234 74 ddrot045 rotate 1234567890123456 -1 -> 6123456789012345 75 ddrot046 rotate 1234567890123456 -0 -> 1234567890123456 76 77 ddrot047 rotate 1234567890123456 +0 -> 1234567890123456 78 ddrot048 rotate 1234567890123456 +1 -> 2345678901234561 79 ddrot049 rotate 1234567890123456 +2 -> 3456789012345612 80 ddrot050 rotate 1234567890123456 +3 -> 4567890123456123 81 ddrot051 rotate 1234567890123456 +4 -> 5678901234561234 82 ddrot052 rotate 1234567890123456 +5 -> 6789012345612345 83 ddrot053 rotate 1234567890123456 +6 -> 7890123456123456 84 ddrot054 rotate 1234567890123456 +7 -> 8901234561234567 85 ddrot055 rotate 1234567890123456 +8 -> 9012345612345678 86 ddrot056 rotate 1234567890123456 +9 -> 123456123456789 87 ddrot057 rotate 1234567890123456 +10 -> 1234561234567890 88 ddrot058 rotate 1234567890123456 +11 -> 2345612345678901 89 ddrot059 rotate 1234567890123456 +12 -> 3456123456789012 90 ddrot060 rotate 1234567890123456 +13 -> 4561234567890123 91 ddrot061 rotate 1234567890123456 +14 -> 5612345678901234 92 ddrot062 rotate 1234567890123456 +15 -> 6123456789012345 93 ddrot063 rotate 1234567890123456 +16 -> 1234567890123456 94 95 -- zeros 96 ddrot070 rotate 0E-10 +9 -> 0E-10 97 ddrot071 rotate 0E-10 -9 -> 0E-10 98 ddrot072 rotate 0.000 +9 -> 0.000 99 ddrot073 rotate 0.000 -9 -> 0.000 100 ddrot074 rotate 0E+10 +9 -> 0E+10 101 ddrot075 rotate 0E+10 -9 -> 0E+10 102 ddrot076 rotate -0E-10 +9 -> -0E-10 103 ddrot077 rotate -0E-10 -9 -> -0E-10 104 ddrot078 rotate -0.000 +9 -> -0.000 105 ddrot079 rotate -0.000 -9 -> -0.000 106 ddrot080 rotate -0E+10 +9 -> -0E+10 107 ddrot081 rotate -0E+10 -9 -> -0E+10 108 109 -- Nmax, Nmin, Ntiny 110 ddrot141 rotate 9.999999999999999E+384 -1 -> 9.999999999999999E+384 111 ddrot142 rotate 9.999999999999999E+384 -15 -> 9.999999999999999E+384 112 ddrot143 rotate 9.999999999999999E+384 1 -> 9.999999999999999E+384 113 ddrot144 rotate 9.999999999999999E+384 15 -> 9.999999999999999E+384 114 ddrot145 rotate 1E-383 -1 -> 1.000000000000000E-368 115 ddrot146 rotate 1E-383 -15 -> 1.0E-382 116 ddrot147 rotate 1E-383 1 -> 1.0E-382 117 ddrot148 rotate 1E-383 15 -> 1.000000000000000E-368 118 ddrot151 rotate 1.000000000000000E-383 -1 -> 1.00000000000000E-384 119 ddrot152 rotate 1.000000000000000E-383 -15 -> 1E-398 120 ddrot153 rotate 1.000000000000000E-383 1 -> 1E-398 121 ddrot154 rotate 1.000000000000000E-383 15 -> 1.00000000000000E-384 122 ddrot155 rotate 9.000000000000000E-383 -1 -> 9.00000000000000E-384 123 ddrot156 rotate 9.000000000000000E-383 -15 -> 9E-398 124 ddrot157 rotate 9.000000000000000E-383 1 -> 9E-398 125 ddrot158 rotate 9.000000000000000E-383 15 -> 9.00000000000000E-384 126 ddrot160 rotate 1E-398 -1 -> 1.000000000000000E-383 127 ddrot161 rotate 1E-398 -15 -> 1.0E-397 128 ddrot162 rotate 1E-398 1 -> 1.0E-397 129 ddrot163 rotate 1E-398 15 -> 1.000000000000000E-383 130 -- negatives 131 ddrot171 rotate -9.999999999999999E+384 -1 -> -9.999999999999999E+384 132 ddrot172 rotate -9.999999999999999E+384 -15 -> -9.999999999999999E+384 133 ddrot173 rotate -9.999999999999999E+384 1 -> -9.999999999999999E+384 134 ddrot174 rotate -9.999999999999999E+384 15 -> -9.999999999999999E+384 135 ddrot175 rotate -1E-383 -1 -> -1.000000000000000E-368 136 ddrot176 rotate -1E-383 -15 -> -1.0E-382 137 ddrot177 rotate -1E-383 1 -> -1.0E-382 138 ddrot178 rotate -1E-383 15 -> -1.000000000000000E-368 139 ddrot181 rotate -1.000000000000000E-383 -1 -> -1.00000000000000E-384 140 ddrot182 rotate -1.000000000000000E-383 -15 -> -1E-398 141 ddrot183 rotate -1.000000000000000E-383 1 -> -1E-398 142 ddrot184 rotate -1.000000000000000E-383 15 -> -1.00000000000000E-384 143 ddrot185 rotate -9.000000000000000E-383 -1 -> -9.00000000000000E-384 144 ddrot186 rotate -9.000000000000000E-383 -15 -> -9E-398 145 ddrot187 rotate -9.000000000000000E-383 1 -> -9E-398 146 ddrot188 rotate -9.000000000000000E-383 15 -> -9.00000000000000E-384 147 ddrot190 rotate -1E-398 -1 -> -1.000000000000000E-383 148 ddrot191 rotate -1E-398 -15 -> -1.0E-397 149 ddrot192 rotate -1E-398 1 -> -1.0E-397 150 ddrot193 rotate -1E-398 15 -> -1.000000000000000E-383 151 152 -- more negatives (of sanities) 153 ddrot201 rotate -0 0 -> -0 154 ddrot202 rotate -0 2 -> -0 155 ddrot203 rotate -1 2 -> -100 156 ddrot204 rotate -1 15 -> -1000000000000000 157 ddrot205 rotate -1 16 -> -1 158 ddrot206 rotate -1 -1 -> -1000000000000000 159 ddrot207 rotate -0 -2 -> -0 160 ddrot208 rotate -1234567890123456 -1 -> -6123456789012345 161 ddrot209 rotate -1234567890123456 -15 -> -2345678901234561 162 ddrot210 rotate -1234567890123456 -16 -> -1234567890123456 163 ddrot211 rotate -9934567890123456 -15 -> -9345678901234569 164 ddrot212 rotate -9934567890123456 -16 -> -9934567890123456 165 166 167 -- Specials; NaNs are handled as usual 168 ddrot781 rotate -Inf -8 -> -Infinity 169 ddrot782 rotate -Inf -1 -> -Infinity 170 ddrot783 rotate -Inf -0 -> -Infinity 171 ddrot784 rotate -Inf 0 -> -Infinity 172 ddrot785 rotate -Inf 1 -> -Infinity 173 ddrot786 rotate -Inf 8 -> -Infinity 174 ddrot787 rotate -1000 -Inf -> NaN Invalid_operation 175 ddrot788 rotate -Inf -Inf -> NaN Invalid_operation 176 ddrot789 rotate -1 -Inf -> NaN Invalid_operation 177 ddrot790 rotate -0 -Inf -> NaN Invalid_operation 178 ddrot791 rotate 0 -Inf -> NaN Invalid_operation 179 ddrot792 rotate 1 -Inf -> NaN Invalid_operation 180 ddrot793 rotate 1000 -Inf -> NaN Invalid_operation 181 ddrot794 rotate Inf -Inf -> NaN Invalid_operation 182 183 ddrot800 rotate Inf -Inf -> NaN Invalid_operation 184 ddrot801 rotate Inf -8 -> Infinity 185 ddrot802 rotate Inf -1 -> Infinity 186 ddrot803 rotate Inf -0 -> Infinity 187 ddrot804 rotate Inf 0 -> Infinity 188 ddrot805 rotate Inf 1 -> Infinity 189 ddrot806 rotate Inf 8 -> Infinity 190 ddrot807 rotate Inf Inf -> NaN Invalid_operation 191 ddrot808 rotate -1000 Inf -> NaN Invalid_operation 192 ddrot809 rotate -Inf Inf -> NaN Invalid_operation 193 ddrot810 rotate -1 Inf -> NaN Invalid_operation 194 ddrot811 rotate -0 Inf -> NaN Invalid_operation 195 ddrot812 rotate 0 Inf -> NaN Invalid_operation 196 ddrot813 rotate 1 Inf -> NaN Invalid_operation 197 ddrot814 rotate 1000 Inf -> NaN Invalid_operation 198 ddrot815 rotate Inf Inf -> NaN Invalid_operation 199 200 ddrot821 rotate NaN -Inf -> NaN 201 ddrot822 rotate NaN -1000 -> NaN 202 ddrot823 rotate NaN -1 -> NaN 203 ddrot824 rotate NaN -0 -> NaN 204 ddrot825 rotate NaN 0 -> NaN 205 ddrot826 rotate NaN 1 -> NaN 206 ddrot827 rotate NaN 1000 -> NaN 207 ddrot828 rotate NaN Inf -> NaN 208 ddrot829 rotate NaN NaN -> NaN 209 ddrot830 rotate -Inf NaN -> NaN 210 ddrot831 rotate -1000 NaN -> NaN 211 ddrot832 rotate -1 NaN -> NaN 212 ddrot833 rotate -0 NaN -> NaN 213 ddrot834 rotate 0 NaN -> NaN 214 ddrot835 rotate 1 NaN -> NaN 215 ddrot836 rotate 1000 NaN -> NaN 216 ddrot837 rotate Inf NaN -> NaN 217 218 ddrot841 rotate sNaN -Inf -> NaN Invalid_operation 219 ddrot842 rotate sNaN -1000 -> NaN Invalid_operation 220 ddrot843 rotate sNaN -1 -> NaN Invalid_operation 221 ddrot844 rotate sNaN -0 -> NaN Invalid_operation 222 ddrot845 rotate sNaN 0 -> NaN Invalid_operation 223 ddrot846 rotate sNaN 1 -> NaN Invalid_operation 224 ddrot847 rotate sNaN 1000 -> NaN Invalid_operation 225 ddrot848 rotate sNaN NaN -> NaN Invalid_operation 226 ddrot849 rotate sNaN sNaN -> NaN Invalid_operation 227 ddrot850 rotate NaN sNaN -> NaN Invalid_operation 228 ddrot851 rotate -Inf sNaN -> NaN Invalid_operation 229 ddrot852 rotate -1000 sNaN -> NaN Invalid_operation 230 ddrot853 rotate -1 sNaN -> NaN Invalid_operation 231 ddrot854 rotate -0 sNaN -> NaN Invalid_operation 232 ddrot855 rotate 0 sNaN -> NaN Invalid_operation 233 ddrot856 rotate 1 sNaN -> NaN Invalid_operation 234 ddrot857 rotate 1000 sNaN -> NaN Invalid_operation 235 ddrot858 rotate Inf sNaN -> NaN Invalid_operation 236 ddrot859 rotate NaN sNaN -> NaN Invalid_operation 237 238 -- propagating NaNs 239 ddrot861 rotate NaN1 -Inf -> NaN1 240 ddrot862 rotate +NaN2 -1000 -> NaN2 241 ddrot863 rotate NaN3 1000 -> NaN3 242 ddrot864 rotate NaN4 Inf -> NaN4 243 ddrot865 rotate NaN5 +NaN6 -> NaN5 244 ddrot866 rotate -Inf NaN7 -> NaN7 245 ddrot867 rotate -1000 NaN8 -> NaN8 246 ddrot868 rotate 1000 NaN9 -> NaN9 247 ddrot869 rotate Inf +NaN10 -> NaN10 248 ddrot871 rotate sNaN11 -Inf -> NaN11 Invalid_operation 249 ddrot872 rotate sNaN12 -1000 -> NaN12 Invalid_operation 250 ddrot873 rotate sNaN13 1000 -> NaN13 Invalid_operation 251 ddrot874 rotate sNaN14 NaN17 -> NaN14 Invalid_operation 252 ddrot875 rotate sNaN15 sNaN18 -> NaN15 Invalid_operation 253 ddrot876 rotate NaN16 sNaN19 -> NaN19 Invalid_operation 254 ddrot877 rotate -Inf +sNaN20 -> NaN20 Invalid_operation 255 ddrot878 rotate -1000 sNaN21 -> NaN21 Invalid_operation 256 ddrot879 rotate 1000 sNaN22 -> NaN22 Invalid_operation 257 ddrot880 rotate Inf sNaN23 -> NaN23 Invalid_operation 258 ddrot881 rotate +NaN25 +sNaN24 -> NaN24 Invalid_operation 259 ddrot882 rotate -NaN26 NaN28 -> -NaN26 260 ddrot883 rotate -sNaN27 sNaN29 -> -NaN27 Invalid_operation 261 ddrot884 rotate 1000 -NaN30 -> -NaN30 262 ddrot885 rotate 1000 -sNaN31 -> -NaN31 Invalid_operation 263