1 ------------------------------------------------------------------------ 2 -- dqInvert.decTest -- digitwise logical INVERT for decQuads -- 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 clamp: 1 24 precision: 34 25 maxExponent: 6144 26 minExponent: -6143 27 rounding: half_even 28 29 -- Sanity check (truth table) 30 dqinv001 invert 0 -> 1111111111111111111111111111111111 31 dqinv002 invert 1 -> 1111111111111111111111111111111110 32 dqinv003 invert 10 -> 1111111111111111111111111111111101 33 dqinv004 invert 111111111 -> 1111111111111111111111111000000000 34 dqinv005 invert 000000000 -> 1111111111111111111111111111111111 35 -- and at msd and msd-1 36 dqinv007 invert 0000000000000000000000000000000000 -> 1111111111111111111111111111111111 37 dqinv008 invert 1000000000000000000000000000000000 -> 111111111111111111111111111111111 38 dqinv009 invert 0000000000000000000000000000000000 -> 1111111111111111111111111111111111 39 dqinv010 invert 0100000000000000000000000000000000 -> 1011111111111111111111111111111111 40 dqinv011 invert 0111111111111111111111111111111111 -> 1000000000000000000000000000000000 41 dqinv012 invert 1111111111111111111111111111111111 -> 0 42 dqinv013 invert 0011111111111111111111111111111111 -> 1100000000000000000000000000000000 43 dqinv014 invert 0111111111111111111111111111111111 -> 1000000000000000000000000000000000 44 45 -- Various lengths 46 dqinv600 invert 0111111111111111111011111111111111 -> 1000000000000000000100000000000000 47 dqinv601 invert 0011111111111111110101111111111111 -> 1100000000000000001010000000000000 48 dqinv602 invert 0101111111111111101110111111111111 -> 1010000000000000010001000000000000 49 dqinv603 invert 0110111111111111011111011111111111 -> 1001000000000000100000100000000000 50 dqinv604 invert 0111011111111110111111101111111111 -> 1000100000000001000000010000000000 51 dqinv605 invert 0111101111111101111111110111111111 -> 1000010000000010000000001000000000 52 dqinv606 invert 0111110111111011111111111011111111 -> 1000001000000100000000000100000000 53 dqinv607 invert 0111111011110111111111111101111111 -> 1000000100001000000000000010000000 54 dqinv608 invert 0111111101101111111111111110111111 -> 1000000010010000000000000001000000 55 dqinv609 invert 0111111110011111111111111111011111 -> 1000000001100000000000000000100000 56 dqinv610 invert 0111111110011111111111111111101111 -> 1000000001100000000000000000010000 57 dqinv611 invert 0111111101101111111111111111110111 -> 1000000010010000000000000000001000 58 dqinv612 invert 0111111011110111111111111111111011 -> 1000000100001000000000000000000100 59 dqinv613 invert 0111110111111011111111111111111101 -> 1000001000000100000000000000000010 60 dqinv614 invert 0111101111111101111111111111111110 -> 1000010000000010000000000000000001 61 dqinv615 invert 0111011111111110111111111111111111 -> 1000100000000001000000000000000000 62 dqinv616 invert 0110111111111111011111111111111110 -> 1001000000000000100000000000000001 63 dqinv617 invert 0101111111111111101111111111111101 -> 1010000000000000010000000000000010 64 dqinv618 invert 0011111111111111110111111111111011 -> 1100000000000000001000000000000100 65 dqinv619 invert 0101111111111111111011111111110111 -> 1010000000000000000100000000001000 66 dqinv620 invert 0110111111111111111101111111101111 -> 1001000000000000000010000000010000 67 dqinv621 invert 0111011111111111111110111111011111 -> 1000100000000000000001000000100000 68 dqinv622 invert 0111101111111111111111011110111111 -> 1000010000000000000000100001000000 69 dqinv623 invert 0111110111111111111111101101111111 -> 1000001000000000000000010010000000 70 dqinv624 invert 0111111011111111111111110011111111 -> 1000000100000000000000001100000000 71 dqinv625 invert 0111111101111111111111110011111111 -> 1000000010000000000000001100000000 72 dqinv626 invert 0111111110111111111111101101111111 -> 1000000001000000000000010010000000 73 dqinv627 invert 0111111111011111111111011110111111 -> 1000000000100000000000100001000000 74 dqinv628 invert 0111111111101111111110111111011111 -> 1000000000010000000001000000100000 75 dqinv629 invert 0111111111110111111101111111101111 -> 1000000000001000000010000000010000 76 dqinv630 invert 0111111111111011111011111111110111 -> 1000000000000100000100000000001000 77 dqinv631 invert 0111111111111101110111111111111011 -> 1000000000000010001000000000000100 78 dqinv632 invert 0111111111111110101111111111111101 -> 1000000000000001010000000000000010 79 dqinv633 invert 0111111111111111011111111111111110 -> 1000000000000000100000000000000001 80 81 dqinv021 invert 111111111 -> 1111111111111111111111111000000000 82 dqinv022 invert 111111111111 -> 1111111111111111111111000000000000 83 dqinv023 invert 11111111 -> 1111111111111111111111111100000000 84 dqinv025 invert 1111111 -> 1111111111111111111111111110000000 85 dqinv026 invert 111111 -> 1111111111111111111111111111000000 86 dqinv027 invert 11111 -> 1111111111111111111111111111100000 87 dqinv028 invert 1111 -> 1111111111111111111111111111110000 88 dqinv029 invert 111 -> 1111111111111111111111111111111000 89 dqinv031 invert 11 -> 1111111111111111111111111111111100 90 dqinv032 invert 1 -> 1111111111111111111111111111111110 91 dqinv033 invert 111111111111 -> 1111111111111111111111000000000000 92 dqinv034 invert 11111111111 -> 1111111111111111111111100000000000 93 dqinv035 invert 1111111111 -> 1111111111111111111111110000000000 94 dqinv036 invert 111111111 -> 1111111111111111111111111000000000 95 96 dqinv040 invert 011111111 -> 1111111111111111111111111100000000 97 dqinv041 invert 101111111 -> 1111111111111111111111111010000000 98 dqinv042 invert 110111111 -> 1111111111111111111111111001000000 99 dqinv043 invert 111011111 -> 1111111111111111111111111000100000 100 dqinv044 invert 111101111 -> 1111111111111111111111111000010000 101 dqinv045 invert 111110111 -> 1111111111111111111111111000001000 102 dqinv046 invert 111111011 -> 1111111111111111111111111000000100 103 dqinv047 invert 111111101 -> 1111111111111111111111111000000010 104 dqinv048 invert 111111110 -> 1111111111111111111111111000000001 105 dqinv049 invert 011111011 -> 1111111111111111111111111100000100 106 dqinv050 invert 101111101 -> 1111111111111111111111111010000010 107 dqinv051 invert 110111110 -> 1111111111111111111111111001000001 108 dqinv052 invert 111011101 -> 1111111111111111111111111000100010 109 dqinv053 invert 111101011 -> 1111111111111111111111111000010100 110 dqinv054 invert 111110111 -> 1111111111111111111111111000001000 111 dqinv055 invert 111101011 -> 1111111111111111111111111000010100 112 dqinv056 invert 111011101 -> 1111111111111111111111111000100010 113 dqinv057 invert 110111110 -> 1111111111111111111111111001000001 114 dqinv058 invert 101111101 -> 1111111111111111111111111010000010 115 dqinv059 invert 011111011 -> 1111111111111111111111111100000100 116 117 dqinv080 invert 1000000011111111 -> 1111111111111111110111111100000000 118 dqinv081 invert 0100000101111111 -> 1111111111111111111011111010000000 119 dqinv082 invert 0010000110111111 -> 1111111111111111111101111001000000 120 dqinv083 invert 0001000111011111 -> 1111111111111111111110111000100000 121 dqinv084 invert 0000100111101111 -> 1111111111111111111111011000010000 122 dqinv085 invert 0000010111110111 -> 1111111111111111111111101000001000 123 dqinv086 invert 0000001111111011 -> 1111111111111111111111110000000100 124 dqinv087 invert 0000010111111101 -> 1111111111111111111111101000000010 125 dqinv088 invert 0000100111111110 -> 1111111111111111111111011000000001 126 dqinv089 invert 0001000011111011 -> 1111111111111111111110111100000100 127 dqinv090 invert 0010000101111101 -> 1111111111111111111101111010000010 128 dqinv091 invert 0100000110111110 -> 1111111111111111111011111001000001 129 dqinv092 invert 1000000111011101 -> 1111111111111111110111111000100010 130 dqinv093 invert 0100000111101011 -> 1111111111111111111011111000010100 131 dqinv094 invert 0010000111110111 -> 1111111111111111111101111000001000 132 dqinv095 invert 0001000111101011 -> 1111111111111111111110111000010100 133 dqinv096 invert 0000100111011101 -> 1111111111111111111111011000100010 134 dqinv097 invert 0000010110111110 -> 1111111111111111111111101001000001 135 dqinv098 invert 0000001101111101 -> 1111111111111111111111110010000010 136 dqinv099 invert 0000010011111011 -> 1111111111111111111111101100000100 137 138 -- and more thorough MSD/LSD tests [8 and 9 mght be encoded differently...] 139 dqinv151 invert 1111111111111111111111111111111110 -> 1 140 dqinv152 invert 1111111111111111110000000000000000 -> 1111111111111111 141 dqinv153 invert 1000000000000000001111111111111111 -> 111111111111111110000000000000000 142 dqinv154 invert 1111111111111111111000000000000000 -> 111111111111111 143 dqinv155 invert 0100000000000000000111111111111111 -> 1011111111111111111000000000000000 144 dqinv156 invert 1011111111111111110100000000000000 -> 100000000000000001011111111111111 145 dqinv157 invert 1101111111111111110111111111111111 -> 10000000000000001000000000000000 146 dqinv158 invert 1110111111111111110011111111111111 -> 1000000000000001100000000000000 147 148 -- non-0/1 should not be accepted, nor should signs 149 dqinv220 invert 111111112 -> NaN Invalid_operation 150 dqinv221 invert 333333333 -> NaN Invalid_operation 151 dqinv222 invert 555555555 -> NaN Invalid_operation 152 dqinv223 invert 777777777 -> NaN Invalid_operation 153 dqinv224 invert 999999999 -> NaN Invalid_operation 154 dqinv225 invert 222222222 -> NaN Invalid_operation 155 dqinv226 invert 444444444 -> NaN Invalid_operation 156 dqinv227 invert 666666666 -> NaN Invalid_operation 157 dqinv228 invert 888888888 -> NaN Invalid_operation 158 dqinv229 invert 999999999 -> NaN Invalid_operation 159 dqinv230 invert 999999999 -> NaN Invalid_operation 160 dqinv231 invert 999999999 -> NaN Invalid_operation 161 dqinv232 invert 999999999 -> NaN Invalid_operation 162 -- a few randoms 163 dqinv240 invert 567468689 -> NaN Invalid_operation 164 dqinv241 invert 567367689 -> NaN Invalid_operation 165 dqinv242 invert -631917772 -> NaN Invalid_operation 166 dqinv243 invert -756253257 -> NaN Invalid_operation 167 dqinv244 invert 835590149 -> NaN Invalid_operation 168 -- test MSD 169 dqinv250 invert 2000000111000111000111000000000000 -> NaN Invalid_operation 170 dqinv251 invert 3000000111000111000111000000000000 -> NaN Invalid_operation 171 dqinv252 invert 4000000111000111000111000000000000 -> NaN Invalid_operation 172 dqinv253 invert 5000000111000111000111000000000000 -> NaN Invalid_operation 173 dqinv254 invert 6000000111000111000111000000000000 -> NaN Invalid_operation 174 dqinv255 invert 7000000111000111000111000000000000 -> NaN Invalid_operation 175 dqinv256 invert 8000000111000111000111000000000000 -> NaN Invalid_operation 176 dqinv257 invert 9000000111000111000111000000000000 -> NaN Invalid_operation 177 -- test MSD-1 178 dqinv270 invert 0200000111000111000111001000000000 -> NaN Invalid_operation 179 dqinv271 invert 0300000111000111000111000100000000 -> NaN Invalid_operation 180 dqinv272 invert 0400000111000111000111000010000000 -> NaN Invalid_operation 181 dqinv273 invert 0500000111000111000111000001000000 -> NaN Invalid_operation 182 dqinv274 invert 1600000111000111000111000000100000 -> NaN Invalid_operation 183 dqinv275 invert 1700000111000111000111000000010000 -> NaN Invalid_operation 184 dqinv276 invert 1800000111000111000111000000001000 -> NaN Invalid_operation 185 dqinv277 invert 1900000111000111000111000000000100 -> NaN Invalid_operation 186 -- test LSD 187 dqinv280 invert 0010000111000111000111000000000002 -> NaN Invalid_operation 188 dqinv281 invert 0001000111000111000111000000000003 -> NaN Invalid_operation 189 dqinv282 invert 0000000111000111000111100000000004 -> NaN Invalid_operation 190 dqinv283 invert 0000000111000111000111010000000005 -> NaN Invalid_operation 191 dqinv284 invert 1000000111000111000111001000000006 -> NaN Invalid_operation 192 dqinv285 invert 1000000111000111000111000100000007 -> NaN Invalid_operation 193 dqinv286 invert 1000000111000111000111000010000008 -> NaN Invalid_operation 194 dqinv287 invert 1000000111000111000111000001000009 -> NaN Invalid_operation 195 -- test Middie 196 dqinv288 invert 0010000111000111000111000020000000 -> NaN Invalid_operation 197 dqinv289 invert 0001000111000111000111000030000001 -> NaN Invalid_operation 198 dqinv290 invert 0000000111000111000111100040000010 -> NaN Invalid_operation 199 dqinv291 invert 0000000111000111000111010050000100 -> NaN Invalid_operation 200 dqinv292 invert 1000000111000111000111001060001000 -> NaN Invalid_operation 201 dqinv293 invert 1000000111000111000111000170010000 -> NaN Invalid_operation 202 dqinv294 invert 1000000111000111000111000080100000 -> NaN Invalid_operation 203 dqinv295 invert 1000000111000111000111000091000000 -> NaN Invalid_operation 204 -- signs 205 dqinv296 invert -1000000111000111000111000001000000 -> NaN Invalid_operation 206 dqinv299 invert 1000000111000111000111000001000000 -> 111111000111000111000111110111111 207 208 -- Nmax, Nmin, Ntiny-like 209 dqinv341 invert 9.99999999E+2998 -> NaN Invalid_operation 210 dqinv342 invert 1E-2998 -> NaN Invalid_operation 211 dqinv343 invert 1.00000000E-2998 -> NaN Invalid_operation 212 dqinv344 invert 1E-2078 -> NaN Invalid_operation 213 dqinv345 invert -1E-2078 -> NaN Invalid_operation 214 dqinv346 invert -1.00000000E-2998 -> NaN Invalid_operation 215 dqinv347 invert -1E-2998 -> NaN Invalid_operation 216 dqinv348 invert -9.99999999E+2998 -> NaN Invalid_operation 217 218 -- A few other non-integers 219 dqinv361 invert 1.0 -> NaN Invalid_operation 220 dqinv362 invert 1E+1 -> NaN Invalid_operation 221 dqinv363 invert 0.0 -> NaN Invalid_operation 222 dqinv364 invert 0E+1 -> NaN Invalid_operation 223 dqinv365 invert 9.9 -> NaN Invalid_operation 224 dqinv366 invert 9E+1 -> NaN Invalid_operation 225 226 -- All Specials are in error 227 dqinv788 invert -Inf -> NaN Invalid_operation 228 dqinv794 invert Inf -> NaN Invalid_operation 229 dqinv821 invert NaN -> NaN Invalid_operation 230 dqinv841 invert sNaN -> NaN Invalid_operation 231 -- propagating NaNs 232 dqinv861 invert NaN1 -> NaN Invalid_operation 233 dqinv862 invert +NaN2 -> NaN Invalid_operation 234 dqinv863 invert NaN3 -> NaN Invalid_operation 235 dqinv864 invert NaN4 -> NaN Invalid_operation 236 dqinv865 invert NaN5 -> NaN Invalid_operation 237 dqinv871 invert sNaN11 -> NaN Invalid_operation 238 dqinv872 invert sNaN12 -> NaN Invalid_operation 239 dqinv873 invert sNaN13 -> NaN Invalid_operation 240 dqinv874 invert sNaN14 -> NaN Invalid_operation 241 dqinv875 invert sNaN15 -> NaN Invalid_operation 242 dqinv876 invert NaN16 -> NaN Invalid_operation 243 dqinv881 invert +NaN25 -> NaN Invalid_operation 244 dqinv882 invert -NaN26 -> NaN Invalid_operation 245 dqinv883 invert -sNaN27 -> NaN Invalid_operation 246