1 ------------------------------------------------------------------------ 2 -- and.decTest -- digitwise logical AND -- 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 -- Sanity check (truth table) 29 andx001 and 0 0 -> 0 30 andx002 and 0 1 -> 0 31 andx003 and 1 0 -> 0 32 andx004 and 1 1 -> 1 33 andx005 and 1100 1010 -> 1000 34 andx006 and 1111 10 -> 10 35 andx007 and 1111 1010 -> 1010 36 37 -- and at msd and msd-1 38 andx010 and 000000000 000000000 -> 0 39 andx011 and 000000000 100000000 -> 0 40 andx012 and 100000000 000000000 -> 0 41 andx013 and 100000000 100000000 -> 100000000 42 andx014 and 000000000 000000000 -> 0 43 andx015 and 000000000 010000000 -> 0 44 andx016 and 010000000 000000000 -> 0 45 andx017 and 010000000 010000000 -> 10000000 46 47 -- Various lengths 48 -- 123456789 123456789 123456789 49 andx021 and 111111111 111111111 -> 111111111 50 andx022 and 111111111111 111111111 -> 111111111 51 andx023 and 111111111111 11111111 -> 11111111 52 andx024 and 111111111 11111111 -> 11111111 53 andx025 and 111111111 1111111 -> 1111111 54 andx026 and 111111111111 111111 -> 111111 55 andx027 and 111111111111 11111 -> 11111 56 andx028 and 111111111111 1111 -> 1111 57 andx029 and 111111111111 111 -> 111 58 andx031 and 111111111111 11 -> 11 59 andx032 and 111111111111 1 -> 1 60 andx033 and 111111111111 1111111111 -> 111111111 61 andx034 and 11111111111 11111111111 -> 111111111 62 andx035 and 1111111111 111111111111 -> 111111111 63 andx036 and 111111111 1111111111111 -> 111111111 64 65 andx040 and 111111111 111111111111 -> 111111111 66 andx041 and 11111111 111111111111 -> 11111111 67 andx042 and 11111111 111111111 -> 11111111 68 andx043 and 1111111 111111111 -> 1111111 69 andx044 and 111111 111111111 -> 111111 70 andx045 and 11111 111111111 -> 11111 71 andx046 and 1111 111111111 -> 1111 72 andx047 and 111 111111111 -> 111 73 andx048 and 11 111111111 -> 11 74 andx049 and 1 111111111 -> 1 75 76 andx050 and 1111111111 1 -> 1 77 andx051 and 111111111 1 -> 1 78 andx052 and 11111111 1 -> 1 79 andx053 and 1111111 1 -> 1 80 andx054 and 111111 1 -> 1 81 andx055 and 11111 1 -> 1 82 andx056 and 1111 1 -> 1 83 andx057 and 111 1 -> 1 84 andx058 and 11 1 -> 1 85 andx059 and 1 1 -> 1 86 87 andx060 and 1111111111 0 -> 0 88 andx061 and 111111111 0 -> 0 89 andx062 and 11111111 0 -> 0 90 andx063 and 1111111 0 -> 0 91 andx064 and 111111 0 -> 0 92 andx065 and 11111 0 -> 0 93 andx066 and 1111 0 -> 0 94 andx067 and 111 0 -> 0 95 andx068 and 11 0 -> 0 96 andx069 and 1 0 -> 0 97 98 andx070 and 1 1111111111 -> 1 99 andx071 and 1 111111111 -> 1 100 andx072 and 1 11111111 -> 1 101 andx073 and 1 1111111 -> 1 102 andx074 and 1 111111 -> 1 103 andx075 and 1 11111 -> 1 104 andx076 and 1 1111 -> 1 105 andx077 and 1 111 -> 1 106 andx078 and 1 11 -> 1 107 andx079 and 1 1 -> 1 108 109 andx080 and 0 1111111111 -> 0 110 andx081 and 0 111111111 -> 0 111 andx082 and 0 11111111 -> 0 112 andx083 and 0 1111111 -> 0 113 andx084 and 0 111111 -> 0 114 andx085 and 0 11111 -> 0 115 andx086 and 0 1111 -> 0 116 andx087 and 0 111 -> 0 117 andx088 and 0 11 -> 0 118 andx089 and 0 1 -> 0 119 120 andx090 and 011111111 111111111 -> 11111111 121 andx091 and 101111111 111111111 -> 101111111 122 andx092 and 110111111 111111111 -> 110111111 123 andx093 and 111011111 111111111 -> 111011111 124 andx094 and 111101111 111111111 -> 111101111 125 andx095 and 111110111 111111111 -> 111110111 126 andx096 and 111111011 111111111 -> 111111011 127 andx097 and 111111101 111111111 -> 111111101 128 andx098 and 111111110 111111111 -> 111111110 129 130 andx100 and 111111111 011111111 -> 11111111 131 andx101 and 111111111 101111111 -> 101111111 132 andx102 and 111111111 110111111 -> 110111111 133 andx103 and 111111111 111011111 -> 111011111 134 andx104 and 111111111 111101111 -> 111101111 135 andx105 and 111111111 111110111 -> 111110111 136 andx106 and 111111111 111111011 -> 111111011 137 andx107 and 111111111 111111101 -> 111111101 138 andx108 and 111111111 111111110 -> 111111110 139 140 -- non-0/1 should not be accepted, nor should signs 141 andx220 and 111111112 111111111 -> NaN Invalid_operation 142 andx221 and 333333333 333333333 -> NaN Invalid_operation 143 andx222 and 555555555 555555555 -> NaN Invalid_operation 144 andx223 and 777777777 777777777 -> NaN Invalid_operation 145 andx224 and 999999999 999999999 -> NaN Invalid_operation 146 andx225 and 222222222 999999999 -> NaN Invalid_operation 147 andx226 and 444444444 999999999 -> NaN Invalid_operation 148 andx227 and 666666666 999999999 -> NaN Invalid_operation 149 andx228 and 888888888 999999999 -> NaN Invalid_operation 150 andx229 and 999999999 222222222 -> NaN Invalid_operation 151 andx230 and 999999999 444444444 -> NaN Invalid_operation 152 andx231 and 999999999 666666666 -> NaN Invalid_operation 153 andx232 and 999999999 888888888 -> NaN Invalid_operation 154 -- a few randoms 155 andx240 and 567468689 -934981942 -> NaN Invalid_operation 156 andx241 and 567367689 934981942 -> NaN Invalid_operation 157 andx242 and -631917772 -706014634 -> NaN Invalid_operation 158 andx243 and -756253257 138579234 -> NaN Invalid_operation 159 andx244 and 835590149 567435400 -> NaN Invalid_operation 160 -- test MSD 161 andx250 and 200000000 100000000 -> NaN Invalid_operation 162 andx251 and 700000000 100000000 -> NaN Invalid_operation 163 andx252 and 800000000 100000000 -> NaN Invalid_operation 164 andx253 and 900000000 100000000 -> NaN Invalid_operation 165 andx254 and 200000000 000000000 -> NaN Invalid_operation 166 andx255 and 700000000 000000000 -> NaN Invalid_operation 167 andx256 and 800000000 000000000 -> NaN Invalid_operation 168 andx257 and 900000000 000000000 -> NaN Invalid_operation 169 andx258 and 100000000 200000000 -> NaN Invalid_operation 170 andx259 and 100000000 700000000 -> NaN Invalid_operation 171 andx260 and 100000000 800000000 -> NaN Invalid_operation 172 andx261 and 100000000 900000000 -> NaN Invalid_operation 173 andx262 and 000000000 200000000 -> NaN Invalid_operation 174 andx263 and 000000000 700000000 -> NaN Invalid_operation 175 andx264 and 000000000 800000000 -> NaN Invalid_operation 176 andx265 and 000000000 900000000 -> NaN Invalid_operation 177 -- test MSD-1 178 andx270 and 020000000 100000000 -> NaN Invalid_operation 179 andx271 and 070100000 100000000 -> NaN Invalid_operation 180 andx272 and 080010000 100000001 -> NaN Invalid_operation 181 andx273 and 090001000 100000010 -> NaN Invalid_operation 182 andx274 and 100000100 020010100 -> NaN Invalid_operation 183 andx275 and 100000000 070001000 -> NaN Invalid_operation 184 andx276 and 100000010 080010100 -> NaN Invalid_operation 185 andx277 and 100000000 090000010 -> NaN Invalid_operation 186 -- test LSD 187 andx280 and 001000002 100000000 -> NaN Invalid_operation 188 andx281 and 000000007 100000000 -> NaN Invalid_operation 189 andx282 and 000000008 100000000 -> NaN Invalid_operation 190 andx283 and 000000009 100000000 -> NaN Invalid_operation 191 andx284 and 100000000 000100002 -> NaN Invalid_operation 192 andx285 and 100100000 001000007 -> NaN Invalid_operation 193 andx286 and 100010000 010000008 -> NaN Invalid_operation 194 andx287 and 100001000 100000009 -> NaN Invalid_operation 195 -- test Middie 196 andx288 and 001020000 100000000 -> NaN Invalid_operation 197 andx289 and 000070001 100000000 -> NaN Invalid_operation 198 andx290 and 000080000 100010000 -> NaN Invalid_operation 199 andx291 and 000090000 100001000 -> NaN Invalid_operation 200 andx292 and 100000010 000020100 -> NaN Invalid_operation 201 andx293 and 100100000 000070010 -> NaN Invalid_operation 202 andx294 and 100010100 000080001 -> NaN Invalid_operation 203 andx295 and 100001000 000090000 -> NaN Invalid_operation 204 -- signs 205 andx296 and -100001000 -000000000 -> NaN Invalid_operation 206 andx297 and -100001000 000010000 -> NaN Invalid_operation 207 andx298 and 100001000 -000000000 -> NaN Invalid_operation 208 andx299 and 100001000 000011000 -> 1000 209 210 -- Nmax, Nmin, Ntiny 211 andx331 and 2 9.99999999E+999 -> NaN Invalid_operation 212 andx332 and 3 1E-999 -> NaN Invalid_operation 213 andx333 and 4 1.00000000E-999 -> NaN Invalid_operation 214 andx334 and 5 1E-1007 -> NaN Invalid_operation 215 andx335 and 6 -1E-1007 -> NaN Invalid_operation 216 andx336 and 7 -1.00000000E-999 -> NaN Invalid_operation 217 andx337 and 8 -1E-999 -> NaN Invalid_operation 218 andx338 and 9 -9.99999999E+999 -> NaN Invalid_operation 219 andx341 and 9.99999999E+999 -18 -> NaN Invalid_operation 220 andx342 and 1E-999 01 -> NaN Invalid_operation 221 andx343 and 1.00000000E-999 -18 -> NaN Invalid_operation 222 andx344 and 1E-1007 18 -> NaN Invalid_operation 223 andx345 and -1E-1007 -10 -> NaN Invalid_operation 224 andx346 and -1.00000000E-999 18 -> NaN Invalid_operation 225 andx347 and -1E-999 10 -> NaN Invalid_operation 226 andx348 and -9.99999999E+999 -18 -> NaN Invalid_operation 227 228 -- A few other non-integers 229 andx361 and 1.0 1 -> NaN Invalid_operation 230 andx362 and 1E+1 1 -> NaN Invalid_operation 231 andx363 and 0.0 1 -> NaN Invalid_operation 232 andx364 and 0E+1 1 -> NaN Invalid_operation 233 andx365 and 9.9 1 -> NaN Invalid_operation 234 andx366 and 9E+1 1 -> NaN Invalid_operation 235 andx371 and 0 1.0 -> NaN Invalid_operation 236 andx372 and 0 1E+1 -> NaN Invalid_operation 237 andx373 and 0 0.0 -> NaN Invalid_operation 238 andx374 and 0 0E+1 -> NaN Invalid_operation 239 andx375 and 0 9.9 -> NaN Invalid_operation 240 andx376 and 0 9E+1 -> NaN Invalid_operation 241 242 -- All Specials are in error 243 andx780 and -Inf -Inf -> NaN Invalid_operation 244 andx781 and -Inf -1000 -> NaN Invalid_operation 245 andx782 and -Inf -1 -> NaN Invalid_operation 246 andx783 and -Inf -0 -> NaN Invalid_operation 247 andx784 and -Inf 0 -> NaN Invalid_operation 248 andx785 and -Inf 1 -> NaN Invalid_operation 249 andx786 and -Inf 1000 -> NaN Invalid_operation 250 andx787 and -1000 -Inf -> NaN Invalid_operation 251 andx788 and -Inf -Inf -> NaN Invalid_operation 252 andx789 and -1 -Inf -> NaN Invalid_operation 253 andx790 and -0 -Inf -> NaN Invalid_operation 254 andx791 and 0 -Inf -> NaN Invalid_operation 255 andx792 and 1 -Inf -> NaN Invalid_operation 256 andx793 and 1000 -Inf -> NaN Invalid_operation 257 andx794 and Inf -Inf -> NaN Invalid_operation 258 259 andx800 and Inf -Inf -> NaN Invalid_operation 260 andx801 and Inf -1000 -> NaN Invalid_operation 261 andx802 and Inf -1 -> NaN Invalid_operation 262 andx803 and Inf -0 -> NaN Invalid_operation 263 andx804 and Inf 0 -> NaN Invalid_operation 264 andx805 and Inf 1 -> NaN Invalid_operation 265 andx806 and Inf 1000 -> NaN Invalid_operation 266 andx807 and Inf Inf -> NaN Invalid_operation 267 andx808 and -1000 Inf -> NaN Invalid_operation 268 andx809 and -Inf Inf -> NaN Invalid_operation 269 andx810 and -1 Inf -> NaN Invalid_operation 270 andx811 and -0 Inf -> NaN Invalid_operation 271 andx812 and 0 Inf -> NaN Invalid_operation 272 andx813 and 1 Inf -> NaN Invalid_operation 273 andx814 and 1000 Inf -> NaN Invalid_operation 274 andx815 and Inf Inf -> NaN Invalid_operation 275 276 andx821 and NaN -Inf -> NaN Invalid_operation 277 andx822 and NaN -1000 -> NaN Invalid_operation 278 andx823 and NaN -1 -> NaN Invalid_operation 279 andx824 and NaN -0 -> NaN Invalid_operation 280 andx825 and NaN 0 -> NaN Invalid_operation 281 andx826 and NaN 1 -> NaN Invalid_operation 282 andx827 and NaN 1000 -> NaN Invalid_operation 283 andx828 and NaN Inf -> NaN Invalid_operation 284 andx829 and NaN NaN -> NaN Invalid_operation 285 andx830 and -Inf NaN -> NaN Invalid_operation 286 andx831 and -1000 NaN -> NaN Invalid_operation 287 andx832 and -1 NaN -> NaN Invalid_operation 288 andx833 and -0 NaN -> NaN Invalid_operation 289 andx834 and 0 NaN -> NaN Invalid_operation 290 andx835 and 1 NaN -> NaN Invalid_operation 291 andx836 and 1000 NaN -> NaN Invalid_operation 292 andx837 and Inf NaN -> NaN Invalid_operation 293 294 andx841 and sNaN -Inf -> NaN Invalid_operation 295 andx842 and sNaN -1000 -> NaN Invalid_operation 296 andx843 and sNaN -1 -> NaN Invalid_operation 297 andx844 and sNaN -0 -> NaN Invalid_operation 298 andx845 and sNaN 0 -> NaN Invalid_operation 299 andx846 and sNaN 1 -> NaN Invalid_operation 300 andx847 and sNaN 1000 -> NaN Invalid_operation 301 andx848 and sNaN NaN -> NaN Invalid_operation 302 andx849 and sNaN sNaN -> NaN Invalid_operation 303 andx850 and NaN sNaN -> NaN Invalid_operation 304 andx851 and -Inf sNaN -> NaN Invalid_operation 305 andx852 and -1000 sNaN -> NaN Invalid_operation 306 andx853 and -1 sNaN -> NaN Invalid_operation 307 andx854 and -0 sNaN -> NaN Invalid_operation 308 andx855 and 0 sNaN -> NaN Invalid_operation 309 andx856 and 1 sNaN -> NaN Invalid_operation 310 andx857 and 1000 sNaN -> NaN Invalid_operation 311 andx858 and Inf sNaN -> NaN Invalid_operation 312 andx859 and NaN sNaN -> NaN Invalid_operation 313 314 -- propagating NaNs 315 andx861 and NaN1 -Inf -> NaN Invalid_operation 316 andx862 and +NaN2 -1000 -> NaN Invalid_operation 317 andx863 and NaN3 1000 -> NaN Invalid_operation 318 andx864 and NaN4 Inf -> NaN Invalid_operation 319 andx865 and NaN5 +NaN6 -> NaN Invalid_operation 320 andx866 and -Inf NaN7 -> NaN Invalid_operation 321 andx867 and -1000 NaN8 -> NaN Invalid_operation 322 andx868 and 1000 NaN9 -> NaN Invalid_operation 323 andx869 and Inf +NaN10 -> NaN Invalid_operation 324 andx871 and sNaN11 -Inf -> NaN Invalid_operation 325 andx872 and sNaN12 -1000 -> NaN Invalid_operation 326 andx873 and sNaN13 1000 -> NaN Invalid_operation 327 andx874 and sNaN14 NaN17 -> NaN Invalid_operation 328 andx875 and sNaN15 sNaN18 -> NaN Invalid_operation 329 andx876 and NaN16 sNaN19 -> NaN Invalid_operation 330 andx877 and -Inf +sNaN20 -> NaN Invalid_operation 331 andx878 and -1000 sNaN21 -> NaN Invalid_operation 332 andx879 and 1000 sNaN22 -> NaN Invalid_operation 333 andx880 and Inf sNaN23 -> NaN Invalid_operation 334 andx881 and +NaN25 +sNaN24 -> NaN Invalid_operation 335 andx882 and -NaN26 NaN28 -> NaN Invalid_operation 336 andx883 and -sNaN27 sNaN29 -> NaN Invalid_operation 337 andx884 and 1000 -NaN30 -> NaN Invalid_operation 338 andx885 and 1000 -sNaN31 -> NaN Invalid_operation 339