invert.decTest 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. ------------------------------------------------------------------------
  2. -- invert.decTest -- digitwise logical INVERT --
  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), and examples from decArith
  27. invx001 invert 0 -> 111111111
  28. invx002 invert 1 -> 111111110
  29. invx003 invert 10 -> 111111101
  30. invx004 invert 111111111 -> 0
  31. invx005 invert 000000000 -> 111111111
  32. invx006 invert 101010101 -> '10101010'
  33. -- and at msd and msd-1
  34. invx007 invert 000000000 -> 111111111
  35. invx009 invert 100000000 -> 11111111
  36. invx011 invert 000000000 -> 111111111
  37. invx013 invert 010000000 -> 101111111
  38. -- Various lengths
  39. -- 123456789 123456789
  40. invx021 invert 111111111 -> 0
  41. invx022 invert 111111111111 -> 0
  42. invx023 invert 11111111 -> 100000000
  43. invx025 invert 1111111 -> 110000000
  44. invx026 invert 111111 -> 111000000
  45. invx027 invert 11111 -> 111100000
  46. invx028 invert 1111 -> 111110000
  47. invx029 invert 111 -> 111111000
  48. invx031 invert 11 -> 111111100
  49. invx032 invert 1 -> 111111110
  50. invx033 invert 111111111111 -> 0
  51. invx034 invert 11111111111 -> 0
  52. invx035 invert 1111111111 -> 0
  53. invx036 invert 111111111 -> 0
  54. invx080 invert 011111111 -> 100000000
  55. invx081 invert 101111111 -> 10000000
  56. invx082 invert 110111111 -> 1000000
  57. invx083 invert 111011111 -> 100000
  58. invx084 invert 111101111 -> 10000
  59. invx085 invert 111110111 -> 1000
  60. invx086 invert 111111011 -> 100
  61. invx087 invert 111111101 -> 10
  62. invx088 invert 111111110 -> 1
  63. invx089 invert 011111011 -> 100000100
  64. invx090 invert 101111101 -> 10000010
  65. invx091 invert 110111110 -> 1000001
  66. invx092 invert 111011101 -> 100010
  67. invx093 invert 111101011 -> 10100
  68. invx094 invert 111110111 -> 1000
  69. invx095 invert 111101011 -> 10100
  70. invx096 invert 111011101 -> 100010
  71. invx097 invert 110111110 -> 1000001
  72. invx098 invert 101111101 -> 10000010
  73. invx099 invert 011111011 -> 100000100
  74. -- non-0/1 should not be accepted, nor should signs
  75. invx220 invert 111111112 -> NaN Invalid_operation
  76. invx221 invert 333333333 -> NaN Invalid_operation
  77. invx222 invert 555555555 -> NaN Invalid_operation
  78. invx223 invert 777777777 -> NaN Invalid_operation
  79. invx224 invert 999999999 -> NaN Invalid_operation
  80. invx225 invert 222222222 -> NaN Invalid_operation
  81. invx226 invert 444444444 -> NaN Invalid_operation
  82. invx227 invert 666666666 -> NaN Invalid_operation
  83. invx228 invert 888888888 -> NaN Invalid_operation
  84. invx229 invert 999999999 -> NaN Invalid_operation
  85. invx230 invert 999999999 -> NaN Invalid_operation
  86. invx231 invert 999999999 -> NaN Invalid_operation
  87. invx232 invert 999999999 -> NaN Invalid_operation
  88. -- a few randoms
  89. invx240 invert 567468689 -> NaN Invalid_operation
  90. invx241 invert 567367689 -> NaN Invalid_operation
  91. invx242 invert -631917772 -> NaN Invalid_operation
  92. invx243 invert -756253257 -> NaN Invalid_operation
  93. invx244 invert 835590149 -> NaN Invalid_operation
  94. -- test MSD
  95. invx250 invert 200000000 -> NaN Invalid_operation
  96. invx251 invert 300000000 -> NaN Invalid_operation
  97. invx252 invert 400000000 -> NaN Invalid_operation
  98. invx253 invert 500000000 -> NaN Invalid_operation
  99. invx254 invert 600000000 -> NaN Invalid_operation
  100. invx255 invert 700000000 -> NaN Invalid_operation
  101. invx256 invert 800000000 -> NaN Invalid_operation
  102. invx257 invert 900000000 -> NaN Invalid_operation
  103. -- test MSD-1
  104. invx270 invert 021000000 -> NaN Invalid_operation
  105. invx271 invert 030100000 -> NaN Invalid_operation
  106. invx272 invert 040010000 -> NaN Invalid_operation
  107. invx273 invert 050001000 -> NaN Invalid_operation
  108. invx274 invert 160000100 -> NaN Invalid_operation
  109. invx275 invert 170000010 -> NaN Invalid_operation
  110. invx276 invert 180000000 -> NaN Invalid_operation
  111. invx277 invert 190000000 -> NaN Invalid_operation
  112. -- test LSD
  113. invx280 invert 000000002 -> NaN Invalid_operation
  114. invx281 invert 000000003 -> NaN Invalid_operation
  115. invx282 invert 000000004 -> NaN Invalid_operation
  116. invx283 invert 000000005 -> NaN Invalid_operation
  117. invx284 invert 101000006 -> NaN Invalid_operation
  118. invx285 invert 100100007 -> NaN Invalid_operation
  119. invx286 invert 100010008 -> NaN Invalid_operation
  120. invx287 invert 100001009 -> NaN Invalid_operation
  121. -- test Middie
  122. invx288 invert 000020000 -> NaN Invalid_operation
  123. invx289 invert 000030001 -> NaN Invalid_operation
  124. invx290 invert 000040000 -> NaN Invalid_operation
  125. invx291 invert 000050000 -> NaN Invalid_operation
  126. invx292 invert 101060000 -> NaN Invalid_operation
  127. invx293 invert 100170010 -> NaN Invalid_operation
  128. invx294 invert 100080100 -> NaN Invalid_operation
  129. invx295 invert 100091000 -> NaN Invalid_operation
  130. -- signs
  131. invx296 invert -100001000 -> NaN Invalid_operation
  132. invx299 invert 100001000 -> 11110111
  133. -- Nmax, Nmin, Ntiny
  134. invx341 invert 9.99999999E+999 -> NaN Invalid_operation
  135. invx342 invert 1E-999 -> NaN Invalid_operation
  136. invx343 invert 1.00000000E-999 -> NaN Invalid_operation
  137. invx344 invert 1E-1007 -> NaN Invalid_operation
  138. invx345 invert -1E-1007 -> NaN Invalid_operation
  139. invx346 invert -1.00000000E-999 -> NaN Invalid_operation
  140. invx347 invert -1E-999 -> NaN Invalid_operation
  141. invx348 invert -9.99999999E+999 -> NaN Invalid_operation
  142. -- A few other non-integers
  143. invx361 invert 1.0 -> NaN Invalid_operation
  144. invx362 invert 1E+1 -> NaN Invalid_operation
  145. invx363 invert 0.0 -> NaN Invalid_operation
  146. invx364 invert 0E+1 -> NaN Invalid_operation
  147. invx365 invert 9.9 -> NaN Invalid_operation
  148. invx366 invert 9E+1 -> NaN Invalid_operation
  149. -- All Specials are in error
  150. invx788 invert -Inf -> NaN Invalid_operation
  151. invx794 invert Inf -> NaN Invalid_operation
  152. invx821 invert NaN -> NaN Invalid_operation
  153. invx841 invert sNaN -> NaN Invalid_operation
  154. -- propagating NaNs
  155. invx861 invert NaN1 -> NaN Invalid_operation
  156. invx862 invert +NaN2 -> NaN Invalid_operation
  157. invx863 invert NaN3 -> NaN Invalid_operation
  158. invx864 invert NaN4 -> NaN Invalid_operation
  159. invx865 invert NaN5 -> NaN Invalid_operation
  160. invx871 invert sNaN11 -> NaN Invalid_operation
  161. invx872 invert sNaN12 -> NaN Invalid_operation
  162. invx873 invert sNaN13 -> NaN Invalid_operation
  163. invx874 invert sNaN14 -> NaN Invalid_operation
  164. invx875 invert sNaN15 -> NaN Invalid_operation
  165. invx876 invert NaN16 -> NaN Invalid_operation
  166. invx881 invert +NaN25 -> NaN Invalid_operation
  167. invx882 invert -NaN26 -> NaN Invalid_operation
  168. invx883 invert -sNaN27 -> NaN Invalid_operation