1 ------------------------------------------------------------------------ 2 -- ddInvert.decTest -- digitwise logical INVERT 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 ddinv001 invert 0 -> 1111111111111111 31 ddinv002 invert 1 -> 1111111111111110 32 ddinv003 invert 10 -> 1111111111111101 33 ddinv004 invert 111111111 -> 1111111000000000 34 ddinv005 invert 000000000 -> 1111111111111111 35 -- and at msd and msd-1 36 ddinv007 invert 0000000000000000 -> 1111111111111111 37 ddinv008 invert 1000000000000000 -> 111111111111111 38 ddinv009 invert 0000000000000000 -> 1111111111111111 39 ddinv010 invert 0100000000000000 -> 1011111111111111 40 ddinv011 invert 0111111111111111 -> 1000000000000000 41 ddinv012 invert 1111111111111111 -> 0 42 ddinv013 invert 0011111111111111 -> 1100000000000000 43 ddinv014 invert 0111111111111111 -> 1000000000000000 44 45 -- Various lengths 46 -- 123456789 1234567890123456 47 ddinv021 invert 111111111 -> 1111111000000000 48 ddinv022 invert 111111111111 -> 1111000000000000 49 ddinv023 invert 11111111 -> 1111111100000000 50 ddinv025 invert 1111111 -> 1111111110000000 51 ddinv026 invert 111111 -> 1111111111000000 52 ddinv027 invert 11111 -> 1111111111100000 53 ddinv028 invert 1111 -> 1111111111110000 54 ddinv029 invert 111 -> 1111111111111000 55 ddinv031 invert 11 -> 1111111111111100 56 ddinv032 invert 1 -> 1111111111111110 57 ddinv033 invert 111111111111 -> 1111000000000000 58 ddinv034 invert 11111111111 -> 1111100000000000 59 ddinv035 invert 1111111111 -> 1111110000000000 60 ddinv036 invert 111111111 -> 1111111000000000 61 62 ddinv040 invert 011111111 -> 1111111100000000 63 ddinv041 invert 101111111 -> 1111111010000000 64 ddinv042 invert 110111111 -> 1111111001000000 65 ddinv043 invert 111011111 -> 1111111000100000 66 ddinv044 invert 111101111 -> 1111111000010000 67 ddinv045 invert 111110111 -> 1111111000001000 68 ddinv046 invert 111111011 -> 1111111000000100 69 ddinv047 invert 111111101 -> 1111111000000010 70 ddinv048 invert 111111110 -> 1111111000000001 71 ddinv049 invert 011111011 -> 1111111100000100 72 ddinv050 invert 101111101 -> 1111111010000010 73 ddinv051 invert 110111110 -> 1111111001000001 74 ddinv052 invert 111011101 -> 1111111000100010 75 ddinv053 invert 111101011 -> 1111111000010100 76 ddinv054 invert 111110111 -> 1111111000001000 77 ddinv055 invert 111101011 -> 1111111000010100 78 ddinv056 invert 111011101 -> 1111111000100010 79 ddinv057 invert 110111110 -> 1111111001000001 80 ddinv058 invert 101111101 -> 1111111010000010 81 ddinv059 invert 011111011 -> 1111111100000100 82 83 ddinv080 invert 1000000011111111 -> 111111100000000 84 ddinv081 invert 0100000101111111 -> 1011111010000000 85 ddinv082 invert 0010000110111111 -> 1101111001000000 86 ddinv083 invert 0001000111011111 -> 1110111000100000 87 ddinv084 invert 0000100111101111 -> 1111011000010000 88 ddinv085 invert 0000010111110111 -> 1111101000001000 89 ddinv086 invert 0000001111111011 -> 1111110000000100 90 ddinv087 invert 0000010111111101 -> 1111101000000010 91 ddinv088 invert 0000100111111110 -> 1111011000000001 92 ddinv089 invert 0001000011111011 -> 1110111100000100 93 ddinv090 invert 0010000101111101 -> 1101111010000010 94 ddinv091 invert 0100000110111110 -> 1011111001000001 95 ddinv092 invert 1000000111011101 -> 111111000100010 96 ddinv093 invert 0100000111101011 -> 1011111000010100 97 ddinv094 invert 0010000111110111 -> 1101111000001000 98 ddinv095 invert 0001000111101011 -> 1110111000010100 99 ddinv096 invert 0000100111011101 -> 1111011000100010 100 ddinv097 invert 0000010110111110 -> 1111101001000001 101 ddinv098 invert 0000001101111101 -> 1111110010000010 102 ddinv099 invert 0000010011111011 -> 1111101100000100 103 104 -- non-0/1 should not be accepted, nor should signs 105 ddinv220 invert 111111112 -> NaN Invalid_operation 106 ddinv221 invert 333333333 -> NaN Invalid_operation 107 ddinv222 invert 555555555 -> NaN Invalid_operation 108 ddinv223 invert 777777777 -> NaN Invalid_operation 109 ddinv224 invert 999999999 -> NaN Invalid_operation 110 ddinv225 invert 222222222 -> NaN Invalid_operation 111 ddinv226 invert 444444444 -> NaN Invalid_operation 112 ddinv227 invert 666666666 -> NaN Invalid_operation 113 ddinv228 invert 888888888 -> NaN Invalid_operation 114 ddinv229 invert 999999999 -> NaN Invalid_operation 115 ddinv230 invert 999999999 -> NaN Invalid_operation 116 ddinv231 invert 999999999 -> NaN Invalid_operation 117 ddinv232 invert 999999999 -> NaN Invalid_operation 118 -- a few randoms 119 ddinv240 invert 567468689 -> NaN Invalid_operation 120 ddinv241 invert 567367689 -> NaN Invalid_operation 121 ddinv242 invert -631917772 -> NaN Invalid_operation 122 ddinv243 invert -756253257 -> NaN Invalid_operation 123 ddinv244 invert 835590149 -> NaN Invalid_operation 124 -- test MSD 125 ddinv250 invert 2000000000000000 -> NaN Invalid_operation 126 ddinv251 invert 3000000000000000 -> NaN Invalid_operation 127 ddinv252 invert 4000000000000000 -> NaN Invalid_operation 128 ddinv253 invert 5000000000000000 -> NaN Invalid_operation 129 ddinv254 invert 6000000000000000 -> NaN Invalid_operation 130 ddinv255 invert 7000000000000000 -> NaN Invalid_operation 131 ddinv256 invert 8000000000000000 -> NaN Invalid_operation 132 ddinv257 invert 9000000000000000 -> NaN Invalid_operation 133 -- test MSD-1 134 ddinv270 invert 0200001000000000 -> NaN Invalid_operation 135 ddinv271 invert 0300000100000000 -> NaN Invalid_operation 136 ddinv272 invert 0400000010000000 -> NaN Invalid_operation 137 ddinv273 invert 0500000001000000 -> NaN Invalid_operation 138 ddinv274 invert 1600000000100000 -> NaN Invalid_operation 139 ddinv275 invert 1700000000010000 -> NaN Invalid_operation 140 ddinv276 invert 1800000000001000 -> NaN Invalid_operation 141 ddinv277 invert 1900000000000100 -> NaN Invalid_operation 142 -- test LSD 143 ddinv280 invert 0010000000000002 -> NaN Invalid_operation 144 ddinv281 invert 0001000000000003 -> NaN Invalid_operation 145 ddinv282 invert 0000100000000004 -> NaN Invalid_operation 146 ddinv283 invert 0000010000000005 -> NaN Invalid_operation 147 ddinv284 invert 1000001000000006 -> NaN Invalid_operation 148 ddinv285 invert 1000000100000007 -> NaN Invalid_operation 149 ddinv286 invert 1000000010000008 -> NaN Invalid_operation 150 ddinv287 invert 1000000001000009 -> NaN Invalid_operation 151 -- test Middie 152 ddinv288 invert 0010000020000000 -> NaN Invalid_operation 153 ddinv289 invert 0001000030000001 -> NaN Invalid_operation 154 ddinv290 invert 0000100040000010 -> NaN Invalid_operation 155 ddinv291 invert 0000010050000100 -> NaN Invalid_operation 156 ddinv292 invert 1000001060001000 -> NaN Invalid_operation 157 ddinv293 invert 1000000170010000 -> NaN Invalid_operation 158 ddinv294 invert 1000000080100000 -> NaN Invalid_operation 159 ddinv295 invert 1000000091000000 -> NaN Invalid_operation 160 -- sign 161 ddinv296 invert -1000000001000000 -> NaN Invalid_operation 162 ddinv299 invert 1000000001000000 -> 111111110111111 163 164 165 -- Nmax, Nmin, Ntiny-like 166 ddinv341 invert 9.99999999E+299 -> NaN Invalid_operation 167 ddinv342 invert 1E-299 -> NaN Invalid_operation 168 ddinv343 invert 1.00000000E-299 -> NaN Invalid_operation 169 ddinv344 invert 1E-207 -> NaN Invalid_operation 170 ddinv345 invert -1E-207 -> NaN Invalid_operation 171 ddinv346 invert -1.00000000E-299 -> NaN Invalid_operation 172 ddinv347 invert -1E-299 -> NaN Invalid_operation 173 ddinv348 invert -9.99999999E+299 -> NaN Invalid_operation 174 175 -- A few other non-integers 176 ddinv361 invert 1.0 -> NaN Invalid_operation 177 ddinv362 invert 1E+1 -> NaN Invalid_operation 178 ddinv363 invert 0.0 -> NaN Invalid_operation 179 ddinv364 invert 0E+1 -> NaN Invalid_operation 180 ddinv365 invert 9.9 -> NaN Invalid_operation 181 ddinv366 invert 9E+1 -> NaN Invalid_operation 182 183 -- All Specials are in error 184 ddinv788 invert -Inf -> NaN Invalid_operation 185 ddinv794 invert Inf -> NaN Invalid_operation 186 ddinv821 invert NaN -> NaN Invalid_operation 187 ddinv841 invert sNaN -> NaN Invalid_operation 188 -- propagating NaNs 189 ddinv861 invert NaN1 -> NaN Invalid_operation 190 ddinv862 invert +NaN2 -> NaN Invalid_operation 191 ddinv863 invert NaN3 -> NaN Invalid_operation 192 ddinv864 invert NaN4 -> NaN Invalid_operation 193 ddinv865 invert NaN5 -> NaN Invalid_operation 194 ddinv871 invert sNaN11 -> NaN Invalid_operation 195 ddinv872 invert sNaN12 -> NaN Invalid_operation 196 ddinv873 invert sNaN13 -> NaN Invalid_operation 197 ddinv874 invert sNaN14 -> NaN Invalid_operation 198 ddinv875 invert sNaN15 -> NaN Invalid_operation 199 ddinv876 invert NaN16 -> NaN Invalid_operation 200 ddinv881 invert +NaN25 -> NaN Invalid_operation 201 ddinv882 invert -NaN26 -> NaN Invalid_operation 202 ddinv883 invert -sNaN27 -> NaN Invalid_operation 203