1 ------------------------------------------------------------------------ 2 -- ddAnd.decTest -- digitwise logical AND 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 ddand001 and 0 0 -> 0 31 ddand002 and 0 1 -> 0 32 ddand003 and 1 0 -> 0 33 ddand004 and 1 1 -> 1 34 ddand005 and 1100 1010 -> 1000 35 -- and at msd and msd-1 36 -- 1234567890123456 1234567890123456 1234567890123456 37 ddand006 and 0000000000000000 0000000000000000 -> 0 38 ddand007 and 0000000000000000 1000000000000000 -> 0 39 ddand008 and 1000000000000000 0000000000000000 -> 0 40 ddand009 and 1000000000000000 1000000000000000 -> 1000000000000000 41 ddand010 and 0000000000000000 0000000000000000 -> 0 42 ddand011 and 0000000000000000 0100000000000000 -> 0 43 ddand012 and 0100000000000000 0000000000000000 -> 0 44 ddand013 and 0100000000000000 0100000000000000 -> 100000000000000 45 46 -- Various lengths 47 -- 1234567890123456 1234567890123456 1234567890123456 48 ddand021 and 1111111111111111 1111111111111111 -> 1111111111111111 49 ddand024 and 1111111111111111 111111111111111 -> 111111111111111 50 ddand025 and 1111111111111111 11111111111111 -> 11111111111111 51 ddand026 and 1111111111111111 1111111111111 -> 1111111111111 52 ddand027 and 1111111111111111 111111111111 -> 111111111111 53 ddand028 and 1111111111111111 11111111111 -> 11111111111 54 ddand029 and 1111111111111111 1111111111 -> 1111111111 55 ddand030 and 1111111111111111 111111111 -> 111111111 56 ddand031 and 1111111111111111 11111111 -> 11111111 57 ddand032 and 1111111111111111 1111111 -> 1111111 58 ddand033 and 1111111111111111 111111 -> 111111 59 ddand034 and 1111111111111111 11111 -> 11111 60 ddand035 and 1111111111111111 1111 -> 1111 61 ddand036 and 1111111111111111 111 -> 111 62 ddand037 and 1111111111111111 11 -> 11 63 ddand038 and 1111111111111111 1 -> 1 64 ddand039 and 1111111111111111 0 -> 0 65 66 ddand040 and 1111111111111111 1111111111111111 -> 1111111111111111 67 ddand041 and 111111111111111 1111111111111111 -> 111111111111111 68 ddand042 and 111111111111111 1111111111111111 -> 111111111111111 69 ddand043 and 11111111111111 1111111111111111 -> 11111111111111 70 ddand044 and 1111111111111 1111111111111111 -> 1111111111111 71 ddand045 and 111111111111 1111111111111111 -> 111111111111 72 ddand046 and 11111111111 1111111111111111 -> 11111111111 73 ddand047 and 1111111111 1111111111111111 -> 1111111111 74 ddand048 and 111111111 1111111111111111 -> 111111111 75 ddand049 and 11111111 1111111111111111 -> 11111111 76 ddand050 and 1111111 1111111111111111 -> 1111111 77 ddand051 and 111111 1111111111111111 -> 111111 78 ddand052 and 11111 1111111111111111 -> 11111 79 ddand053 and 1111 1111111111111111 -> 1111 80 ddand054 and 111 1111111111111111 -> 111 81 ddand055 and 11 1111111111111111 -> 11 82 ddand056 and 1 1111111111111111 -> 1 83 ddand057 and 0 1111111111111111 -> 0 84 85 ddand150 and 1111111111 1 -> 1 86 ddand151 and 111111111 1 -> 1 87 ddand152 and 11111111 1 -> 1 88 ddand153 and 1111111 1 -> 1 89 ddand154 and 111111 1 -> 1 90 ddand155 and 11111 1 -> 1 91 ddand156 and 1111 1 -> 1 92 ddand157 and 111 1 -> 1 93 ddand158 and 11 1 -> 1 94 ddand159 and 1 1 -> 1 95 96 ddand160 and 1111111111 0 -> 0 97 ddand161 and 111111111 0 -> 0 98 ddand162 and 11111111 0 -> 0 99 ddand163 and 1111111 0 -> 0 100 ddand164 and 111111 0 -> 0 101 ddand165 and 11111 0 -> 0 102 ddand166 and 1111 0 -> 0 103 ddand167 and 111 0 -> 0 104 ddand168 and 11 0 -> 0 105 ddand169 and 1 0 -> 0 106 107 ddand170 and 1 1111111111 -> 1 108 ddand171 and 1 111111111 -> 1 109 ddand172 and 1 11111111 -> 1 110 ddand173 and 1 1111111 -> 1 111 ddand174 and 1 111111 -> 1 112 ddand175 and 1 11111 -> 1 113 ddand176 and 1 1111 -> 1 114 ddand177 and 1 111 -> 1 115 ddand178 and 1 11 -> 1 116 ddand179 and 1 1 -> 1 117 118 ddand180 and 0 1111111111 -> 0 119 ddand181 and 0 111111111 -> 0 120 ddand182 and 0 11111111 -> 0 121 ddand183 and 0 1111111 -> 0 122 ddand184 and 0 111111 -> 0 123 ddand185 and 0 11111 -> 0 124 ddand186 and 0 1111 -> 0 125 ddand187 and 0 111 -> 0 126 ddand188 and 0 11 -> 0 127 ddand189 and 0 1 -> 0 128 129 ddand090 and 011111111 111111111 -> 11111111 130 ddand091 and 101111111 111111111 -> 101111111 131 ddand092 and 110111111 111111111 -> 110111111 132 ddand093 and 111011111 111111111 -> 111011111 133 ddand094 and 111101111 111111111 -> 111101111 134 ddand095 and 111110111 111111111 -> 111110111 135 ddand096 and 111111011 111111111 -> 111111011 136 ddand097 and 111111101 111111111 -> 111111101 137 ddand098 and 111111110 111111111 -> 111111110 138 139 ddand100 and 111111111 011111111 -> 11111111 140 ddand101 and 111111111 101111111 -> 101111111 141 ddand102 and 111111111 110111111 -> 110111111 142 ddand103 and 111111111 111011111 -> 111011111 143 ddand104 and 111111111 111101111 -> 111101111 144 ddand105 and 111111111 111110111 -> 111110111 145 ddand106 and 111111111 111111011 -> 111111011 146 ddand107 and 111111111 111111101 -> 111111101 147 ddand108 and 111111111 111111110 -> 111111110 148 149 -- non-0/1 should not be accepted, nor should signs 150 ddand220 and 111111112 111111111 -> NaN Invalid_operation 151 ddand221 and 333333333 333333333 -> NaN Invalid_operation 152 ddand222 and 555555555 555555555 -> NaN Invalid_operation 153 ddand223 and 777777777 777777777 -> NaN Invalid_operation 154 ddand224 and 999999999 999999999 -> NaN Invalid_operation 155 ddand225 and 222222222 999999999 -> NaN Invalid_operation 156 ddand226 and 444444444 999999999 -> NaN Invalid_operation 157 ddand227 and 666666666 999999999 -> NaN Invalid_operation 158 ddand228 and 888888888 999999999 -> NaN Invalid_operation 159 ddand229 and 999999999 222222222 -> NaN Invalid_operation 160 ddand230 and 999999999 444444444 -> NaN Invalid_operation 161 ddand231 and 999999999 666666666 -> NaN Invalid_operation 162 ddand232 and 999999999 888888888 -> NaN Invalid_operation 163 -- a few randoms 164 ddand240 and 567468689 -934981942 -> NaN Invalid_operation 165 ddand241 and 567367689 934981942 -> NaN Invalid_operation 166 ddand242 and -631917772 -706014634 -> NaN Invalid_operation 167 ddand243 and -756253257 138579234 -> NaN Invalid_operation 168 ddand244 and 835590149 567435400 -> NaN Invalid_operation 169 -- test MSD 170 ddand250 and 2000000000000000 1000000000000000 -> NaN Invalid_operation 171 ddand251 and 7000000000000000 1000000000000000 -> NaN Invalid_operation 172 ddand252 and 8000000000000000 1000000000000000 -> NaN Invalid_operation 173 ddand253 and 9000000000000000 1000000000000000 -> NaN Invalid_operation 174 ddand254 and 2000000000000000 0000000000000000 -> NaN Invalid_operation 175 ddand255 and 7000000000000000 0000000000000000 -> NaN Invalid_operation 176 ddand256 and 8000000000000000 0000000000000000 -> NaN Invalid_operation 177 ddand257 and 9000000000000000 0000000000000000 -> NaN Invalid_operation 178 ddand258 and 1000000000000000 2000000000000000 -> NaN Invalid_operation 179 ddand259 and 1000000000000000 7000000000000000 -> NaN Invalid_operation 180 ddand260 and 1000000000000000 8000000000000000 -> NaN Invalid_operation 181 ddand261 and 1000000000000000 9000000000000000 -> NaN Invalid_operation 182 ddand262 and 0000000000000000 2000000000000000 -> NaN Invalid_operation 183 ddand263 and 0000000000000000 7000000000000000 -> NaN Invalid_operation 184 ddand264 and 0000000000000000 8000000000000000 -> NaN Invalid_operation 185 ddand265 and 0000000000000000 9000000000000000 -> NaN Invalid_operation 186 -- test MSD-1 187 ddand270 and 0200001000000000 1000100000000010 -> NaN Invalid_operation 188 ddand271 and 0700000100000000 1000010000000100 -> NaN Invalid_operation 189 ddand272 and 0800000010000000 1000001000001000 -> NaN Invalid_operation 190 ddand273 and 0900000001000000 1000000100010000 -> NaN Invalid_operation 191 ddand274 and 1000000000100000 0200000010100000 -> NaN Invalid_operation 192 ddand275 and 1000000000010000 0700000001000000 -> NaN Invalid_operation 193 ddand276 and 1000000000001000 0800000010100000 -> NaN Invalid_operation 194 ddand277 and 1000000000000100 0900000000010000 -> NaN Invalid_operation 195 -- test LSD 196 ddand280 and 0010000000000002 1000000100000001 -> NaN Invalid_operation 197 ddand281 and 0001000000000007 1000001000000011 -> NaN Invalid_operation 198 ddand282 and 0000100000000008 1000010000000001 -> NaN Invalid_operation 199 ddand283 and 0000010000000009 1000100000000001 -> NaN Invalid_operation 200 ddand284 and 1000001000000000 0001000000000002 -> NaN Invalid_operation 201 ddand285 and 1000000100000000 0010000000000007 -> NaN Invalid_operation 202 ddand286 and 1000000010000000 0100000000000008 -> NaN Invalid_operation 203 ddand287 and 1000000001000000 1000000000000009 -> NaN Invalid_operation 204 -- test Middie 205 ddand288 and 0010000020000000 1000001000000000 -> NaN Invalid_operation 206 ddand289 and 0001000070000001 1000000100000000 -> NaN Invalid_operation 207 ddand290 and 0000100080000010 1000000010000000 -> NaN Invalid_operation 208 ddand291 and 0000010090000100 1000000001000000 -> NaN Invalid_operation 209 ddand292 and 1000001000001000 0000000020100000 -> NaN Invalid_operation 210 ddand293 and 1000000100010000 0000000070010000 -> NaN Invalid_operation 211 ddand294 and 1000000010100000 0000000080001000 -> NaN Invalid_operation 212 ddand295 and 1000000001000000 0000000090000100 -> NaN Invalid_operation 213 -- signs 214 ddand296 and -1000000001000000 -0000010000000100 -> NaN Invalid_operation 215 ddand297 and -1000000001000000 0000000010000100 -> NaN Invalid_operation 216 ddand298 and 1000000001000000 -0000001000000100 -> NaN Invalid_operation 217 ddand299 and 1000000001000000 0000000011000100 -> 1000000 218 219 -- Nmax, Nmin, Ntiny-like 220 ddand331 and 2 9.99999999E+199 -> NaN Invalid_operation 221 ddand332 and 3 1E-199 -> NaN Invalid_operation 222 ddand333 and 4 1.00000000E-199 -> NaN Invalid_operation 223 ddand334 and 5 1E-100 -> NaN Invalid_operation 224 ddand335 and 6 -1E-100 -> NaN Invalid_operation 225 ddand336 and 7 -1.00000000E-199 -> NaN Invalid_operation 226 ddand337 and 8 -1E-199 -> NaN Invalid_operation 227 ddand338 and 9 -9.99999999E+199 -> NaN Invalid_operation 228 ddand341 and 9.99999999E+199 -18 -> NaN Invalid_operation 229 ddand342 and 1E-199 01 -> NaN Invalid_operation 230 ddand343 and 1.00000000E-199 -18 -> NaN Invalid_operation 231 ddand344 and 1E-100 18 -> NaN Invalid_operation 232 ddand345 and -1E-100 -10 -> NaN Invalid_operation 233 ddand346 and -1.00000000E-199 18 -> NaN Invalid_operation 234 ddand347 and -1E-199 10 -> NaN Invalid_operation 235 ddand348 and -9.99999999E+199 -18 -> NaN Invalid_operation 236 237 -- A few other non-integers 238 ddand361 and 1.0 1 -> NaN Invalid_operation 239 ddand362 and 1E+1 1 -> NaN Invalid_operation 240 ddand363 and 0.0 1 -> NaN Invalid_operation 241 ddand364 and 0E+1 1 -> NaN Invalid_operation 242 ddand365 and 9.9 1 -> NaN Invalid_operation 243 ddand366 and 9E+1 1 -> NaN Invalid_operation 244 ddand371 and 0 1.0 -> NaN Invalid_operation 245 ddand372 and 0 1E+1 -> NaN Invalid_operation 246 ddand373 and 0 0.0 -> NaN Invalid_operation 247 ddand374 and 0 0E+1 -> NaN Invalid_operation 248 ddand375 and 0 9.9 -> NaN Invalid_operation 249 ddand376 and 0 9E+1 -> NaN Invalid_operation 250 251 -- All Specials are in error 252 ddand780 and -Inf -Inf -> NaN Invalid_operation 253 ddand781 and -Inf -1000 -> NaN Invalid_operation 254 ddand782 and -Inf -1 -> NaN Invalid_operation 255 ddand783 and -Inf -0 -> NaN Invalid_operation 256 ddand784 and -Inf 0 -> NaN Invalid_operation 257 ddand785 and -Inf 1 -> NaN Invalid_operation 258 ddand786 and -Inf 1000 -> NaN Invalid_operation 259 ddand787 and -1000 -Inf -> NaN Invalid_operation 260 ddand788 and -Inf -Inf -> NaN Invalid_operation 261 ddand789 and -1 -Inf -> NaN Invalid_operation 262 ddand790 and -0 -Inf -> NaN Invalid_operation 263 ddand791 and 0 -Inf -> NaN Invalid_operation 264 ddand792 and 1 -Inf -> NaN Invalid_operation 265 ddand793 and 1000 -Inf -> NaN Invalid_operation 266 ddand794 and Inf -Inf -> NaN Invalid_operation 267 268 ddand800 and Inf -Inf -> NaN Invalid_operation 269 ddand801 and Inf -1000 -> NaN Invalid_operation 270 ddand802 and Inf -1 -> NaN Invalid_operation 271 ddand803 and Inf -0 -> NaN Invalid_operation 272 ddand804 and Inf 0 -> NaN Invalid_operation 273 ddand805 and Inf 1 -> NaN Invalid_operation 274 ddand806 and Inf 1000 -> NaN Invalid_operation 275 ddand807 and Inf Inf -> NaN Invalid_operation 276 ddand808 and -1000 Inf -> NaN Invalid_operation 277 ddand809 and -Inf Inf -> NaN Invalid_operation 278 ddand810 and -1 Inf -> NaN Invalid_operation 279 ddand811 and -0 Inf -> NaN Invalid_operation 280 ddand812 and 0 Inf -> NaN Invalid_operation 281 ddand813 and 1 Inf -> NaN Invalid_operation 282 ddand814 and 1000 Inf -> NaN Invalid_operation 283 ddand815 and Inf Inf -> NaN Invalid_operation 284 285 ddand821 and NaN -Inf -> NaN Invalid_operation 286 ddand822 and NaN -1000 -> NaN Invalid_operation 287 ddand823 and NaN -1 -> NaN Invalid_operation 288 ddand824 and NaN -0 -> NaN Invalid_operation 289 ddand825 and NaN 0 -> NaN Invalid_operation 290 ddand826 and NaN 1 -> NaN Invalid_operation 291 ddand827 and NaN 1000 -> NaN Invalid_operation 292 ddand828 and NaN Inf -> NaN Invalid_operation 293 ddand829 and NaN NaN -> NaN Invalid_operation 294 ddand830 and -Inf NaN -> NaN Invalid_operation 295 ddand831 and -1000 NaN -> NaN Invalid_operation 296 ddand832 and -1 NaN -> NaN Invalid_operation 297 ddand833 and -0 NaN -> NaN Invalid_operation 298 ddand834 and 0 NaN -> NaN Invalid_operation 299 ddand835 and 1 NaN -> NaN Invalid_operation 300 ddand836 and 1000 NaN -> NaN Invalid_operation 301 ddand837 and Inf NaN -> NaN Invalid_operation 302 303 ddand841 and sNaN -Inf -> NaN Invalid_operation 304 ddand842 and sNaN -1000 -> NaN Invalid_operation 305 ddand843 and sNaN -1 -> NaN Invalid_operation 306 ddand844 and sNaN -0 -> NaN Invalid_operation 307 ddand845 and sNaN 0 -> NaN Invalid_operation 308 ddand846 and sNaN 1 -> NaN Invalid_operation 309 ddand847 and sNaN 1000 -> NaN Invalid_operation 310 ddand848 and sNaN NaN -> NaN Invalid_operation 311 ddand849 and sNaN sNaN -> NaN Invalid_operation 312 ddand850 and NaN sNaN -> NaN Invalid_operation 313 ddand851 and -Inf sNaN -> NaN Invalid_operation 314 ddand852 and -1000 sNaN -> NaN Invalid_operation 315 ddand853 and -1 sNaN -> NaN Invalid_operation 316 ddand854 and -0 sNaN -> NaN Invalid_operation 317 ddand855 and 0 sNaN -> NaN Invalid_operation 318 ddand856 and 1 sNaN -> NaN Invalid_operation 319 ddand857 and 1000 sNaN -> NaN Invalid_operation 320 ddand858 and Inf sNaN -> NaN Invalid_operation 321 ddand859 and NaN sNaN -> NaN Invalid_operation 322 323 -- propagating NaNs 324 ddand861 and NaN1 -Inf -> NaN Invalid_operation 325 ddand862 and +NaN2 -1000 -> NaN Invalid_operation 326 ddand863 and NaN3 1000 -> NaN Invalid_operation 327 ddand864 and NaN4 Inf -> NaN Invalid_operation 328 ddand865 and NaN5 +NaN6 -> NaN Invalid_operation 329 ddand866 and -Inf NaN7 -> NaN Invalid_operation 330 ddand867 and -1000 NaN8 -> NaN Invalid_operation 331 ddand868 and 1000 NaN9 -> NaN Invalid_operation 332 ddand869 and Inf +NaN10 -> NaN Invalid_operation 333 ddand871 and sNaN11 -Inf -> NaN Invalid_operation 334 ddand872 and sNaN12 -1000 -> NaN Invalid_operation 335 ddand873 and sNaN13 1000 -> NaN Invalid_operation 336 ddand874 and sNaN14 NaN17 -> NaN Invalid_operation 337 ddand875 and sNaN15 sNaN18 -> NaN Invalid_operation 338 ddand876 and NaN16 sNaN19 -> NaN Invalid_operation 339 ddand877 and -Inf +sNaN20 -> NaN Invalid_operation 340 ddand878 and -1000 sNaN21 -> NaN Invalid_operation 341 ddand879 and 1000 sNaN22 -> NaN Invalid_operation 342 ddand880 and Inf sNaN23 -> NaN Invalid_operation 343 ddand881 and +NaN25 +sNaN24 -> NaN Invalid_operation 344 ddand882 and -NaN26 NaN28 -> NaN Invalid_operation 345 ddand883 and -sNaN27 sNaN29 -> NaN Invalid_operation 346 ddand884 and 1000 -NaN30 -> NaN Invalid_operation 347 ddand885 and 1000 -sNaN31 -> NaN Invalid_operation 348