ddMin.decTest 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. ------------------------------------------------------------------------
  2. -- ddMin.decTest -- decDouble minnum --
  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. -- we assume that base comparison is tested in compare.decTest, so
  22. -- these mainly cover special cases and rounding
  23. precision: 16
  24. maxExponent: 384
  25. minExponent: -383
  26. extended: 1
  27. clamp: 1
  28. rounding: half_even
  29. -- sanity checks
  30. ddmin001 min -2 -2 -> -2
  31. ddmin002 min -2 -1 -> -2
  32. ddmin003 min -2 0 -> -2
  33. ddmin004 min -2 1 -> -2
  34. ddmin005 min -2 2 -> -2
  35. ddmin006 min -1 -2 -> -2
  36. ddmin007 min -1 -1 -> -1
  37. ddmin008 min -1 0 -> -1
  38. ddmin009 min -1 1 -> -1
  39. ddmin010 min -1 2 -> -1
  40. ddmin011 min 0 -2 -> -2
  41. ddmin012 min 0 -1 -> -1
  42. ddmin013 min 0 0 -> 0
  43. ddmin014 min 0 1 -> 0
  44. ddmin015 min 0 2 -> 0
  45. ddmin016 min 1 -2 -> -2
  46. ddmin017 min 1 -1 -> -1
  47. ddmin018 min 1 0 -> 0
  48. ddmin019 min 1 1 -> 1
  49. ddmin020 min 1 2 -> 1
  50. ddmin021 min 2 -2 -> -2
  51. ddmin022 min 2 -1 -> -1
  52. ddmin023 min 2 0 -> 0
  53. ddmin025 min 2 1 -> 1
  54. ddmin026 min 2 2 -> 2
  55. -- extended zeros
  56. ddmin030 min 0 0 -> 0
  57. ddmin031 min 0 -0 -> -0
  58. ddmin032 min 0 -0.0 -> -0.0
  59. ddmin033 min 0 0.0 -> 0.0
  60. ddmin034 min -0 0 -> -0
  61. ddmin035 min -0 -0 -> -0
  62. ddmin036 min -0 -0.0 -> -0
  63. ddmin037 min -0 0.0 -> -0
  64. ddmin038 min 0.0 0 -> 0.0
  65. ddmin039 min 0.0 -0 -> -0
  66. ddmin040 min 0.0 -0.0 -> -0.0
  67. ddmin041 min 0.0 0.0 -> 0.0
  68. ddmin042 min -0.0 0 -> -0.0
  69. ddmin043 min -0.0 -0 -> -0
  70. ddmin044 min -0.0 -0.0 -> -0.0
  71. ddmin045 min -0.0 0.0 -> -0.0
  72. ddmin046 min 0E1 -0E1 -> -0E+1
  73. ddmin047 min -0E1 0E2 -> -0E+1
  74. ddmin048 min 0E2 0E1 -> 0E+1
  75. ddmin049 min 0E1 0E2 -> 0E+1
  76. ddmin050 min -0E3 -0E2 -> -0E+3
  77. ddmin051 min -0E2 -0E3 -> -0E+3
  78. -- Specials
  79. ddmin090 min Inf -Inf -> -Infinity
  80. ddmin091 min Inf -1000 -> -1000
  81. ddmin092 min Inf -1 -> -1
  82. ddmin093 min Inf -0 -> -0
  83. ddmin094 min Inf 0 -> 0
  84. ddmin095 min Inf 1 -> 1
  85. ddmin096 min Inf 1000 -> 1000
  86. ddmin097 min Inf Inf -> Infinity
  87. ddmin098 min -1000 Inf -> -1000
  88. ddmin099 min -Inf Inf -> -Infinity
  89. ddmin100 min -1 Inf -> -1
  90. ddmin101 min -0 Inf -> -0
  91. ddmin102 min 0 Inf -> 0
  92. ddmin103 min 1 Inf -> 1
  93. ddmin104 min 1000 Inf -> 1000
  94. ddmin105 min Inf Inf -> Infinity
  95. ddmin120 min -Inf -Inf -> -Infinity
  96. ddmin121 min -Inf -1000 -> -Infinity
  97. ddmin122 min -Inf -1 -> -Infinity
  98. ddmin123 min -Inf -0 -> -Infinity
  99. ddmin124 min -Inf 0 -> -Infinity
  100. ddmin125 min -Inf 1 -> -Infinity
  101. ddmin126 min -Inf 1000 -> -Infinity
  102. ddmin127 min -Inf Inf -> -Infinity
  103. ddmin128 min -Inf -Inf -> -Infinity
  104. ddmin129 min -1000 -Inf -> -Infinity
  105. ddmin130 min -1 -Inf -> -Infinity
  106. ddmin131 min -0 -Inf -> -Infinity
  107. ddmin132 min 0 -Inf -> -Infinity
  108. ddmin133 min 1 -Inf -> -Infinity
  109. ddmin134 min 1000 -Inf -> -Infinity
  110. ddmin135 min Inf -Inf -> -Infinity
  111. -- 2004.08.02 754r chooses number over NaN in mixed cases
  112. ddmin141 min NaN -Inf -> -Infinity
  113. ddmin142 min NaN -1000 -> -1000
  114. ddmin143 min NaN -1 -> -1
  115. ddmin144 min NaN -0 -> -0
  116. ddmin145 min NaN 0 -> 0
  117. ddmin146 min NaN 1 -> 1
  118. ddmin147 min NaN 1000 -> 1000
  119. ddmin148 min NaN Inf -> Infinity
  120. ddmin149 min NaN NaN -> NaN
  121. ddmin150 min -Inf NaN -> -Infinity
  122. ddmin151 min -1000 NaN -> -1000
  123. ddmin152 min -1 -NaN -> -1
  124. ddmin153 min -0 NaN -> -0
  125. ddmin154 min 0 -NaN -> 0
  126. ddmin155 min 1 NaN -> 1
  127. ddmin156 min 1000 NaN -> 1000
  128. ddmin157 min Inf NaN -> Infinity
  129. ddmin161 min sNaN -Inf -> NaN Invalid_operation
  130. ddmin162 min sNaN -1000 -> NaN Invalid_operation
  131. ddmin163 min sNaN -1 -> NaN Invalid_operation
  132. ddmin164 min sNaN -0 -> NaN Invalid_operation
  133. ddmin165 min -sNaN 0 -> -NaN Invalid_operation
  134. ddmin166 min -sNaN 1 -> -NaN Invalid_operation
  135. ddmin167 min sNaN 1000 -> NaN Invalid_operation
  136. ddmin168 min sNaN NaN -> NaN Invalid_operation
  137. ddmin169 min sNaN sNaN -> NaN Invalid_operation
  138. ddmin170 min NaN sNaN -> NaN Invalid_operation
  139. ddmin171 min -Inf sNaN -> NaN Invalid_operation
  140. ddmin172 min -1000 sNaN -> NaN Invalid_operation
  141. ddmin173 min -1 sNaN -> NaN Invalid_operation
  142. ddmin174 min -0 sNaN -> NaN Invalid_operation
  143. ddmin175 min 0 sNaN -> NaN Invalid_operation
  144. ddmin176 min 1 sNaN -> NaN Invalid_operation
  145. ddmin177 min 1000 sNaN -> NaN Invalid_operation
  146. ddmin178 min Inf sNaN -> NaN Invalid_operation
  147. ddmin179 min NaN sNaN -> NaN Invalid_operation
  148. -- propagating NaNs
  149. ddmin181 min NaN9 -Inf -> -Infinity
  150. ddmin182 min -NaN8 9990 -> 9990
  151. ddmin183 min NaN71 Inf -> Infinity
  152. ddmin184 min NaN1 NaN54 -> NaN1
  153. ddmin185 min NaN22 -NaN53 -> NaN22
  154. ddmin186 min -NaN3 NaN6 -> -NaN3
  155. ddmin187 min -NaN44 NaN7 -> -NaN44
  156. ddmin188 min -Inf NaN41 -> -Infinity
  157. ddmin189 min -9999 -NaN33 -> -9999
  158. ddmin190 min Inf NaN2 -> Infinity
  159. ddmin191 min sNaN99 -Inf -> NaN99 Invalid_operation
  160. ddmin192 min sNaN98 -11 -> NaN98 Invalid_operation
  161. ddmin193 min -sNaN97 NaN8 -> -NaN97 Invalid_operation
  162. ddmin194 min sNaN69 sNaN94 -> NaN69 Invalid_operation
  163. ddmin195 min NaN95 sNaN93 -> NaN93 Invalid_operation
  164. ddmin196 min -Inf sNaN92 -> NaN92 Invalid_operation
  165. ddmin197 min 088 sNaN91 -> NaN91 Invalid_operation
  166. ddmin198 min Inf -sNaN90 -> -NaN90 Invalid_operation
  167. ddmin199 min NaN sNaN86 -> NaN86 Invalid_operation
  168. -- old rounding checks
  169. ddmin221 min -12345678000 1 -> -12345678000
  170. ddmin222 min 1 -12345678000 -> -12345678000
  171. ddmin223 min -1234567800 1 -> -1234567800
  172. ddmin224 min 1 -1234567800 -> -1234567800
  173. ddmin225 min -1234567890 1 -> -1234567890
  174. ddmin226 min 1 -1234567890 -> -1234567890
  175. ddmin227 min -1234567891 1 -> -1234567891
  176. ddmin228 min 1 -1234567891 -> -1234567891
  177. ddmin229 min -12345678901 1 -> -12345678901
  178. ddmin230 min 1 -12345678901 -> -12345678901
  179. ddmin231 min -1234567896 1 -> -1234567896
  180. ddmin232 min 1 -1234567896 -> -1234567896
  181. ddmin233 min 1234567891 1 -> 1
  182. ddmin234 min 1 1234567891 -> 1
  183. ddmin235 min 12345678901 1 -> 1
  184. ddmin236 min 1 12345678901 -> 1
  185. ddmin237 min 1234567896 1 -> 1
  186. ddmin238 min 1 1234567896 -> 1
  187. -- from examples
  188. ddmin280 min '3' '2' -> '2'
  189. ddmin281 min '-10' '3' -> '-10'
  190. ddmin282 min '1.0' '1' -> '1.0'
  191. ddmin283 min '1' '1.0' -> '1.0'
  192. ddmin284 min '7' 'NaN' -> '7'
  193. -- expanded list from min/max 754r purple prose
  194. -- [explicit tests for exponent ordering]
  195. ddmin401 min Inf 1.1 -> 1.1
  196. ddmin402 min 1.1 1 -> 1
  197. ddmin403 min 1 1.0 -> 1.0
  198. ddmin404 min 1.0 0.1 -> 0.1
  199. ddmin405 min 0.1 0.10 -> 0.10
  200. ddmin406 min 0.10 0.100 -> 0.100
  201. ddmin407 min 0.10 0 -> 0
  202. ddmin408 min 0 0.0 -> 0.0
  203. ddmin409 min 0.0 -0 -> -0
  204. ddmin410 min 0.0 -0.0 -> -0.0
  205. ddmin411 min 0.00 -0.0 -> -0.0
  206. ddmin412 min 0.0 -0.00 -> -0.00
  207. ddmin413 min 0 -0.0 -> -0.0
  208. ddmin414 min 0 -0 -> -0
  209. ddmin415 min -0.0 -0 -> -0
  210. ddmin416 min -0 -0.100 -> -0.100
  211. ddmin417 min -0.100 -0.10 -> -0.10
  212. ddmin418 min -0.10 -0.1 -> -0.1
  213. ddmin419 min -0.1 -1.0 -> -1.0
  214. ddmin420 min -1.0 -1 -> -1
  215. ddmin421 min -1 -1.1 -> -1.1
  216. ddmin423 min -1.1 -Inf -> -Infinity
  217. -- same with operands reversed
  218. ddmin431 min 1.1 Inf -> 1.1
  219. ddmin432 min 1 1.1 -> 1
  220. ddmin433 min 1.0 1 -> 1.0
  221. ddmin434 min 0.1 1.0 -> 0.1
  222. ddmin435 min 0.10 0.1 -> 0.10
  223. ddmin436 min 0.100 0.10 -> 0.100
  224. ddmin437 min 0 0.10 -> 0
  225. ddmin438 min 0.0 0 -> 0.0
  226. ddmin439 min -0 0.0 -> -0
  227. ddmin440 min -0.0 0.0 -> -0.0
  228. ddmin441 min -0.0 0.00 -> -0.0
  229. ddmin442 min -0.00 0.0 -> -0.00
  230. ddmin443 min -0.0 0 -> -0.0
  231. ddmin444 min -0 0 -> -0
  232. ddmin445 min -0 -0.0 -> -0
  233. ddmin446 min -0.100 -0 -> -0.100
  234. ddmin447 min -0.10 -0.100 -> -0.10
  235. ddmin448 min -0.1 -0.10 -> -0.1
  236. ddmin449 min -1.0 -0.1 -> -1.0
  237. ddmin450 min -1 -1.0 -> -1
  238. ddmin451 min -1.1 -1 -> -1.1
  239. ddmin453 min -Inf -1.1 -> -Infinity
  240. -- largies
  241. ddmin460 min 1000 1E+3 -> 1000
  242. ddmin461 min 1E+3 1000 -> 1000
  243. ddmin462 min 1000 -1E+3 -> -1E+3
  244. ddmin463 min 1E+3 -384 -> -384
  245. ddmin464 min -384 1E+3 -> -384
  246. ddmin465 min -1E+3 1000 -> -1E+3
  247. ddmin466 min -384 -1E+3 -> -1E+3
  248. ddmin467 min -1E+3 -384 -> -1E+3
  249. -- misalignment traps for little-endian
  250. ddmin471 min 1.0 0.1 -> 0.1
  251. ddmin472 min 0.1 1.0 -> 0.1
  252. ddmin473 min 10.0 0.1 -> 0.1
  253. ddmin474 min 0.1 10.0 -> 0.1
  254. ddmin475 min 100 1.0 -> 1.0
  255. ddmin476 min 1.0 100 -> 1.0
  256. ddmin477 min 1000 10.0 -> 10.0
  257. ddmin478 min 10.0 1000 -> 10.0
  258. ddmin479 min 10000 100.0 -> 100.0
  259. ddmin480 min 100.0 10000 -> 100.0
  260. ddmin481 min 100000 1000.0 -> 1000.0
  261. ddmin482 min 1000.0 100000 -> 1000.0
  262. ddmin483 min 1000000 10000.0 -> 10000.0
  263. ddmin484 min 10000.0 1000000 -> 10000.0
  264. -- subnormals
  265. ddmin510 min 1.00E-383 0 -> 0
  266. ddmin511 min 0.1E-383 0 -> 0
  267. ddmin512 min 0.10E-383 0 -> 0
  268. ddmin513 min 0.100E-383 0 -> 0
  269. ddmin514 min 0.01E-383 0 -> 0
  270. ddmin515 min 0.999E-383 0 -> 0
  271. ddmin516 min 0.099E-383 0 -> 0
  272. ddmin517 min 0.009E-383 0 -> 0
  273. ddmin518 min 0.001E-383 0 -> 0
  274. ddmin519 min 0.0009E-383 0 -> 0
  275. ddmin520 min 0.0001E-383 0 -> 0
  276. ddmin530 min -1.00E-383 0 -> -1.00E-383
  277. ddmin531 min -0.1E-383 0 -> -1E-384 Subnormal
  278. ddmin532 min -0.10E-383 0 -> -1.0E-384 Subnormal
  279. ddmin533 min -0.100E-383 0 -> -1.00E-384 Subnormal
  280. ddmin534 min -0.01E-383 0 -> -1E-385 Subnormal
  281. ddmin535 min -0.999E-383 0 -> -9.99E-384 Subnormal
  282. ddmin536 min -0.099E-383 0 -> -9.9E-385 Subnormal
  283. ddmin537 min -0.009E-383 0 -> -9E-386 Subnormal
  284. ddmin538 min -0.001E-383 0 -> -1E-386 Subnormal
  285. ddmin539 min -0.0009E-383 0 -> -9E-387 Subnormal
  286. ddmin540 min -0.0001E-383 0 -> -1E-387 Subnormal
  287. -- Null tests
  288. ddmin900 min 10 # -> NaN Invalid_operation
  289. ddmin901 min # 10 -> NaN Invalid_operation