ddInvert.decTest 9.9 KB

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