scaleb.decTest 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. ------------------------------------------------------------------------
  2. -- scaleb.decTest -- scale a number 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. extended: 1
  22. precision: 9
  23. rounding: half_up
  24. maxExponent: 999
  25. minExponent: -999
  26. -- Max |rhs| is 2*(999+9) = 2016
  27. -- Sanity checks
  28. scbx001 scaleb 7.50 10 -> 7.50E+10
  29. scbx002 scaleb 7.50 3 -> 7.50E+3
  30. scbx003 scaleb 7.50 2 -> 750
  31. scbx004 scaleb 7.50 1 -> 75.0
  32. scbx005 scaleb 7.50 0 -> 7.50
  33. scbx006 scaleb 7.50 -1 -> 0.750
  34. scbx007 scaleb 7.50 -2 -> 0.0750
  35. scbx008 scaleb 7.50 -10 -> 7.50E-10
  36. scbx009 scaleb -7.50 3 -> -7.50E+3
  37. scbx010 scaleb -7.50 2 -> -750
  38. scbx011 scaleb -7.50 1 -> -75.0
  39. scbx012 scaleb -7.50 0 -> -7.50
  40. scbx013 scaleb -7.50 -1 -> -0.750
  41. -- Infinities
  42. scbx014 scaleb Infinity 1 -> Infinity
  43. scbx015 scaleb -Infinity 2 -> -Infinity
  44. scbx016 scaleb Infinity -1 -> Infinity
  45. scbx017 scaleb -Infinity -2 -> -Infinity
  46. -- Next two are somewhat undefined in 754r; treat as non-integer
  47. scbx018 scaleb 10 Infinity -> NaN Invalid_operation
  48. scbx019 scaleb 10 -Infinity -> NaN Invalid_operation
  49. -- NaNs are undefined in 754r; assume usual processing
  50. -- NaNs, 0 payload
  51. scbx021 scaleb NaN 1 -> NaN
  52. scbx022 scaleb -NaN -1 -> -NaN
  53. scbx023 scaleb sNaN 1 -> NaN Invalid_operation
  54. scbx024 scaleb -sNaN 1 -> -NaN Invalid_operation
  55. scbx025 scaleb 4 NaN -> NaN
  56. scbx026 scaleb -Inf -NaN -> -NaN
  57. scbx027 scaleb 4 sNaN -> NaN Invalid_operation
  58. scbx028 scaleb Inf -sNaN -> -NaN Invalid_operation
  59. -- non-integer RHS
  60. scbx030 scaleb 1.23 1 -> 12.3
  61. scbx031 scaleb 1.23 1.00 -> NaN Invalid_operation
  62. scbx032 scaleb 1.23 1.1 -> NaN Invalid_operation
  63. scbx033 scaleb 1.23 1.01 -> NaN Invalid_operation
  64. scbx034 scaleb 1.23 0.01 -> NaN Invalid_operation
  65. scbx035 scaleb 1.23 0.11 -> NaN Invalid_operation
  66. scbx036 scaleb 1.23 0.999999999 -> NaN Invalid_operation
  67. scbx037 scaleb 1.23 -1 -> 0.123
  68. scbx038 scaleb 1.23 -1.00 -> NaN Invalid_operation
  69. scbx039 scaleb 1.23 -1.1 -> NaN Invalid_operation
  70. scbx040 scaleb 1.23 -1.01 -> NaN Invalid_operation
  71. scbx041 scaleb 1.23 -0.01 -> NaN Invalid_operation
  72. scbx042 scaleb 1.23 -0.11 -> NaN Invalid_operation
  73. scbx043 scaleb 1.23 -0.999999999 -> NaN Invalid_operation
  74. scbx044 scaleb 1.23 0.1 -> NaN Invalid_operation
  75. scbx045 scaleb 1.23 1E+1 -> NaN Invalid_operation
  76. scbx046 scaleb 1.23 1.1234E+6 -> NaN Invalid_operation
  77. scbx047 scaleb 1.23 1.123E+4 -> NaN Invalid_operation
  78. scbx120 scaleb 1.23 2015 -> Infinity Overflow Inexact Rounded
  79. scbx121 scaleb 1.23 2016 -> Infinity Overflow Inexact Rounded
  80. scbx122 scaleb 1.23 2017 -> NaN Invalid_operation
  81. scbx123 scaleb 1.23 2018 -> NaN Invalid_operation
  82. scbx124 scaleb 1.23 -2015 -> 0E-1007 Underflow Subnormal Inexact Rounded Clamped
  83. scbx125 scaleb 1.23 -2016 -> 0E-1007 Underflow Subnormal Inexact Rounded Clamped
  84. scbx126 scaleb 1.23 -2017 -> NaN Invalid_operation
  85. scbx127 scaleb 1.23 -2018 -> NaN Invalid_operation
  86. -- NaNs, non-0 payload
  87. -- propagating NaNs
  88. scbx861 scaleb NaN01 -Inf -> NaN1
  89. scbx862 scaleb -NaN02 -1000 -> -NaN2
  90. scbx863 scaleb NaN03 1000 -> NaN3
  91. scbx864 scaleb NaN04 Inf -> NaN4
  92. scbx865 scaleb NaN05 NaN61 -> NaN5
  93. scbx866 scaleb -Inf -NaN71 -> -NaN71
  94. scbx867 scaleb -1000 NaN81 -> NaN81
  95. scbx868 scaleb 1000 NaN91 -> NaN91
  96. scbx869 scaleb Inf NaN101 -> NaN101
  97. scbx871 scaleb sNaN011 -Inf -> NaN11 Invalid_operation
  98. scbx872 scaleb sNaN012 -1000 -> NaN12 Invalid_operation
  99. scbx873 scaleb -sNaN013 1000 -> -NaN13 Invalid_operation
  100. scbx874 scaleb sNaN014 NaN171 -> NaN14 Invalid_operation
  101. scbx875 scaleb sNaN015 sNaN181 -> NaN15 Invalid_operation
  102. scbx876 scaleb NaN016 sNaN191 -> NaN191 Invalid_operation
  103. scbx877 scaleb -Inf sNaN201 -> NaN201 Invalid_operation
  104. scbx878 scaleb -1000 sNaN211 -> NaN211 Invalid_operation
  105. scbx879 scaleb 1000 -sNaN221 -> -NaN221 Invalid_operation
  106. scbx880 scaleb Inf sNaN231 -> NaN231 Invalid_operation
  107. scbx881 scaleb NaN025 sNaN241 -> NaN241 Invalid_operation
  108. -- finites
  109. scbx051 scaleb 7 -2 -> 0.07
  110. scbx052 scaleb -7 -2 -> -0.07
  111. scbx053 scaleb 75 -2 -> 0.75
  112. scbx054 scaleb -75 -2 -> -0.75
  113. scbx055 scaleb 7.50 -2 -> 0.0750
  114. scbx056 scaleb -7.50 -2 -> -0.0750
  115. scbx057 scaleb 7.500 -2 -> 0.07500
  116. scbx058 scaleb -7.500 -2 -> -0.07500
  117. scbx061 scaleb 7 -1 -> 0.7
  118. scbx062 scaleb -7 -1 -> -0.7
  119. scbx063 scaleb 75 -1 -> 7.5
  120. scbx064 scaleb -75 -1 -> -7.5
  121. scbx065 scaleb 7.50 -1 -> 0.750
  122. scbx066 scaleb -7.50 -1 -> -0.750
  123. scbx067 scaleb 7.500 -1 -> 0.7500
  124. scbx068 scaleb -7.500 -1 -> -0.7500
  125. scbx071 scaleb 7 0 -> 7
  126. scbx072 scaleb -7 0 -> -7
  127. scbx073 scaleb 75 0 -> 75
  128. scbx074 scaleb -75 0 -> -75
  129. scbx075 scaleb 7.50 0 -> 7.50
  130. scbx076 scaleb -7.50 0 -> -7.50
  131. scbx077 scaleb 7.500 0 -> 7.500
  132. scbx078 scaleb -7.500 0 -> -7.500
  133. scbx081 scaleb 7 1 -> 7E+1
  134. scbx082 scaleb -7 1 -> -7E+1
  135. scbx083 scaleb 75 1 -> 7.5E+2
  136. scbx084 scaleb -75 1 -> -7.5E+2
  137. scbx085 scaleb 7.50 1 -> 75.0
  138. scbx086 scaleb -7.50 1 -> -75.0
  139. scbx087 scaleb 7.500 1 -> 75.00
  140. scbx088 scaleb -7.500 1 -> -75.00
  141. scbx091 scaleb 7 2 -> 7E+2
  142. scbx092 scaleb -7 2 -> -7E+2
  143. scbx093 scaleb 75 2 -> 7.5E+3
  144. scbx094 scaleb -75 2 -> -7.5E+3
  145. scbx095 scaleb 7.50 2 -> 750
  146. scbx096 scaleb -7.50 2 -> -750
  147. scbx097 scaleb 7.500 2 -> 750.0
  148. scbx098 scaleb -7.500 2 -> -750.0
  149. -- zeros
  150. scbx111 scaleb 0 1 -> 0E+1
  151. scbx112 scaleb -0 2 -> -0E+2
  152. scbx113 scaleb 0E+4 3 -> 0E+7
  153. scbx114 scaleb -0E+4 4 -> -0E+8
  154. scbx115 scaleb 0.0000 5 -> 0E+1
  155. scbx116 scaleb -0.0000 6 -> -0E+2
  156. scbx117 scaleb 0E-141 7 -> 0E-134
  157. scbx118 scaleb -0E-141 8 -> -0E-133
  158. -- Nmax, Nmin, Ntiny
  159. scbx132 scaleb 9.99999999E+999 +999 -> Infinity Overflow Inexact Rounded
  160. scbx133 scaleb 9.99999999E+999 +10 -> Infinity Overflow Inexact Rounded
  161. scbx134 scaleb 9.99999999E+999 +1 -> Infinity Overflow Inexact Rounded
  162. scbx135 scaleb 9.99999999E+999 0 -> 9.99999999E+999
  163. scbx136 scaleb 9.99999999E+999 -1 -> 9.99999999E+998
  164. scbx137 scaleb 1E-999 +1 -> 1E-998
  165. scbx138 scaleb 1E-999 -0 -> 1E-999
  166. scbx139 scaleb 1E-999 -1 -> 1E-1000 Subnormal
  167. scbx140 scaleb 1.00000000E-999 +1 -> 1.00000000E-998
  168. scbx141 scaleb 1.00000000E-999 0 -> 1.00000000E-999
  169. scbx142 scaleb 1.00000000E-999 -1 -> 1.0000000E-1000 Subnormal Rounded
  170. scbx143 scaleb 1E-1007 +1 -> 1E-1006 Subnormal
  171. scbx144 scaleb 1E-1007 -0 -> 1E-1007 Subnormal
  172. scbx145 scaleb 1E-1007 -1 -> 0E-1007 Underflow Subnormal Inexact Rounded Clamped
  173. scbx150 scaleb -1E-1007 +1 -> -1E-1006 Subnormal
  174. scbx151 scaleb -1E-1007 -0 -> -1E-1007 Subnormal
  175. scbx152 scaleb -1E-1007 -1 -> -0E-1007 Underflow Subnormal Inexact Rounded Clamped
  176. scbx153 scaleb -1.00000000E-999 +1 -> -1.00000000E-998
  177. scbx154 scaleb -1.00000000E-999 +0 -> -1.00000000E-999
  178. scbx155 scaleb -1.00000000E-999 -1 -> -1.0000000E-1000 Subnormal Rounded
  179. scbx156 scaleb -1E-999 +1 -> -1E-998
  180. scbx157 scaleb -1E-999 -0 -> -1E-999
  181. scbx158 scaleb -1E-999 -1 -> -1E-1000 Subnormal
  182. scbx159 scaleb -9.99999999E+999 +1 -> -Infinity Overflow Inexact Rounded
  183. scbx160 scaleb -9.99999999E+999 +0 -> -9.99999999E+999
  184. scbx161 scaleb -9.99999999E+999 -1 -> -9.99999999E+998
  185. scbx162 scaleb -9E+999 +1 -> -Infinity Overflow Inexact Rounded
  186. scbx163 scaleb -1E+999 +1 -> -Infinity Overflow Inexact Rounded
  187. -- Krah examples
  188. precision: 34
  189. maxExponent: 999999999
  190. minExponent: -999999999
  191. -- integer overflow in 3.61 or earlier
  192. scbx164 scaleb 1E-999999999 -1200000000 -> NaN Invalid_operation
  193. -- out of range
  194. scbx165 scaleb -1E-999999999 +1200000000 -> NaN Invalid_operation