and.decTest 16 KB

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