rotate.decTest 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. ------------------------------------------------------------------------
  2. -- rotate.decTest -- rotate 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. extended: 1
  22. precision: 9
  23. rounding: half_up
  24. maxExponent: 999
  25. minExponent: -999
  26. -- Sanity check
  27. rotx001 rotate 0 0 -> 0
  28. rotx002 rotate 0 2 -> 0
  29. rotx003 rotate 1 2 -> 100
  30. rotx004 rotate 34 8 -> 400000003
  31. rotx005 rotate 1 9 -> 1
  32. rotx006 rotate 1 -1 -> 100000000
  33. rotx007 rotate 123456789 -1 -> 912345678
  34. rotx008 rotate 123456789 -8 -> 234567891
  35. rotx009 rotate 123456789 -9 -> 123456789
  36. rotx010 rotate 0 -2 -> 0
  37. -- rhs must be an integer
  38. rotx011 rotate 1 1.5 -> NaN Invalid_operation
  39. rotx012 rotate 1 1.0 -> NaN Invalid_operation
  40. rotx013 rotate 1 0.1 -> NaN Invalid_operation
  41. rotx014 rotate 1 0.0 -> NaN Invalid_operation
  42. rotx015 rotate 1 1E+1 -> NaN Invalid_operation
  43. rotx016 rotate 1 1E+99 -> NaN Invalid_operation
  44. rotx017 rotate 1 Inf -> NaN Invalid_operation
  45. rotx018 rotate 1 -Inf -> NaN Invalid_operation
  46. -- and |rhs| <= precision
  47. rotx020 rotate 1 -1000 -> NaN Invalid_operation
  48. rotx021 rotate 1 -10 -> NaN Invalid_operation
  49. rotx022 rotate 1 10 -> NaN Invalid_operation
  50. rotx023 rotate 1 1000 -> NaN Invalid_operation
  51. -- full pattern
  52. rotx030 rotate 123456789 -9 -> 123456789
  53. rotx031 rotate 123456789 -8 -> 234567891
  54. rotx032 rotate 123456789 -7 -> 345678912
  55. rotx033 rotate 123456789 -6 -> 456789123
  56. rotx034 rotate 123456789 -5 -> 567891234
  57. rotx035 rotate 123456789 -4 -> 678912345
  58. rotx036 rotate 123456789 -3 -> 789123456
  59. rotx037 rotate 123456789 -2 -> 891234567
  60. rotx038 rotate 123456789 -1 -> 912345678
  61. rotx039 rotate 123456789 -0 -> 123456789
  62. rotx040 rotate 123456789 +0 -> 123456789
  63. rotx041 rotate 123456789 +1 -> 234567891
  64. rotx042 rotate 123456789 +2 -> 345678912
  65. rotx043 rotate 123456789 +3 -> 456789123
  66. rotx044 rotate 123456789 +4 -> 567891234
  67. rotx045 rotate 123456789 +5 -> 678912345
  68. rotx046 rotate 123456789 +6 -> 789123456
  69. rotx047 rotate 123456789 +7 -> 891234567
  70. rotx048 rotate 123456789 +8 -> 912345678
  71. rotx049 rotate 123456789 +9 -> 123456789
  72. -- zeros
  73. rotx060 rotate 0E-10 +9 -> 0E-10
  74. rotx061 rotate 0E-10 -9 -> 0E-10
  75. rotx062 rotate 0.000 +9 -> 0.000
  76. rotx063 rotate 0.000 -9 -> 0.000
  77. rotx064 rotate 0E+10 +9 -> 0E+10
  78. rotx065 rotate 0E+10 -9 -> 0E+10
  79. rotx066 rotate -0E-10 +9 -> -0E-10
  80. rotx067 rotate -0E-10 -9 -> -0E-10
  81. rotx068 rotate -0.000 +9 -> -0.000
  82. rotx069 rotate -0.000 -9 -> -0.000
  83. rotx070 rotate -0E+10 +9 -> -0E+10
  84. rotx071 rotate -0E+10 -9 -> -0E+10
  85. -- Nmax, Nmin, Ntiny
  86. rotx141 rotate 9.99999999E+999 -1 -> 9.99999999E+999
  87. rotx142 rotate 9.99999999E+999 -8 -> 9.99999999E+999
  88. rotx143 rotate 9.99999999E+999 1 -> 9.99999999E+999
  89. rotx144 rotate 9.99999999E+999 8 -> 9.99999999E+999
  90. rotx145 rotate 1E-999 -1 -> 1.00000000E-991
  91. rotx146 rotate 1E-999 -8 -> 1.0E-998
  92. rotx147 rotate 1E-999 1 -> 1.0E-998
  93. rotx148 rotate 1E-999 8 -> 1.00000000E-991
  94. rotx151 rotate 1.00000000E-999 -1 -> 1.0000000E-1000
  95. rotx152 rotate 1.00000000E-999 -8 -> 1E-1007
  96. rotx153 rotate 1.00000000E-999 1 -> 1E-1007
  97. rotx154 rotate 1.00000000E-999 8 -> 1.0000000E-1000
  98. rotx155 rotate 9.00000000E-999 -1 -> 9.0000000E-1000
  99. rotx156 rotate 9.00000000E-999 -8 -> 9E-1007
  100. rotx157 rotate 9.00000000E-999 1 -> 9E-1007
  101. rotx158 rotate 9.00000000E-999 8 -> 9.0000000E-1000
  102. rotx160 rotate 1E-1007 -1 -> 1.00000000E-999
  103. rotx161 rotate 1E-1007 -8 -> 1.0E-1006
  104. rotx162 rotate 1E-1007 1 -> 1.0E-1006
  105. rotx163 rotate 1E-1007 8 -> 1.00000000E-999
  106. -- negatives
  107. rotx171 rotate -9.99999999E+999 -1 -> -9.99999999E+999
  108. rotx172 rotate -9.99999999E+999 -8 -> -9.99999999E+999
  109. rotx173 rotate -9.99999999E+999 1 -> -9.99999999E+999
  110. rotx174 rotate -9.99999999E+999 8 -> -9.99999999E+999
  111. rotx175 rotate -1E-999 -1 -> -1.00000000E-991
  112. rotx176 rotate -1E-999 -8 -> -1.0E-998
  113. rotx177 rotate -1E-999 1 -> -1.0E-998
  114. rotx178 rotate -1E-999 8 -> -1.00000000E-991
  115. rotx181 rotate -1.00000000E-999 -1 -> -1.0000000E-1000
  116. rotx182 rotate -1.00000000E-999 -8 -> -1E-1007
  117. rotx183 rotate -1.00000000E-999 1 -> -1E-1007
  118. rotx184 rotate -1.00000000E-999 8 -> -1.0000000E-1000
  119. rotx185 rotate -9.00000000E-999 -1 -> -9.0000000E-1000
  120. rotx186 rotate -9.00000000E-999 -8 -> -9E-1007
  121. rotx187 rotate -9.00000000E-999 1 -> -9E-1007
  122. rotx188 rotate -9.00000000E-999 8 -> -9.0000000E-1000
  123. rotx190 rotate -1E-1007 -1 -> -1.00000000E-999
  124. rotx191 rotate -1E-1007 -8 -> -1.0E-1006
  125. rotx192 rotate -1E-1007 1 -> -1.0E-1006
  126. rotx193 rotate -1E-1007 8 -> -1.00000000E-999
  127. -- more negatives (of sanities)
  128. rotx201 rotate -0 0 -> -0
  129. rotx202 rotate -0 2 -> -0
  130. rotx203 rotate -1 2 -> -100
  131. rotx204 rotate -1 8 -> -100000000
  132. rotx205 rotate -1 9 -> -1
  133. rotx206 rotate -1 -1 -> -100000000
  134. rotx207 rotate -123456789 -1 -> -912345678
  135. rotx208 rotate -123456789 -8 -> -234567891
  136. rotx209 rotate -123456789 -9 -> -123456789
  137. rotx210 rotate -0 -2 -> -0
  138. -- Specials; NaNs are handled as usual
  139. rotx781 rotate -Inf -8 -> -Infinity
  140. rotx782 rotate -Inf -1 -> -Infinity
  141. rotx783 rotate -Inf -0 -> -Infinity
  142. rotx784 rotate -Inf 0 -> -Infinity
  143. rotx785 rotate -Inf 1 -> -Infinity
  144. rotx786 rotate -Inf 8 -> -Infinity
  145. rotx787 rotate -1000 -Inf -> NaN Invalid_operation
  146. rotx788 rotate -Inf -Inf -> NaN Invalid_operation
  147. rotx789 rotate -1 -Inf -> NaN Invalid_operation
  148. rotx790 rotate -0 -Inf -> NaN Invalid_operation
  149. rotx791 rotate 0 -Inf -> NaN Invalid_operation
  150. rotx792 rotate 1 -Inf -> NaN Invalid_operation
  151. rotx793 rotate 1000 -Inf -> NaN Invalid_operation
  152. rotx794 rotate Inf -Inf -> NaN Invalid_operation
  153. rotx800 rotate Inf -Inf -> NaN Invalid_operation
  154. rotx801 rotate Inf -8 -> Infinity
  155. rotx802 rotate Inf -1 -> Infinity
  156. rotx803 rotate Inf -0 -> Infinity
  157. rotx804 rotate Inf 0 -> Infinity
  158. rotx805 rotate Inf 1 -> Infinity
  159. rotx806 rotate Inf 8 -> Infinity
  160. rotx807 rotate Inf Inf -> NaN Invalid_operation
  161. rotx808 rotate -1000 Inf -> NaN Invalid_operation
  162. rotx809 rotate -Inf Inf -> NaN Invalid_operation
  163. rotx810 rotate -1 Inf -> NaN Invalid_operation
  164. rotx811 rotate -0 Inf -> NaN Invalid_operation
  165. rotx812 rotate 0 Inf -> NaN Invalid_operation
  166. rotx813 rotate 1 Inf -> NaN Invalid_operation
  167. rotx814 rotate 1000 Inf -> NaN Invalid_operation
  168. rotx815 rotate Inf Inf -> NaN Invalid_operation
  169. rotx821 rotate NaN -Inf -> NaN
  170. rotx822 rotate NaN -1000 -> NaN
  171. rotx823 rotate NaN -1 -> NaN
  172. rotx824 rotate NaN -0 -> NaN
  173. rotx825 rotate NaN 0 -> NaN
  174. rotx826 rotate NaN 1 -> NaN
  175. rotx827 rotate NaN 1000 -> NaN
  176. rotx828 rotate NaN Inf -> NaN
  177. rotx829 rotate NaN NaN -> NaN
  178. rotx830 rotate -Inf NaN -> NaN
  179. rotx831 rotate -1000 NaN -> NaN
  180. rotx832 rotate -1 NaN -> NaN
  181. rotx833 rotate -0 NaN -> NaN
  182. rotx834 rotate 0 NaN -> NaN
  183. rotx835 rotate 1 NaN -> NaN
  184. rotx836 rotate 1000 NaN -> NaN
  185. rotx837 rotate Inf NaN -> NaN
  186. rotx841 rotate sNaN -Inf -> NaN Invalid_operation
  187. rotx842 rotate sNaN -1000 -> NaN Invalid_operation
  188. rotx843 rotate sNaN -1 -> NaN Invalid_operation
  189. rotx844 rotate sNaN -0 -> NaN Invalid_operation
  190. rotx845 rotate sNaN 0 -> NaN Invalid_operation
  191. rotx846 rotate sNaN 1 -> NaN Invalid_operation
  192. rotx847 rotate sNaN 1000 -> NaN Invalid_operation
  193. rotx848 rotate sNaN NaN -> NaN Invalid_operation
  194. rotx849 rotate sNaN sNaN -> NaN Invalid_operation
  195. rotx850 rotate NaN sNaN -> NaN Invalid_operation
  196. rotx851 rotate -Inf sNaN -> NaN Invalid_operation
  197. rotx852 rotate -1000 sNaN -> NaN Invalid_operation
  198. rotx853 rotate -1 sNaN -> NaN Invalid_operation
  199. rotx854 rotate -0 sNaN -> NaN Invalid_operation
  200. rotx855 rotate 0 sNaN -> NaN Invalid_operation
  201. rotx856 rotate 1 sNaN -> NaN Invalid_operation
  202. rotx857 rotate 1000 sNaN -> NaN Invalid_operation
  203. rotx858 rotate Inf sNaN -> NaN Invalid_operation
  204. rotx859 rotate NaN sNaN -> NaN Invalid_operation
  205. -- propagating NaNs
  206. rotx861 rotate NaN1 -Inf -> NaN1
  207. rotx862 rotate +NaN2 -1000 -> NaN2
  208. rotx863 rotate NaN3 1000 -> NaN3
  209. rotx864 rotate NaN4 Inf -> NaN4
  210. rotx865 rotate NaN5 +NaN6 -> NaN5
  211. rotx866 rotate -Inf NaN7 -> NaN7
  212. rotx867 rotate -1000 NaN8 -> NaN8
  213. rotx868 rotate 1000 NaN9 -> NaN9
  214. rotx869 rotate Inf +NaN10 -> NaN10
  215. rotx871 rotate sNaN11 -Inf -> NaN11 Invalid_operation
  216. rotx872 rotate sNaN12 -1000 -> NaN12 Invalid_operation
  217. rotx873 rotate sNaN13 1000 -> NaN13 Invalid_operation
  218. rotx874 rotate sNaN14 NaN17 -> NaN14 Invalid_operation
  219. rotx875 rotate sNaN15 sNaN18 -> NaN15 Invalid_operation
  220. rotx876 rotate NaN16 sNaN19 -> NaN19 Invalid_operation
  221. rotx877 rotate -Inf +sNaN20 -> NaN20 Invalid_operation
  222. rotx878 rotate -1000 sNaN21 -> NaN21 Invalid_operation
  223. rotx879 rotate 1000 sNaN22 -> NaN22 Invalid_operation
  224. rotx880 rotate Inf sNaN23 -> NaN23 Invalid_operation
  225. rotx881 rotate +NaN25 +sNaN24 -> NaN24 Invalid_operation
  226. rotx882 rotate -NaN26 NaN28 -> -NaN26
  227. rotx883 rotate -sNaN27 sNaN29 -> -NaN27 Invalid_operation
  228. rotx884 rotate 1000 -NaN30 -> -NaN30
  229. rotx885 rotate 1000 -sNaN31 -> -NaN31 Invalid_operation
  230. -- payload decapitate
  231. precision: 5
  232. rotx886 rotate 11 -sNaN1234567890 -> -NaN67890 Invalid_operation