ddRotate.decTest 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. ------------------------------------------------------------------------
  2. -- ddRotate.decTest -- rotate a decDouble coefficient left or right --
  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
  28. ddrot001 rotate 0 0 -> 0
  29. ddrot002 rotate 0 2 -> 0
  30. ddrot003 rotate 1 2 -> 100
  31. ddrot004 rotate 1 15 -> 1000000000000000
  32. ddrot005 rotate 1 16 -> 1
  33. ddrot006 rotate 1 -1 -> 1000000000000000
  34. ddrot007 rotate 0 -2 -> 0
  35. ddrot008 rotate 1234567890123456 -1 -> 6123456789012345
  36. ddrot009 rotate 1234567890123456 -15 -> 2345678901234561
  37. ddrot010 rotate 1234567890123456 -16 -> 1234567890123456
  38. ddrot011 rotate 9934567890123456 -15 -> 9345678901234569
  39. ddrot012 rotate 9934567890123456 -16 -> 9934567890123456
  40. -- rhs must be an integer
  41. ddrot015 rotate 1 1.5 -> NaN Invalid_operation
  42. ddrot016 rotate 1 1.0 -> NaN Invalid_operation
  43. ddrot017 rotate 1 0.1 -> NaN Invalid_operation
  44. ddrot018 rotate 1 0.0 -> NaN Invalid_operation
  45. ddrot019 rotate 1 1E+1 -> NaN Invalid_operation
  46. ddrot020 rotate 1 1E+99 -> NaN Invalid_operation
  47. ddrot021 rotate 1 Inf -> NaN Invalid_operation
  48. ddrot022 rotate 1 -Inf -> NaN Invalid_operation
  49. -- and |rhs| <= precision
  50. ddrot025 rotate 1 -1000 -> NaN Invalid_operation
  51. ddrot026 rotate 1 -17 -> NaN Invalid_operation
  52. ddrot027 rotate 1 17 -> NaN Invalid_operation
  53. ddrot028 rotate 1 1000 -> NaN Invalid_operation
  54. -- full pattern
  55. ddrot030 rotate 1234567890123456 -16 -> 1234567890123456
  56. ddrot031 rotate 1234567890123456 -15 -> 2345678901234561
  57. ddrot032 rotate 1234567890123456 -14 -> 3456789012345612
  58. ddrot033 rotate 1234567890123456 -13 -> 4567890123456123
  59. ddrot034 rotate 1234567890123456 -12 -> 5678901234561234
  60. ddrot035 rotate 1234567890123456 -11 -> 6789012345612345
  61. ddrot036 rotate 1234567890123456 -10 -> 7890123456123456
  62. ddrot037 rotate 1234567890123456 -9 -> 8901234561234567
  63. ddrot038 rotate 1234567890123456 -8 -> 9012345612345678
  64. ddrot039 rotate 1234567890123456 -7 -> 123456123456789
  65. ddrot040 rotate 1234567890123456 -6 -> 1234561234567890
  66. ddrot041 rotate 1234567890123456 -5 -> 2345612345678901
  67. ddrot042 rotate 1234567890123456 -4 -> 3456123456789012
  68. ddrot043 rotate 1234567890123456 -3 -> 4561234567890123
  69. ddrot044 rotate 1234567890123456 -2 -> 5612345678901234
  70. ddrot045 rotate 1234567890123456 -1 -> 6123456789012345
  71. ddrot046 rotate 1234567890123456 -0 -> 1234567890123456
  72. ddrot047 rotate 1234567890123456 +0 -> 1234567890123456
  73. ddrot048 rotate 1234567890123456 +1 -> 2345678901234561
  74. ddrot049 rotate 1234567890123456 +2 -> 3456789012345612
  75. ddrot050 rotate 1234567890123456 +3 -> 4567890123456123
  76. ddrot051 rotate 1234567890123456 +4 -> 5678901234561234
  77. ddrot052 rotate 1234567890123456 +5 -> 6789012345612345
  78. ddrot053 rotate 1234567890123456 +6 -> 7890123456123456
  79. ddrot054 rotate 1234567890123456 +7 -> 8901234561234567
  80. ddrot055 rotate 1234567890123456 +8 -> 9012345612345678
  81. ddrot056 rotate 1234567890123456 +9 -> 123456123456789
  82. ddrot057 rotate 1234567890123456 +10 -> 1234561234567890
  83. ddrot058 rotate 1234567890123456 +11 -> 2345612345678901
  84. ddrot059 rotate 1234567890123456 +12 -> 3456123456789012
  85. ddrot060 rotate 1234567890123456 +13 -> 4561234567890123
  86. ddrot061 rotate 1234567890123456 +14 -> 5612345678901234
  87. ddrot062 rotate 1234567890123456 +15 -> 6123456789012345
  88. ddrot063 rotate 1234567890123456 +16 -> 1234567890123456
  89. -- zeros
  90. ddrot070 rotate 0E-10 +9 -> 0E-10
  91. ddrot071 rotate 0E-10 -9 -> 0E-10
  92. ddrot072 rotate 0.000 +9 -> 0.000
  93. ddrot073 rotate 0.000 -9 -> 0.000
  94. ddrot074 rotate 0E+10 +9 -> 0E+10
  95. ddrot075 rotate 0E+10 -9 -> 0E+10
  96. ddrot076 rotate -0E-10 +9 -> -0E-10
  97. ddrot077 rotate -0E-10 -9 -> -0E-10
  98. ddrot078 rotate -0.000 +9 -> -0.000
  99. ddrot079 rotate -0.000 -9 -> -0.000
  100. ddrot080 rotate -0E+10 +9 -> -0E+10
  101. ddrot081 rotate -0E+10 -9 -> -0E+10
  102. -- Nmax, Nmin, Ntiny
  103. ddrot141 rotate 9.999999999999999E+384 -1 -> 9.999999999999999E+384
  104. ddrot142 rotate 9.999999999999999E+384 -15 -> 9.999999999999999E+384
  105. ddrot143 rotate 9.999999999999999E+384 1 -> 9.999999999999999E+384
  106. ddrot144 rotate 9.999999999999999E+384 15 -> 9.999999999999999E+384
  107. ddrot145 rotate 1E-383 -1 -> 1.000000000000000E-368
  108. ddrot146 rotate 1E-383 -15 -> 1.0E-382
  109. ddrot147 rotate 1E-383 1 -> 1.0E-382
  110. ddrot148 rotate 1E-383 15 -> 1.000000000000000E-368
  111. ddrot151 rotate 1.000000000000000E-383 -1 -> 1.00000000000000E-384
  112. ddrot152 rotate 1.000000000000000E-383 -15 -> 1E-398
  113. ddrot153 rotate 1.000000000000000E-383 1 -> 1E-398
  114. ddrot154 rotate 1.000000000000000E-383 15 -> 1.00000000000000E-384
  115. ddrot155 rotate 9.000000000000000E-383 -1 -> 9.00000000000000E-384
  116. ddrot156 rotate 9.000000000000000E-383 -15 -> 9E-398
  117. ddrot157 rotate 9.000000000000000E-383 1 -> 9E-398
  118. ddrot158 rotate 9.000000000000000E-383 15 -> 9.00000000000000E-384
  119. ddrot160 rotate 1E-398 -1 -> 1.000000000000000E-383
  120. ddrot161 rotate 1E-398 -15 -> 1.0E-397
  121. ddrot162 rotate 1E-398 1 -> 1.0E-397
  122. ddrot163 rotate 1E-398 15 -> 1.000000000000000E-383
  123. -- negatives
  124. ddrot171 rotate -9.999999999999999E+384 -1 -> -9.999999999999999E+384
  125. ddrot172 rotate -9.999999999999999E+384 -15 -> -9.999999999999999E+384
  126. ddrot173 rotate -9.999999999999999E+384 1 -> -9.999999999999999E+384
  127. ddrot174 rotate -9.999999999999999E+384 15 -> -9.999999999999999E+384
  128. ddrot175 rotate -1E-383 -1 -> -1.000000000000000E-368
  129. ddrot176 rotate -1E-383 -15 -> -1.0E-382
  130. ddrot177 rotate -1E-383 1 -> -1.0E-382
  131. ddrot178 rotate -1E-383 15 -> -1.000000000000000E-368
  132. ddrot181 rotate -1.000000000000000E-383 -1 -> -1.00000000000000E-384
  133. ddrot182 rotate -1.000000000000000E-383 -15 -> -1E-398
  134. ddrot183 rotate -1.000000000000000E-383 1 -> -1E-398
  135. ddrot184 rotate -1.000000000000000E-383 15 -> -1.00000000000000E-384
  136. ddrot185 rotate -9.000000000000000E-383 -1 -> -9.00000000000000E-384
  137. ddrot186 rotate -9.000000000000000E-383 -15 -> -9E-398
  138. ddrot187 rotate -9.000000000000000E-383 1 -> -9E-398
  139. ddrot188 rotate -9.000000000000000E-383 15 -> -9.00000000000000E-384
  140. ddrot190 rotate -1E-398 -1 -> -1.000000000000000E-383
  141. ddrot191 rotate -1E-398 -15 -> -1.0E-397
  142. ddrot192 rotate -1E-398 1 -> -1.0E-397
  143. ddrot193 rotate -1E-398 15 -> -1.000000000000000E-383
  144. -- more negatives (of sanities)
  145. ddrot201 rotate -0 0 -> -0
  146. ddrot202 rotate -0 2 -> -0
  147. ddrot203 rotate -1 2 -> -100
  148. ddrot204 rotate -1 15 -> -1000000000000000
  149. ddrot205 rotate -1 16 -> -1
  150. ddrot206 rotate -1 -1 -> -1000000000000000
  151. ddrot207 rotate -0 -2 -> -0
  152. ddrot208 rotate -1234567890123456 -1 -> -6123456789012345
  153. ddrot209 rotate -1234567890123456 -15 -> -2345678901234561
  154. ddrot210 rotate -1234567890123456 -16 -> -1234567890123456
  155. ddrot211 rotate -9934567890123456 -15 -> -9345678901234569
  156. ddrot212 rotate -9934567890123456 -16 -> -9934567890123456
  157. -- Specials; NaNs are handled as usual
  158. ddrot781 rotate -Inf -8 -> -Infinity
  159. ddrot782 rotate -Inf -1 -> -Infinity
  160. ddrot783 rotate -Inf -0 -> -Infinity
  161. ddrot784 rotate -Inf 0 -> -Infinity
  162. ddrot785 rotate -Inf 1 -> -Infinity
  163. ddrot786 rotate -Inf 8 -> -Infinity
  164. ddrot787 rotate -1000 -Inf -> NaN Invalid_operation
  165. ddrot788 rotate -Inf -Inf -> NaN Invalid_operation
  166. ddrot789 rotate -1 -Inf -> NaN Invalid_operation
  167. ddrot790 rotate -0 -Inf -> NaN Invalid_operation
  168. ddrot791 rotate 0 -Inf -> NaN Invalid_operation
  169. ddrot792 rotate 1 -Inf -> NaN Invalid_operation
  170. ddrot793 rotate 1000 -Inf -> NaN Invalid_operation
  171. ddrot794 rotate Inf -Inf -> NaN Invalid_operation
  172. ddrot800 rotate Inf -Inf -> NaN Invalid_operation
  173. ddrot801 rotate Inf -8 -> Infinity
  174. ddrot802 rotate Inf -1 -> Infinity
  175. ddrot803 rotate Inf -0 -> Infinity
  176. ddrot804 rotate Inf 0 -> Infinity
  177. ddrot805 rotate Inf 1 -> Infinity
  178. ddrot806 rotate Inf 8 -> Infinity
  179. ddrot807 rotate Inf Inf -> NaN Invalid_operation
  180. ddrot808 rotate -1000 Inf -> NaN Invalid_operation
  181. ddrot809 rotate -Inf Inf -> NaN Invalid_operation
  182. ddrot810 rotate -1 Inf -> NaN Invalid_operation
  183. ddrot811 rotate -0 Inf -> NaN Invalid_operation
  184. ddrot812 rotate 0 Inf -> NaN Invalid_operation
  185. ddrot813 rotate 1 Inf -> NaN Invalid_operation
  186. ddrot814 rotate 1000 Inf -> NaN Invalid_operation
  187. ddrot815 rotate Inf Inf -> NaN Invalid_operation
  188. ddrot821 rotate NaN -Inf -> NaN
  189. ddrot822 rotate NaN -1000 -> NaN
  190. ddrot823 rotate NaN -1 -> NaN
  191. ddrot824 rotate NaN -0 -> NaN
  192. ddrot825 rotate NaN 0 -> NaN
  193. ddrot826 rotate NaN 1 -> NaN
  194. ddrot827 rotate NaN 1000 -> NaN
  195. ddrot828 rotate NaN Inf -> NaN
  196. ddrot829 rotate NaN NaN -> NaN
  197. ddrot830 rotate -Inf NaN -> NaN
  198. ddrot831 rotate -1000 NaN -> NaN
  199. ddrot832 rotate -1 NaN -> NaN
  200. ddrot833 rotate -0 NaN -> NaN
  201. ddrot834 rotate 0 NaN -> NaN
  202. ddrot835 rotate 1 NaN -> NaN
  203. ddrot836 rotate 1000 NaN -> NaN
  204. ddrot837 rotate Inf NaN -> NaN
  205. ddrot841 rotate sNaN -Inf -> NaN Invalid_operation
  206. ddrot842 rotate sNaN -1000 -> NaN Invalid_operation
  207. ddrot843 rotate sNaN -1 -> NaN Invalid_operation
  208. ddrot844 rotate sNaN -0 -> NaN Invalid_operation
  209. ddrot845 rotate sNaN 0 -> NaN Invalid_operation
  210. ddrot846 rotate sNaN 1 -> NaN Invalid_operation
  211. ddrot847 rotate sNaN 1000 -> NaN Invalid_operation
  212. ddrot848 rotate sNaN NaN -> NaN Invalid_operation
  213. ddrot849 rotate sNaN sNaN -> NaN Invalid_operation
  214. ddrot850 rotate NaN sNaN -> NaN Invalid_operation
  215. ddrot851 rotate -Inf sNaN -> NaN Invalid_operation
  216. ddrot852 rotate -1000 sNaN -> NaN Invalid_operation
  217. ddrot853 rotate -1 sNaN -> NaN Invalid_operation
  218. ddrot854 rotate -0 sNaN -> NaN Invalid_operation
  219. ddrot855 rotate 0 sNaN -> NaN Invalid_operation
  220. ddrot856 rotate 1 sNaN -> NaN Invalid_operation
  221. ddrot857 rotate 1000 sNaN -> NaN Invalid_operation
  222. ddrot858 rotate Inf sNaN -> NaN Invalid_operation
  223. ddrot859 rotate NaN sNaN -> NaN Invalid_operation
  224. -- propagating NaNs
  225. ddrot861 rotate NaN1 -Inf -> NaN1
  226. ddrot862 rotate +NaN2 -1000 -> NaN2
  227. ddrot863 rotate NaN3 1000 -> NaN3
  228. ddrot864 rotate NaN4 Inf -> NaN4
  229. ddrot865 rotate NaN5 +NaN6 -> NaN5
  230. ddrot866 rotate -Inf NaN7 -> NaN7
  231. ddrot867 rotate -1000 NaN8 -> NaN8
  232. ddrot868 rotate 1000 NaN9 -> NaN9
  233. ddrot869 rotate Inf +NaN10 -> NaN10
  234. ddrot871 rotate sNaN11 -Inf -> NaN11 Invalid_operation
  235. ddrot872 rotate sNaN12 -1000 -> NaN12 Invalid_operation
  236. ddrot873 rotate sNaN13 1000 -> NaN13 Invalid_operation
  237. ddrot874 rotate sNaN14 NaN17 -> NaN14 Invalid_operation
  238. ddrot875 rotate sNaN15 sNaN18 -> NaN15 Invalid_operation
  239. ddrot876 rotate NaN16 sNaN19 -> NaN19 Invalid_operation
  240. ddrot877 rotate -Inf +sNaN20 -> NaN20 Invalid_operation
  241. ddrot878 rotate -1000 sNaN21 -> NaN21 Invalid_operation
  242. ddrot879 rotate 1000 sNaN22 -> NaN22 Invalid_operation
  243. ddrot880 rotate Inf sNaN23 -> NaN23 Invalid_operation
  244. ddrot881 rotate +NaN25 +sNaN24 -> NaN24 Invalid_operation
  245. ddrot882 rotate -NaN26 NaN28 -> -NaN26
  246. ddrot883 rotate -sNaN27 sNaN29 -> -NaN27 Invalid_operation
  247. ddrot884 rotate 1000 -NaN30 -> -NaN30
  248. ddrot885 rotate 1000 -sNaN31 -> -NaN31 Invalid_operation