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