ddScaleB.decTest 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. ------------------------------------------------------------------------
  2. -- ddScalebB.decTest -- scale a decDouble by powers of 10 --
  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. -- Max |rhs| is 2*(384+16) = 800
  28. -- Sanity checks
  29. ddscb001 scaleb 7.50 10 -> 7.50E+10
  30. ddscb002 scaleb 7.50 3 -> 7.50E+3
  31. ddscb003 scaleb 7.50 2 -> 750
  32. ddscb004 scaleb 7.50 1 -> 75.0
  33. ddscb005 scaleb 7.50 0 -> 7.50
  34. ddscb006 scaleb 7.50 -1 -> 0.750
  35. ddscb007 scaleb 7.50 -2 -> 0.0750
  36. ddscb008 scaleb 7.50 -10 -> 7.50E-10
  37. ddscb009 scaleb -7.50 3 -> -7.50E+3
  38. ddscb010 scaleb -7.50 2 -> -750
  39. ddscb011 scaleb -7.50 1 -> -75.0
  40. ddscb012 scaleb -7.50 0 -> -7.50
  41. ddscb013 scaleb -7.50 -1 -> -0.750
  42. -- Infinities
  43. ddscb014 scaleb Infinity 1 -> Infinity
  44. ddscb015 scaleb -Infinity 2 -> -Infinity
  45. ddscb016 scaleb Infinity -1 -> Infinity
  46. ddscb017 scaleb -Infinity -2 -> -Infinity
  47. -- Next two are somewhat undefined in 754r; treat as non-integer
  48. ddscb018 scaleb 10 Infinity -> NaN Invalid_operation
  49. ddscb019 scaleb 10 -Infinity -> NaN Invalid_operation
  50. -- NaNs are undefined in 754r; assume usual processing
  51. -- NaNs, 0 payload
  52. ddscb021 scaleb NaN 1 -> NaN
  53. ddscb022 scaleb -NaN -1 -> -NaN
  54. ddscb023 scaleb sNaN 1 -> NaN Invalid_operation
  55. ddscb024 scaleb -sNaN 1 -> -NaN Invalid_operation
  56. ddscb025 scaleb 4 NaN -> NaN
  57. ddscb026 scaleb -Inf -NaN -> -NaN
  58. ddscb027 scaleb 4 sNaN -> NaN Invalid_operation
  59. ddscb028 scaleb Inf -sNaN -> -NaN Invalid_operation
  60. -- non-integer RHS
  61. ddscb030 scaleb 1.23 1 -> 12.3
  62. ddscb031 scaleb 1.23 1.00 -> NaN Invalid_operation
  63. ddscb032 scaleb 1.23 1.1 -> NaN Invalid_operation
  64. ddscb033 scaleb 1.23 1.01 -> NaN Invalid_operation
  65. ddscb034 scaleb 1.23 0.01 -> NaN Invalid_operation
  66. ddscb035 scaleb 1.23 0.11 -> NaN Invalid_operation
  67. ddscb036 scaleb 1.23 0.999999999 -> NaN Invalid_operation
  68. ddscb037 scaleb 1.23 -1 -> 0.123
  69. ddscb038 scaleb 1.23 -1.00 -> NaN Invalid_operation
  70. ddscb039 scaleb 1.23 -1.1 -> NaN Invalid_operation
  71. ddscb040 scaleb 1.23 -1.01 -> NaN Invalid_operation
  72. ddscb041 scaleb 1.23 -0.01 -> NaN Invalid_operation
  73. ddscb042 scaleb 1.23 -0.11 -> NaN Invalid_operation
  74. ddscb043 scaleb 1.23 -0.999999999 -> NaN Invalid_operation
  75. ddscb044 scaleb 1.23 0.1 -> NaN Invalid_operation
  76. ddscb045 scaleb 1.23 1E+1 -> NaN Invalid_operation
  77. ddscb046 scaleb 1.23 1.1234E+6 -> NaN Invalid_operation
  78. ddscb047 scaleb 1.23 1.123E+4 -> NaN Invalid_operation
  79. -- out-of range RHS
  80. ddscb120 scaleb 1.23 799 -> Infinity Overflow Inexact Rounded
  81. ddscb121 scaleb 1.23 800 -> Infinity Overflow Inexact Rounded
  82. ddscb122 scaleb 1.23 801 -> NaN Invalid_operation
  83. ddscb123 scaleb 1.23 802 -> NaN Invalid_operation
  84. ddscb124 scaleb 1.23 -799 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
  85. ddscb125 scaleb 1.23 -800 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
  86. ddscb126 scaleb 1.23 -801 -> NaN Invalid_operation
  87. ddscb127 scaleb 1.23 -802 -> NaN Invalid_operation
  88. -- NaNs, non-0 payload
  89. -- propagating NaNs
  90. ddscb861 scaleb NaN01 -Inf -> NaN1
  91. ddscb862 scaleb -NaN02 -1000 -> -NaN2
  92. ddscb863 scaleb NaN03 1000 -> NaN3
  93. ddscb864 scaleb NaN04 Inf -> NaN4
  94. ddscb865 scaleb NaN05 NaN61 -> NaN5
  95. ddscb866 scaleb -Inf -NaN71 -> -NaN71
  96. ddscb867 scaleb -1000 NaN81 -> NaN81
  97. ddscb868 scaleb 1000 NaN91 -> NaN91
  98. ddscb869 scaleb Inf NaN101 -> NaN101
  99. ddscb871 scaleb sNaN011 -Inf -> NaN11 Invalid_operation
  100. ddscb872 scaleb sNaN012 -1000 -> NaN12 Invalid_operation
  101. ddscb873 scaleb -sNaN013 1000 -> -NaN13 Invalid_operation
  102. ddscb874 scaleb sNaN014 NaN171 -> NaN14 Invalid_operation
  103. ddscb875 scaleb sNaN015 sNaN181 -> NaN15 Invalid_operation
  104. ddscb876 scaleb NaN016 sNaN191 -> NaN191 Invalid_operation
  105. ddscb877 scaleb -Inf sNaN201 -> NaN201 Invalid_operation
  106. ddscb878 scaleb -1000 sNaN211 -> NaN211 Invalid_operation
  107. ddscb879 scaleb 1000 -sNaN221 -> -NaN221 Invalid_operation
  108. ddscb880 scaleb Inf sNaN231 -> NaN231 Invalid_operation
  109. ddscb881 scaleb NaN025 sNaN241 -> NaN241 Invalid_operation
  110. -- finites
  111. ddscb051 scaleb 7 -2 -> 0.07
  112. ddscb052 scaleb -7 -2 -> -0.07
  113. ddscb053 scaleb 75 -2 -> 0.75
  114. ddscb054 scaleb -75 -2 -> -0.75
  115. ddscb055 scaleb 7.50 -2 -> 0.0750
  116. ddscb056 scaleb -7.50 -2 -> -0.0750
  117. ddscb057 scaleb 7.500 -2 -> 0.07500
  118. ddscb058 scaleb -7.500 -2 -> -0.07500
  119. ddscb061 scaleb 7 -1 -> 0.7
  120. ddscb062 scaleb -7 -1 -> -0.7
  121. ddscb063 scaleb 75 -1 -> 7.5
  122. ddscb064 scaleb -75 -1 -> -7.5
  123. ddscb065 scaleb 7.50 -1 -> 0.750
  124. ddscb066 scaleb -7.50 -1 -> -0.750
  125. ddscb067 scaleb 7.500 -1 -> 0.7500
  126. ddscb068 scaleb -7.500 -1 -> -0.7500
  127. ddscb071 scaleb 7 0 -> 7
  128. ddscb072 scaleb -7 0 -> -7
  129. ddscb073 scaleb 75 0 -> 75
  130. ddscb074 scaleb -75 0 -> -75
  131. ddscb075 scaleb 7.50 0 -> 7.50
  132. ddscb076 scaleb -7.50 0 -> -7.50
  133. ddscb077 scaleb 7.500 0 -> 7.500
  134. ddscb078 scaleb -7.500 0 -> -7.500
  135. ddscb081 scaleb 7 1 -> 7E+1
  136. ddscb082 scaleb -7 1 -> -7E+1
  137. ddscb083 scaleb 75 1 -> 7.5E+2
  138. ddscb084 scaleb -75 1 -> -7.5E+2
  139. ddscb085 scaleb 7.50 1 -> 75.0
  140. ddscb086 scaleb -7.50 1 -> -75.0
  141. ddscb087 scaleb 7.500 1 -> 75.00
  142. ddscb088 scaleb -7.500 1 -> -75.00
  143. ddscb091 scaleb 7 2 -> 7E+2
  144. ddscb092 scaleb -7 2 -> -7E+2
  145. ddscb093 scaleb 75 2 -> 7.5E+3
  146. ddscb094 scaleb -75 2 -> -7.5E+3
  147. ddscb095 scaleb 7.50 2 -> 750
  148. ddscb096 scaleb -7.50 2 -> -750
  149. ddscb097 scaleb 7.500 2 -> 750.0
  150. ddscb098 scaleb -7.500 2 -> -750.0
  151. -- zeros
  152. ddscb111 scaleb 0 1 -> 0E+1
  153. ddscb112 scaleb -0 2 -> -0E+2
  154. ddscb113 scaleb 0E+4 3 -> 0E+7
  155. ddscb114 scaleb -0E+4 4 -> -0E+8
  156. ddscb115 scaleb 0.0000 5 -> 0E+1
  157. ddscb116 scaleb -0.0000 6 -> -0E+2
  158. ddscb117 scaleb 0E-141 7 -> 0E-134
  159. ddscb118 scaleb -0E-141 8 -> -0E-133
  160. -- Nmax, Nmin, Ntiny
  161. ddscb132 scaleb 9.999999999999999E+384 +384 -> Infinity Overflow Inexact Rounded
  162. ddscb133 scaleb 9.999999999999999E+384 +10 -> Infinity Overflow Inexact Rounded
  163. ddscb134 scaleb 9.999999999999999E+384 +1 -> Infinity Overflow Inexact Rounded
  164. ddscb135 scaleb 9.999999999999999E+384 0 -> 9.999999999999999E+384
  165. ddscb136 scaleb 9.999999999999999E+384 -1 -> 9.999999999999999E+383
  166. ddscb137 scaleb 1E-383 +1 -> 1E-382
  167. ddscb138 scaleb 1E-383 -0 -> 1E-383
  168. ddscb139 scaleb 1E-383 -1 -> 1E-384 Subnormal
  169. ddscb140 scaleb 1.000000000000000E-383 +1 -> 1.000000000000000E-382
  170. ddscb141 scaleb 1.000000000000000E-383 0 -> 1.000000000000000E-383
  171. ddscb142 scaleb 1.000000000000000E-383 -1 -> 1.00000000000000E-384 Subnormal Rounded
  172. ddscb143 scaleb 1E-398 +1 -> 1E-397 Subnormal
  173. ddscb144 scaleb 1E-398 -0 -> 1E-398 Subnormal
  174. ddscb145 scaleb 1E-398 -1 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
  175. ddscb150 scaleb -1E-398 +1 -> -1E-397 Subnormal
  176. ddscb151 scaleb -1E-398 -0 -> -1E-398 Subnormal
  177. ddscb152 scaleb -1E-398 -1 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped
  178. ddscb153 scaleb -1.000000000000000E-383 +1 -> -1.000000000000000E-382
  179. ddscb154 scaleb -1.000000000000000E-383 +0 -> -1.000000000000000E-383
  180. ddscb155 scaleb -1.000000000000000E-383 -1 -> -1.00000000000000E-384 Subnormal Rounded
  181. ddscb156 scaleb -1E-383 +1 -> -1E-382
  182. ddscb157 scaleb -1E-383 -0 -> -1E-383
  183. ddscb158 scaleb -1E-383 -1 -> -1E-384 Subnormal
  184. ddscb159 scaleb -9.999999999999999E+384 +1 -> -Infinity Overflow Inexact Rounded
  185. ddscb160 scaleb -9.999999999999999E+384 +0 -> -9.999999999999999E+384
  186. ddscb161 scaleb -9.999999999999999E+384 -1 -> -9.999999999999999E+383
  187. ddscb162 scaleb -9E+384 +1 -> -Infinity Overflow Inexact Rounded
  188. ddscb163 scaleb -1E+384 +1 -> -Infinity Overflow Inexact Rounded
  189. -- some Origami
  190. -- (these check that overflow is being done correctly)
  191. ddscb171 scaleb 1000E+365 +1 -> 1.000E+369
  192. ddscb172 scaleb 1000E+366 +1 -> 1.000E+370
  193. ddscb173 scaleb 1000E+367 +1 -> 1.000E+371
  194. ddscb174 scaleb 1000E+368 +1 -> 1.000E+372
  195. ddscb175 scaleb 1000E+369 +1 -> 1.0000E+373 Clamped
  196. ddscb176 scaleb 1000E+370 +1 -> 1.00000E+374 Clamped
  197. ddscb177 scaleb 1000E+371 +1 -> 1.000000E+375 Clamped
  198. ddscb178 scaleb 1000E+372 +1 -> 1.0000000E+376 Clamped
  199. ddscb179 scaleb 1000E+373 +1 -> 1.00000000E+377 Clamped
  200. ddscb180 scaleb 1000E+374 +1 -> 1.000000000E+378 Clamped
  201. ddscb181 scaleb 1000E+375 +1 -> 1.0000000000E+379 Clamped
  202. ddscb182 scaleb 1000E+376 +1 -> 1.00000000000E+380 Clamped
  203. ddscb183 scaleb 1000E+377 +1 -> 1.000000000000E+381 Clamped
  204. ddscb184 scaleb 1000E+378 +1 -> 1.0000000000000E+382 Clamped
  205. ddscb185 scaleb 1000E+379 +1 -> 1.00000000000000E+383 Clamped
  206. ddscb186 scaleb 1000E+380 +1 -> 1.000000000000000E+384 Clamped
  207. ddscb187 scaleb 1000E+381 +1 -> Infinity Overflow Inexact Rounded
  208. -- and a few more subnormal truncations
  209. -- (these check that underflow is being done correctly)
  210. ddscb201 scaleb 1.000000000000000E-383 0 -> 1.000000000000000E-383
  211. ddscb202 scaleb 1.000000000000000E-383 -1 -> 1.00000000000000E-384 Subnormal Rounded
  212. ddscb203 scaleb 1.000000000000000E-383 -2 -> 1.0000000000000E-385 Subnormal Rounded
  213. ddscb204 scaleb 1.000000000000000E-383 -3 -> 1.000000000000E-386 Subnormal Rounded
  214. ddscb205 scaleb 1.000000000000000E-383 -4 -> 1.00000000000E-387 Subnormal Rounded
  215. ddscb206 scaleb 1.000000000000000E-383 -5 -> 1.0000000000E-388 Subnormal Rounded
  216. ddscb207 scaleb 1.000000000000000E-383 -6 -> 1.000000000E-389 Subnormal Rounded
  217. ddscb208 scaleb 1.000000000000000E-383 -7 -> 1.00000000E-390 Subnormal Rounded
  218. ddscb209 scaleb 1.000000000000000E-383 -8 -> 1.0000000E-391 Subnormal Rounded
  219. ddscb210 scaleb 1.000000000000000E-383 -9 -> 1.000000E-392 Subnormal Rounded
  220. ddscb211 scaleb 1.000000000000000E-383 -10 -> 1.00000E-393 Subnormal Rounded
  221. ddscb212 scaleb 1.000000000000000E-383 -11 -> 1.0000E-394 Subnormal Rounded
  222. ddscb213 scaleb 1.000000000000000E-383 -12 -> 1.000E-395 Subnormal Rounded
  223. ddscb214 scaleb 1.000000000000000E-383 -13 -> 1.00E-396 Subnormal Rounded
  224. ddscb215 scaleb 1.000000000000000E-383 -14 -> 1.0E-397 Subnormal Rounded
  225. ddscb216 scaleb 1.000000000000000E-383 -15 -> 1E-398 Subnormal Rounded
  226. ddscb217 scaleb 1.000000000000000E-383 -16 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
  227. ddscb218 scaleb 1.000000000000000E-383 -17 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped