ddAnd.decTest 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. ------------------------------------------------------------------------
  2. -- ddAnd.decTest -- digitwise logical AND 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@uk.ibm.com --
  19. ------------------------------------------------------------------------
  20. version: 2.59
  21. precision: 16
  22. maxExponent: 384
  23. minExponent: -383
  24. extended: 1
  25. clamp: 1
  26. rounding: half_even
  27. -- Sanity check (truth table)
  28. ddand001 and 0 0 -> 0
  29. ddand002 and 0 1 -> 0
  30. ddand003 and 1 0 -> 0
  31. ddand004 and 1 1 -> 1
  32. ddand005 and 1100 1010 -> 1000
  33. -- and at msd and msd-1
  34. -- 1234567890123456 1234567890123456 1234567890123456
  35. ddand006 and 0000000000000000 0000000000000000 -> 0
  36. ddand007 and 0000000000000000 1000000000000000 -> 0
  37. ddand008 and 1000000000000000 0000000000000000 -> 0
  38. ddand009 and 1000000000000000 1000000000000000 -> 1000000000000000
  39. ddand010 and 0000000000000000 0000000000000000 -> 0
  40. ddand011 and 0000000000000000 0100000000000000 -> 0
  41. ddand012 and 0100000000000000 0000000000000000 -> 0
  42. ddand013 and 0100000000000000 0100000000000000 -> 100000000000000
  43. -- Various lengths
  44. -- 1234567890123456 1234567890123456 1234567890123456
  45. ddand021 and 1111111111111111 1111111111111111 -> 1111111111111111
  46. ddand024 and 1111111111111111 111111111111111 -> 111111111111111
  47. ddand025 and 1111111111111111 11111111111111 -> 11111111111111
  48. ddand026 and 1111111111111111 1111111111111 -> 1111111111111
  49. ddand027 and 1111111111111111 111111111111 -> 111111111111
  50. ddand028 and 1111111111111111 11111111111 -> 11111111111
  51. ddand029 and 1111111111111111 1111111111 -> 1111111111
  52. ddand030 and 1111111111111111 111111111 -> 111111111
  53. ddand031 and 1111111111111111 11111111 -> 11111111
  54. ddand032 and 1111111111111111 1111111 -> 1111111
  55. ddand033 and 1111111111111111 111111 -> 111111
  56. ddand034 and 1111111111111111 11111 -> 11111
  57. ddand035 and 1111111111111111 1111 -> 1111
  58. ddand036 and 1111111111111111 111 -> 111
  59. ddand037 and 1111111111111111 11 -> 11
  60. ddand038 and 1111111111111111 1 -> 1
  61. ddand039 and 1111111111111111 0 -> 0
  62. ddand040 and 1111111111111111 1111111111111111 -> 1111111111111111
  63. ddand041 and 111111111111111 1111111111111111 -> 111111111111111
  64. ddand042 and 111111111111111 1111111111111111 -> 111111111111111
  65. ddand043 and 11111111111111 1111111111111111 -> 11111111111111
  66. ddand044 and 1111111111111 1111111111111111 -> 1111111111111
  67. ddand045 and 111111111111 1111111111111111 -> 111111111111
  68. ddand046 and 11111111111 1111111111111111 -> 11111111111
  69. ddand047 and 1111111111 1111111111111111 -> 1111111111
  70. ddand048 and 111111111 1111111111111111 -> 111111111
  71. ddand049 and 11111111 1111111111111111 -> 11111111
  72. ddand050 and 1111111 1111111111111111 -> 1111111
  73. ddand051 and 111111 1111111111111111 -> 111111
  74. ddand052 and 11111 1111111111111111 -> 11111
  75. ddand053 and 1111 1111111111111111 -> 1111
  76. ddand054 and 111 1111111111111111 -> 111
  77. ddand055 and 11 1111111111111111 -> 11
  78. ddand056 and 1 1111111111111111 -> 1
  79. ddand057 and 0 1111111111111111 -> 0
  80. ddand150 and 1111111111 1 -> 1
  81. ddand151 and 111111111 1 -> 1
  82. ddand152 and 11111111 1 -> 1
  83. ddand153 and 1111111 1 -> 1
  84. ddand154 and 111111 1 -> 1
  85. ddand155 and 11111 1 -> 1
  86. ddand156 and 1111 1 -> 1
  87. ddand157 and 111 1 -> 1
  88. ddand158 and 11 1 -> 1
  89. ddand159 and 1 1 -> 1
  90. ddand160 and 1111111111 0 -> 0
  91. ddand161 and 111111111 0 -> 0
  92. ddand162 and 11111111 0 -> 0
  93. ddand163 and 1111111 0 -> 0
  94. ddand164 and 111111 0 -> 0
  95. ddand165 and 11111 0 -> 0
  96. ddand166 and 1111 0 -> 0
  97. ddand167 and 111 0 -> 0
  98. ddand168 and 11 0 -> 0
  99. ddand169 and 1 0 -> 0
  100. ddand170 and 1 1111111111 -> 1
  101. ddand171 and 1 111111111 -> 1
  102. ddand172 and 1 11111111 -> 1
  103. ddand173 and 1 1111111 -> 1
  104. ddand174 and 1 111111 -> 1
  105. ddand175 and 1 11111 -> 1
  106. ddand176 and 1 1111 -> 1
  107. ddand177 and 1 111 -> 1
  108. ddand178 and 1 11 -> 1
  109. ddand179 and 1 1 -> 1
  110. ddand180 and 0 1111111111 -> 0
  111. ddand181 and 0 111111111 -> 0
  112. ddand182 and 0 11111111 -> 0
  113. ddand183 and 0 1111111 -> 0
  114. ddand184 and 0 111111 -> 0
  115. ddand185 and 0 11111 -> 0
  116. ddand186 and 0 1111 -> 0
  117. ddand187 and 0 111 -> 0
  118. ddand188 and 0 11 -> 0
  119. ddand189 and 0 1 -> 0
  120. ddand090 and 011111111 111111111 -> 11111111
  121. ddand091 and 101111111 111111111 -> 101111111
  122. ddand092 and 110111111 111111111 -> 110111111
  123. ddand093 and 111011111 111111111 -> 111011111
  124. ddand094 and 111101111 111111111 -> 111101111
  125. ddand095 and 111110111 111111111 -> 111110111
  126. ddand096 and 111111011 111111111 -> 111111011
  127. ddand097 and 111111101 111111111 -> 111111101
  128. ddand098 and 111111110 111111111 -> 111111110
  129. ddand100 and 111111111 011111111 -> 11111111
  130. ddand101 and 111111111 101111111 -> 101111111
  131. ddand102 and 111111111 110111111 -> 110111111
  132. ddand103 and 111111111 111011111 -> 111011111
  133. ddand104 and 111111111 111101111 -> 111101111
  134. ddand105 and 111111111 111110111 -> 111110111
  135. ddand106 and 111111111 111111011 -> 111111011
  136. ddand107 and 111111111 111111101 -> 111111101
  137. ddand108 and 111111111 111111110 -> 111111110
  138. -- non-0/1 should not be accepted, nor should signs
  139. ddand220 and 111111112 111111111 -> NaN Invalid_operation
  140. ddand221 and 333333333 333333333 -> NaN Invalid_operation
  141. ddand222 and 555555555 555555555 -> NaN Invalid_operation
  142. ddand223 and 777777777 777777777 -> NaN Invalid_operation
  143. ddand224 and 999999999 999999999 -> NaN Invalid_operation
  144. ddand225 and 222222222 999999999 -> NaN Invalid_operation
  145. ddand226 and 444444444 999999999 -> NaN Invalid_operation
  146. ddand227 and 666666666 999999999 -> NaN Invalid_operation
  147. ddand228 and 888888888 999999999 -> NaN Invalid_operation
  148. ddand229 and 999999999 222222222 -> NaN Invalid_operation
  149. ddand230 and 999999999 444444444 -> NaN Invalid_operation
  150. ddand231 and 999999999 666666666 -> NaN Invalid_operation
  151. ddand232 and 999999999 888888888 -> NaN Invalid_operation
  152. -- a few randoms
  153. ddand240 and 567468689 -934981942 -> NaN Invalid_operation
  154. ddand241 and 567367689 934981942 -> NaN Invalid_operation
  155. ddand242 and -631917772 -706014634 -> NaN Invalid_operation
  156. ddand243 and -756253257 138579234 -> NaN Invalid_operation
  157. ddand244 and 835590149 567435400 -> NaN Invalid_operation
  158. -- test MSD
  159. ddand250 and 2000000000000000 1000000000000000 -> NaN Invalid_operation
  160. ddand251 and 7000000000000000 1000000000000000 -> NaN Invalid_operation
  161. ddand252 and 8000000000000000 1000000000000000 -> NaN Invalid_operation
  162. ddand253 and 9000000000000000 1000000000000000 -> NaN Invalid_operation
  163. ddand254 and 2000000000000000 0000000000000000 -> NaN Invalid_operation
  164. ddand255 and 7000000000000000 0000000000000000 -> NaN Invalid_operation
  165. ddand256 and 8000000000000000 0000000000000000 -> NaN Invalid_operation
  166. ddand257 and 9000000000000000 0000000000000000 -> NaN Invalid_operation
  167. ddand258 and 1000000000000000 2000000000000000 -> NaN Invalid_operation
  168. ddand259 and 1000000000000000 7000000000000000 -> NaN Invalid_operation
  169. ddand260 and 1000000000000000 8000000000000000 -> NaN Invalid_operation
  170. ddand261 and 1000000000000000 9000000000000000 -> NaN Invalid_operation
  171. ddand262 and 0000000000000000 2000000000000000 -> NaN Invalid_operation
  172. ddand263 and 0000000000000000 7000000000000000 -> NaN Invalid_operation
  173. ddand264 and 0000000000000000 8000000000000000 -> NaN Invalid_operation
  174. ddand265 and 0000000000000000 9000000000000000 -> NaN Invalid_operation
  175. -- test MSD-1
  176. ddand270 and 0200001000000000 1000100000000010 -> NaN Invalid_operation
  177. ddand271 and 0700000100000000 1000010000000100 -> NaN Invalid_operation
  178. ddand272 and 0800000010000000 1000001000001000 -> NaN Invalid_operation
  179. ddand273 and 0900000001000000 1000000100010000 -> NaN Invalid_operation
  180. ddand274 and 1000000000100000 0200000010100000 -> NaN Invalid_operation
  181. ddand275 and 1000000000010000 0700000001000000 -> NaN Invalid_operation
  182. ddand276 and 1000000000001000 0800000010100000 -> NaN Invalid_operation
  183. ddand277 and 1000000000000100 0900000000010000 -> NaN Invalid_operation
  184. -- test LSD
  185. ddand280 and 0010000000000002 1000000100000001 -> NaN Invalid_operation
  186. ddand281 and 0001000000000007 1000001000000011 -> NaN Invalid_operation
  187. ddand282 and 0000100000000008 1000010000000001 -> NaN Invalid_operation
  188. ddand283 and 0000010000000009 1000100000000001 -> NaN Invalid_operation
  189. ddand284 and 1000001000000000 0001000000000002 -> NaN Invalid_operation
  190. ddand285 and 1000000100000000 0010000000000007 -> NaN Invalid_operation
  191. ddand286 and 1000000010000000 0100000000000008 -> NaN Invalid_operation
  192. ddand287 and 1000000001000000 1000000000000009 -> NaN Invalid_operation
  193. -- test Middie
  194. ddand288 and 0010000020000000 1000001000000000 -> NaN Invalid_operation
  195. ddand289 and 0001000070000001 1000000100000000 -> NaN Invalid_operation
  196. ddand290 and 0000100080000010 1000000010000000 -> NaN Invalid_operation
  197. ddand291 and 0000010090000100 1000000001000000 -> NaN Invalid_operation
  198. ddand292 and 1000001000001000 0000000020100000 -> NaN Invalid_operation
  199. ddand293 and 1000000100010000 0000000070010000 -> NaN Invalid_operation
  200. ddand294 and 1000000010100000 0000000080001000 -> NaN Invalid_operation
  201. ddand295 and 1000000001000000 0000000090000100 -> NaN Invalid_operation
  202. -- signs
  203. ddand296 and -1000000001000000 -0000010000000100 -> NaN Invalid_operation
  204. ddand297 and -1000000001000000 0000000010000100 -> NaN Invalid_operation
  205. ddand298 and 1000000001000000 -0000001000000100 -> NaN Invalid_operation
  206. ddand299 and 1000000001000000 0000000011000100 -> 1000000
  207. -- Nmax, Nmin, Ntiny-like
  208. ddand331 and 2 9.99999999E+199 -> NaN Invalid_operation
  209. ddand332 and 3 1E-199 -> NaN Invalid_operation
  210. ddand333 and 4 1.00000000E-199 -> NaN Invalid_operation
  211. ddand334 and 5 1E-100 -> NaN Invalid_operation
  212. ddand335 and 6 -1E-100 -> NaN Invalid_operation
  213. ddand336 and 7 -1.00000000E-199 -> NaN Invalid_operation
  214. ddand337 and 8 -1E-199 -> NaN Invalid_operation
  215. ddand338 and 9 -9.99999999E+199 -> NaN Invalid_operation
  216. ddand341 and 9.99999999E+199 -18 -> NaN Invalid_operation
  217. ddand342 and 1E-199 01 -> NaN Invalid_operation
  218. ddand343 and 1.00000000E-199 -18 -> NaN Invalid_operation
  219. ddand344 and 1E-100 18 -> NaN Invalid_operation
  220. ddand345 and -1E-100 -10 -> NaN Invalid_operation
  221. ddand346 and -1.00000000E-199 18 -> NaN Invalid_operation
  222. ddand347 and -1E-199 10 -> NaN Invalid_operation
  223. ddand348 and -9.99999999E+199 -18 -> NaN Invalid_operation
  224. -- A few other non-integers
  225. ddand361 and 1.0 1 -> NaN Invalid_operation
  226. ddand362 and 1E+1 1 -> NaN Invalid_operation
  227. ddand363 and 0.0 1 -> NaN Invalid_operation
  228. ddand364 and 0E+1 1 -> NaN Invalid_operation
  229. ddand365 and 9.9 1 -> NaN Invalid_operation
  230. ddand366 and 9E+1 1 -> NaN Invalid_operation
  231. ddand371 and 0 1.0 -> NaN Invalid_operation
  232. ddand372 and 0 1E+1 -> NaN Invalid_operation
  233. ddand373 and 0 0.0 -> NaN Invalid_operation
  234. ddand374 and 0 0E+1 -> NaN Invalid_operation
  235. ddand375 and 0 9.9 -> NaN Invalid_operation
  236. ddand376 and 0 9E+1 -> NaN Invalid_operation
  237. -- All Specials are in error
  238. ddand780 and -Inf -Inf -> NaN Invalid_operation
  239. ddand781 and -Inf -1000 -> NaN Invalid_operation
  240. ddand782 and -Inf -1 -> NaN Invalid_operation
  241. ddand783 and -Inf -0 -> NaN Invalid_operation
  242. ddand784 and -Inf 0 -> NaN Invalid_operation
  243. ddand785 and -Inf 1 -> NaN Invalid_operation
  244. ddand786 and -Inf 1000 -> NaN Invalid_operation
  245. ddand787 and -1000 -Inf -> NaN Invalid_operation
  246. ddand788 and -Inf -Inf -> NaN Invalid_operation
  247. ddand789 and -1 -Inf -> NaN Invalid_operation
  248. ddand790 and -0 -Inf -> NaN Invalid_operation
  249. ddand791 and 0 -Inf -> NaN Invalid_operation
  250. ddand792 and 1 -Inf -> NaN Invalid_operation
  251. ddand793 and 1000 -Inf -> NaN Invalid_operation
  252. ddand794 and Inf -Inf -> NaN Invalid_operation
  253. ddand800 and Inf -Inf -> NaN Invalid_operation
  254. ddand801 and Inf -1000 -> NaN Invalid_operation
  255. ddand802 and Inf -1 -> NaN Invalid_operation
  256. ddand803 and Inf -0 -> NaN Invalid_operation
  257. ddand804 and Inf 0 -> NaN Invalid_operation
  258. ddand805 and Inf 1 -> NaN Invalid_operation
  259. ddand806 and Inf 1000 -> NaN Invalid_operation
  260. ddand807 and Inf Inf -> NaN Invalid_operation
  261. ddand808 and -1000 Inf -> NaN Invalid_operation
  262. ddand809 and -Inf Inf -> NaN Invalid_operation
  263. ddand810 and -1 Inf -> NaN Invalid_operation
  264. ddand811 and -0 Inf -> NaN Invalid_operation
  265. ddand812 and 0 Inf -> NaN Invalid_operation
  266. ddand813 and 1 Inf -> NaN Invalid_operation
  267. ddand814 and 1000 Inf -> NaN Invalid_operation
  268. ddand815 and Inf Inf -> NaN Invalid_operation
  269. ddand821 and NaN -Inf -> NaN Invalid_operation
  270. ddand822 and NaN -1000 -> NaN Invalid_operation
  271. ddand823 and NaN -1 -> NaN Invalid_operation
  272. ddand824 and NaN -0 -> NaN Invalid_operation
  273. ddand825 and NaN 0 -> NaN Invalid_operation
  274. ddand826 and NaN 1 -> NaN Invalid_operation
  275. ddand827 and NaN 1000 -> NaN Invalid_operation
  276. ddand828 and NaN Inf -> NaN Invalid_operation
  277. ddand829 and NaN NaN -> NaN Invalid_operation
  278. ddand830 and -Inf NaN -> NaN Invalid_operation
  279. ddand831 and -1000 NaN -> NaN Invalid_operation
  280. ddand832 and -1 NaN -> NaN Invalid_operation
  281. ddand833 and -0 NaN -> NaN Invalid_operation
  282. ddand834 and 0 NaN -> NaN Invalid_operation
  283. ddand835 and 1 NaN -> NaN Invalid_operation
  284. ddand836 and 1000 NaN -> NaN Invalid_operation
  285. ddand837 and Inf NaN -> NaN Invalid_operation
  286. ddand841 and sNaN -Inf -> NaN Invalid_operation
  287. ddand842 and sNaN -1000 -> NaN Invalid_operation
  288. ddand843 and sNaN -1 -> NaN Invalid_operation
  289. ddand844 and sNaN -0 -> NaN Invalid_operation
  290. ddand845 and sNaN 0 -> NaN Invalid_operation
  291. ddand846 and sNaN 1 -> NaN Invalid_operation
  292. ddand847 and sNaN 1000 -> NaN Invalid_operation
  293. ddand848 and sNaN NaN -> NaN Invalid_operation
  294. ddand849 and sNaN sNaN -> NaN Invalid_operation
  295. ddand850 and NaN sNaN -> NaN Invalid_operation
  296. ddand851 and -Inf sNaN -> NaN Invalid_operation
  297. ddand852 and -1000 sNaN -> NaN Invalid_operation
  298. ddand853 and -1 sNaN -> NaN Invalid_operation
  299. ddand854 and -0 sNaN -> NaN Invalid_operation
  300. ddand855 and 0 sNaN -> NaN Invalid_operation
  301. ddand856 and 1 sNaN -> NaN Invalid_operation
  302. ddand857 and 1000 sNaN -> NaN Invalid_operation
  303. ddand858 and Inf sNaN -> NaN Invalid_operation
  304. ddand859 and NaN sNaN -> NaN Invalid_operation
  305. -- propagating NaNs
  306. ddand861 and NaN1 -Inf -> NaN Invalid_operation
  307. ddand862 and +NaN2 -1000 -> NaN Invalid_operation
  308. ddand863 and NaN3 1000 -> NaN Invalid_operation
  309. ddand864 and NaN4 Inf -> NaN Invalid_operation
  310. ddand865 and NaN5 +NaN6 -> NaN Invalid_operation
  311. ddand866 and -Inf NaN7 -> NaN Invalid_operation
  312. ddand867 and -1000 NaN8 -> NaN Invalid_operation
  313. ddand868 and 1000 NaN9 -> NaN Invalid_operation
  314. ddand869 and Inf +NaN10 -> NaN Invalid_operation
  315. ddand871 and sNaN11 -Inf -> NaN Invalid_operation
  316. ddand872 and sNaN12 -1000 -> NaN Invalid_operation
  317. ddand873 and sNaN13 1000 -> NaN Invalid_operation
  318. ddand874 and sNaN14 NaN17 -> NaN Invalid_operation
  319. ddand875 and sNaN15 sNaN18 -> NaN Invalid_operation
  320. ddand876 and NaN16 sNaN19 -> NaN Invalid_operation
  321. ddand877 and -Inf +sNaN20 -> NaN Invalid_operation
  322. ddand878 and -1000 sNaN21 -> NaN Invalid_operation
  323. ddand879 and 1000 sNaN22 -> NaN Invalid_operation
  324. ddand880 and Inf sNaN23 -> NaN Invalid_operation
  325. ddand881 and +NaN25 +sNaN24 -> NaN Invalid_operation
  326. ddand882 and -NaN26 NaN28 -> NaN Invalid_operation
  327. ddand883 and -sNaN27 sNaN29 -> NaN Invalid_operation
  328. ddand884 and 1000 -NaN30 -> NaN Invalid_operation
  329. ddand885 and 1000 -sNaN31 -> NaN Invalid_operation