dqInvert.decTest 16 KB

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