1 ------------------------------------------------------------------------ 2 -- ddXor.decTest -- digitwise logical XOR for decDoubles -- 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 (truth table) 30 ddxor001 xor 0 0 -> 0 31 ddxor002 xor 0 1 -> 1 32 ddxor003 xor 1 0 -> 1 33 ddxor004 xor 1 1 -> 0 34 ddxor005 xor 1100 1010 -> 110 35 -- and at msd and msd-1 36 ddxor006 xor 0000000000000000 0000000000000000 -> 0 37 ddxor007 xor 0000000000000000 1000000000000000 -> 1000000000000000 38 ddxor008 xor 1000000000000000 0000000000000000 -> 1000000000000000 39 ddxor009 xor 1000000000000000 1000000000000000 -> 0 40 ddxor010 xor 0000000000000000 0000000000000000 -> 0 41 ddxor011 xor 0000000000000000 0100000000000000 -> 100000000000000 42 ddxor012 xor 0100000000000000 0000000000000000 -> 100000000000000 43 ddxor013 xor 0100000000000000 0100000000000000 -> 0 44 45 -- Various lengths 46 -- 1234567890123456 1234567890123456 1234567890123456 47 ddxor021 xor 1111111110000000 1111111110000000 -> 0 48 ddxor022 xor 111111110000000 111111110000000 -> 0 49 ddxor023 xor 11111110000000 11111110000000 -> 0 50 ddxor024 xor 1111110000000 1111110000000 -> 0 51 ddxor025 xor 111110000000 111110000000 -> 0 52 ddxor026 xor 11110000000 11110000000 -> 0 53 ddxor027 xor 1110000000 1110000000 -> 0 54 ddxor028 xor 110000000 110000000 -> 0 55 ddxor029 xor 10000000 10000000 -> 0 56 ddxor030 xor 1000000 1000000 -> 0 57 ddxor031 xor 100000 100000 -> 0 58 ddxor032 xor 10000 10000 -> 0 59 ddxor033 xor 1000 1000 -> 0 60 ddxor034 xor 100 100 -> 0 61 ddxor035 xor 10 10 -> 0 62 ddxor036 xor 1 1 -> 0 63 64 ddxor040 xor 111111111 111111111111 -> 111000000000 65 ddxor041 xor 11111111 111111111111 -> 111100000000 66 ddxor042 xor 11111111 111111111 -> 100000000 67 ddxor043 xor 1111111 100000010 -> 101111101 68 ddxor044 xor 111111 100000100 -> 100111011 69 ddxor045 xor 11111 100001000 -> 100010111 70 ddxor046 xor 1111 100010000 -> 100011111 71 ddxor047 xor 111 100100000 -> 100100111 72 ddxor048 xor 11 101000000 -> 101000011 73 ddxor049 xor 1 110000000 -> 110000001 74 75 ddxor050 xor 1111111111 1 -> 1111111110 76 ddxor051 xor 111111111 1 -> 111111110 77 ddxor052 xor 11111111 1 -> 11111110 78 ddxor053 xor 1111111 1 -> 1111110 79 ddxor054 xor 111111 1 -> 111110 80 ddxor055 xor 11111 1 -> 11110 81 ddxor056 xor 1111 1 -> 1110 82 ddxor057 xor 111 1 -> 110 83 ddxor058 xor 11 1 -> 10 84 ddxor059 xor 1 1 -> 0 85 86 ddxor060 xor 1111111111 0 -> 1111111111 87 ddxor061 xor 111111111 0 -> 111111111 88 ddxor062 xor 11111111 0 -> 11111111 89 ddxor063 xor 1111111 0 -> 1111111 90 ddxor064 xor 111111 0 -> 111111 91 ddxor065 xor 11111 0 -> 11111 92 ddxor066 xor 1111 0 -> 1111 93 ddxor067 xor 111 0 -> 111 94 ddxor068 xor 11 0 -> 11 95 ddxor069 xor 1 0 -> 1 96 97 ddxor070 xor 1 1111111111 -> 1111111110 98 ddxor071 xor 1 111111111 -> 111111110 99 ddxor072 xor 1 11111111 -> 11111110 100 ddxor073 xor 1 1111111 -> 1111110 101 ddxor074 xor 1 111111 -> 111110 102 ddxor075 xor 1 11111 -> 11110 103 ddxor076 xor 1 1111 -> 1110 104 ddxor077 xor 1 111 -> 110 105 ddxor078 xor 1 11 -> 10 106 ddxor079 xor 1 1 -> 0 107 108 ddxor080 xor 0 1111111111 -> 1111111111 109 ddxor081 xor 0 111111111 -> 111111111 110 ddxor082 xor 0 11111111 -> 11111111 111 ddxor083 xor 0 1111111 -> 1111111 112 ddxor084 xor 0 111111 -> 111111 113 ddxor085 xor 0 11111 -> 11111 114 ddxor086 xor 0 1111 -> 1111 115 ddxor087 xor 0 111 -> 111 116 ddxor088 xor 0 11 -> 11 117 ddxor089 xor 0 1 -> 1 118 119 ddxor090 xor 011111111 111101111 -> 100010000 120 ddxor091 xor 101111111 111101111 -> 10010000 121 ddxor092 xor 110111111 111101111 -> 1010000 122 ddxor093 xor 111011111 111101111 -> 110000 123 ddxor094 xor 111101111 111101111 -> 0 124 ddxor095 xor 111110111 111101111 -> 11000 125 ddxor096 xor 111111011 111101111 -> 10100 126 ddxor097 xor 111111101 111101111 -> 10010 127 ddxor098 xor 111111110 111101111 -> 10001 128 129 ddxor100 xor 111101111 011111111 -> 100010000 130 ddxor101 xor 111101111 101111111 -> 10010000 131 ddxor102 xor 111101111 110111111 -> 1010000 132 ddxor103 xor 111101111 111011111 -> 110000 133 ddxor104 xor 111101111 111101111 -> 0 134 ddxor105 xor 111101111 111110111 -> 11000 135 ddxor106 xor 111101111 111111011 -> 10100 136 ddxor107 xor 111101111 111111101 -> 10010 137 ddxor108 xor 111101111 111111110 -> 10001 138 139 -- non-0/1 should not be accepted, nor should signs 140 ddxor220 xor 111111112 111111111 -> NaN Invalid_operation 141 ddxor221 xor 333333333 333333333 -> NaN Invalid_operation 142 ddxor222 xor 555555555 555555555 -> NaN Invalid_operation 143 ddxor223 xor 777777777 777777777 -> NaN Invalid_operation 144 ddxor224 xor 999999999 999999999 -> NaN Invalid_operation 145 ddxor225 xor 222222222 999999999 -> NaN Invalid_operation 146 ddxor226 xor 444444444 999999999 -> NaN Invalid_operation 147 ddxor227 xor 666666666 999999999 -> NaN Invalid_operation 148 ddxor228 xor 888888888 999999999 -> NaN Invalid_operation 149 ddxor229 xor 999999999 222222222 -> NaN Invalid_operation 150 ddxor230 xor 999999999 444444444 -> NaN Invalid_operation 151 ddxor231 xor 999999999 666666666 -> NaN Invalid_operation 152 ddxor232 xor 999999999 888888888 -> NaN Invalid_operation 153 -- a few randoms 154 ddxor240 xor 567468689 -934981942 -> NaN Invalid_operation 155 ddxor241 xor 567367689 934981942 -> NaN Invalid_operation 156 ddxor242 xor -631917772 -706014634 -> NaN Invalid_operation 157 ddxor243 xor -756253257 138579234 -> NaN Invalid_operation 158 ddxor244 xor 835590149 567435400 -> NaN Invalid_operation 159 -- test MSD 160 ddxor250 xor 2000000000000000 1000000000000000 -> NaN Invalid_operation 161 ddxor251 xor 7000000000000000 1000000000000000 -> NaN Invalid_operation 162 ddxor252 xor 8000000000000000 1000000000000000 -> NaN Invalid_operation 163 ddxor253 xor 9000000000000000 1000000000000000 -> NaN Invalid_operation 164 ddxor254 xor 2000000000000000 0000000000000000 -> NaN Invalid_operation 165 ddxor255 xor 7000000000000000 0000000000000000 -> NaN Invalid_operation 166 ddxor256 xor 8000000000000000 0000000000000000 -> NaN Invalid_operation 167 ddxor257 xor 9000000000000000 0000000000000000 -> NaN Invalid_operation 168 ddxor258 xor 1000000000000000 2000000000000000 -> NaN Invalid_operation 169 ddxor259 xor 1000000000000000 7000000000000000 -> NaN Invalid_operation 170 ddxor260 xor 1000000000000000 8000000000000000 -> NaN Invalid_operation 171 ddxor261 xor 1000000000000000 9000000000000000 -> NaN Invalid_operation 172 ddxor262 xor 0000000000000000 2000000000000000 -> NaN Invalid_operation 173 ddxor263 xor 0000000000000000 7000000000000000 -> NaN Invalid_operation 174 ddxor264 xor 0000000000000000 8000000000000000 -> NaN Invalid_operation 175 ddxor265 xor 0000000000000000 9000000000000000 -> NaN Invalid_operation 176 -- test MSD-1 177 ddxor270 xor 0200001000000000 1000100000000010 -> NaN Invalid_operation 178 ddxor271 xor 0700000100000000 1000010000000100 -> NaN Invalid_operation 179 ddxor272 xor 0800000010000000 1000001000001000 -> NaN Invalid_operation 180 ddxor273 xor 0900000001000000 1000000100010000 -> NaN Invalid_operation 181 ddxor274 xor 1000000000100000 0200000010100000 -> NaN Invalid_operation 182 ddxor275 xor 1000000000010000 0700000001000000 -> NaN Invalid_operation 183 ddxor276 xor 1000000000001000 0800000010100000 -> NaN Invalid_operation 184 ddxor277 xor 1000000000000100 0900000000010000 -> NaN Invalid_operation 185 -- test LSD 186 ddxor280 xor 0010000000000002 1000000100000001 -> NaN Invalid_operation 187 ddxor281 xor 0001000000000007 1000001000000011 -> NaN Invalid_operation 188 ddxor282 xor 0000100000000008 1000010000000001 -> NaN Invalid_operation 189 ddxor283 xor 0000010000000009 1000100000000001 -> NaN Invalid_operation 190 ddxor284 xor 1000001000000000 0001000000000002 -> NaN Invalid_operation 191 ddxor285 xor 1000000100000000 0010000000000007 -> NaN Invalid_operation 192 ddxor286 xor 1000000010000000 0100000000000008 -> NaN Invalid_operation 193 ddxor287 xor 1000000001000000 1000000000000009 -> NaN Invalid_operation 194 -- test Middie 195 ddxor288 xor 0010000020000000 1000001000000000 -> NaN Invalid_operation 196 ddxor289 xor 0001000070000001 1000000100000000 -> NaN Invalid_operation 197 ddxor290 xor 0000100080000010 1000000010000000 -> NaN Invalid_operation 198 ddxor291 xor 0000010090000100 1000000001000000 -> NaN Invalid_operation 199 ddxor292 xor 1000001000001000 0000000020100000 -> NaN Invalid_operation 200 ddxor293 xor 1000000100010000 0000000070010000 -> NaN Invalid_operation 201 ddxor294 xor 1000000010100000 0000000080001000 -> NaN Invalid_operation 202 ddxor295 xor 1000000001000000 0000000090000100 -> NaN Invalid_operation 203 -- signs 204 ddxor296 xor -1000000001000000 -0000010000000100 -> NaN Invalid_operation 205 ddxor297 xor -1000000001000000 0000000010000100 -> NaN Invalid_operation 206 ddxor298 xor 1000000001000000 -0000001000000100 -> NaN Invalid_operation 207 ddxor299 xor 1000000001000000 0000000011000100 -> 1000000010000100 208 209 -- Nmax, Nmin, Ntiny-like 210 ddxor331 xor 2 9.99999999E+299 -> NaN Invalid_operation 211 ddxor332 xor 3 1E-299 -> NaN Invalid_operation 212 ddxor333 xor 4 1.00000000E-299 -> NaN Invalid_operation 213 ddxor334 xor 5 1E-200 -> NaN Invalid_operation 214 ddxor335 xor 6 -1E-200 -> NaN Invalid_operation 215 ddxor336 xor 7 -1.00000000E-299 -> NaN Invalid_operation 216 ddxor337 xor 8 -1E-299 -> NaN Invalid_operation 217 ddxor338 xor 9 -9.99999999E+299 -> NaN Invalid_operation 218 ddxor341 xor 9.99999999E+299 -18 -> NaN Invalid_operation 219 ddxor342 xor 1E-299 01 -> NaN Invalid_operation 220 ddxor343 xor 1.00000000E-299 -18 -> NaN Invalid_operation 221 ddxor344 xor 1E-208 18 -> NaN Invalid_operation 222 ddxor345 xor -1E-207 -10 -> NaN Invalid_operation 223 ddxor346 xor -1.00000000E-299 18 -> NaN Invalid_operation 224 ddxor347 xor -1E-299 10 -> NaN Invalid_operation 225 ddxor348 xor -9.99999999E+299 -18 -> NaN Invalid_operation 226 227 -- A few other non-integers 228 ddxor361 xor 1.0 1 -> NaN Invalid_operation 229 ddxor362 xor 1E+1 1 -> NaN Invalid_operation 230 ddxor363 xor 0.0 1 -> NaN Invalid_operation 231 ddxor364 xor 0E+1 1 -> NaN Invalid_operation 232 ddxor365 xor 9.9 1 -> NaN Invalid_operation 233 ddxor366 xor 9E+1 1 -> NaN Invalid_operation 234 ddxor371 xor 0 1.0 -> NaN Invalid_operation 235 ddxor372 xor 0 1E+1 -> NaN Invalid_operation 236 ddxor373 xor 0 0.0 -> NaN Invalid_operation 237 ddxor374 xor 0 0E+1 -> NaN Invalid_operation 238 ddxor375 xor 0 9.9 -> NaN Invalid_operation 239 ddxor376 xor 0 9E+1 -> NaN Invalid_operation 240 241 -- All Specials are in error 242 ddxor780 xor -Inf -Inf -> NaN Invalid_operation 243 ddxor781 xor -Inf -1000 -> NaN Invalid_operation 244 ddxor782 xor -Inf -1 -> NaN Invalid_operation 245 ddxor783 xor -Inf -0 -> NaN Invalid_operation 246 ddxor784 xor -Inf 0 -> NaN Invalid_operation 247 ddxor785 xor -Inf 1 -> NaN Invalid_operation 248 ddxor786 xor -Inf 1000 -> NaN Invalid_operation 249 ddxor787 xor -1000 -Inf -> NaN Invalid_operation 250 ddxor788 xor -Inf -Inf -> NaN Invalid_operation 251 ddxor789 xor -1 -Inf -> NaN Invalid_operation 252 ddxor790 xor -0 -Inf -> NaN Invalid_operation 253 ddxor791 xor 0 -Inf -> NaN Invalid_operation 254 ddxor792 xor 1 -Inf -> NaN Invalid_operation 255 ddxor793 xor 1000 -Inf -> NaN Invalid_operation 256 ddxor794 xor Inf -Inf -> NaN Invalid_operation 257 258 ddxor800 xor Inf -Inf -> NaN Invalid_operation 259 ddxor801 xor Inf -1000 -> NaN Invalid_operation 260 ddxor802 xor Inf -1 -> NaN Invalid_operation 261 ddxor803 xor Inf -0 -> NaN Invalid_operation 262 ddxor804 xor Inf 0 -> NaN Invalid_operation 263 ddxor805 xor Inf 1 -> NaN Invalid_operation 264 ddxor806 xor Inf 1000 -> NaN Invalid_operation 265 ddxor807 xor Inf Inf -> NaN Invalid_operation 266 ddxor808 xor -1000 Inf -> NaN Invalid_operation 267 ddxor809 xor -Inf Inf -> NaN Invalid_operation 268 ddxor810 xor -1 Inf -> NaN Invalid_operation 269 ddxor811 xor -0 Inf -> NaN Invalid_operation 270 ddxor812 xor 0 Inf -> NaN Invalid_operation 271 ddxor813 xor 1 Inf -> NaN Invalid_operation 272 ddxor814 xor 1000 Inf -> NaN Invalid_operation 273 ddxor815 xor Inf Inf -> NaN Invalid_operation 274 275 ddxor821 xor NaN -Inf -> NaN Invalid_operation 276 ddxor822 xor NaN -1000 -> NaN Invalid_operation 277 ddxor823 xor NaN -1 -> NaN Invalid_operation 278 ddxor824 xor NaN -0 -> NaN Invalid_operation 279 ddxor825 xor NaN 0 -> NaN Invalid_operation 280 ddxor826 xor NaN 1 -> NaN Invalid_operation 281 ddxor827 xor NaN 1000 -> NaN Invalid_operation 282 ddxor828 xor NaN Inf -> NaN Invalid_operation 283 ddxor829 xor NaN NaN -> NaN Invalid_operation 284 ddxor830 xor -Inf NaN -> NaN Invalid_operation 285 ddxor831 xor -1000 NaN -> NaN Invalid_operation 286 ddxor832 xor -1 NaN -> NaN Invalid_operation 287 ddxor833 xor -0 NaN -> NaN Invalid_operation 288 ddxor834 xor 0 NaN -> NaN Invalid_operation 289 ddxor835 xor 1 NaN -> NaN Invalid_operation 290 ddxor836 xor 1000 NaN -> NaN Invalid_operation 291 ddxor837 xor Inf NaN -> NaN Invalid_operation 292 293 ddxor841 xor sNaN -Inf -> NaN Invalid_operation 294 ddxor842 xor sNaN -1000 -> NaN Invalid_operation 295 ddxor843 xor sNaN -1 -> NaN Invalid_operation 296 ddxor844 xor sNaN -0 -> NaN Invalid_operation 297 ddxor845 xor sNaN 0 -> NaN Invalid_operation 298 ddxor846 xor sNaN 1 -> NaN Invalid_operation 299 ddxor847 xor sNaN 1000 -> NaN Invalid_operation 300 ddxor848 xor sNaN NaN -> NaN Invalid_operation 301 ddxor849 xor sNaN sNaN -> NaN Invalid_operation 302 ddxor850 xor NaN sNaN -> NaN Invalid_operation 303 ddxor851 xor -Inf sNaN -> NaN Invalid_operation 304 ddxor852 xor -1000 sNaN -> NaN Invalid_operation 305 ddxor853 xor -1 sNaN -> NaN Invalid_operation 306 ddxor854 xor -0 sNaN -> NaN Invalid_operation 307 ddxor855 xor 0 sNaN -> NaN Invalid_operation 308 ddxor856 xor 1 sNaN -> NaN Invalid_operation 309 ddxor857 xor 1000 sNaN -> NaN Invalid_operation 310 ddxor858 xor Inf sNaN -> NaN Invalid_operation 311 ddxor859 xor NaN sNaN -> NaN Invalid_operation 312 313 -- propagating NaNs 314 ddxor861 xor NaN1 -Inf -> NaN Invalid_operation 315 ddxor862 xor +NaN2 -1000 -> NaN Invalid_operation 316 ddxor863 xor NaN3 1000 -> NaN Invalid_operation 317 ddxor864 xor NaN4 Inf -> NaN Invalid_operation 318 ddxor865 xor NaN5 +NaN6 -> NaN Invalid_operation 319 ddxor866 xor -Inf NaN7 -> NaN Invalid_operation 320 ddxor867 xor -1000 NaN8 -> NaN Invalid_operation 321 ddxor868 xor 1000 NaN9 -> NaN Invalid_operation 322 ddxor869 xor Inf +NaN10 -> NaN Invalid_operation 323 ddxor871 xor sNaN11 -Inf -> NaN Invalid_operation 324 ddxor872 xor sNaN12 -1000 -> NaN Invalid_operation 325 ddxor873 xor sNaN13 1000 -> NaN Invalid_operation 326 ddxor874 xor sNaN14 NaN17 -> NaN Invalid_operation 327 ddxor875 xor sNaN15 sNaN18 -> NaN Invalid_operation 328 ddxor876 xor NaN16 sNaN19 -> NaN Invalid_operation 329 ddxor877 xor -Inf +sNaN20 -> NaN Invalid_operation 330 ddxor878 xor -1000 sNaN21 -> NaN Invalid_operation 331 ddxor879 xor 1000 sNaN22 -> NaN Invalid_operation 332 ddxor880 xor Inf sNaN23 -> NaN Invalid_operation 333 ddxor881 xor +NaN25 +sNaN24 -> NaN Invalid_operation 334 ddxor882 xor -NaN26 NaN28 -> NaN Invalid_operation 335 ddxor883 xor -sNaN27 sNaN29 -> NaN Invalid_operation 336 ddxor884 xor 1000 -NaN30 -> NaN Invalid_operation 337 ddxor885 xor 1000 -sNaN31 -> NaN Invalid_operation 338