ddMax.decTest 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. ------------------------------------------------------------------------
  2. -- ddMax.decTest -- decDouble maxnum --
  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. ddmax001 max -2 -2 -> -2
  31. ddmax002 max -2 -1 -> -1
  32. ddmax003 max -2 0 -> 0
  33. ddmax004 max -2 1 -> 1
  34. ddmax005 max -2 2 -> 2
  35. ddmax006 max -1 -2 -> -1
  36. ddmax007 max -1 -1 -> -1
  37. ddmax008 max -1 0 -> 0
  38. ddmax009 max -1 1 -> 1
  39. ddmax010 max -1 2 -> 2
  40. ddmax011 max 0 -2 -> 0
  41. ddmax012 max 0 -1 -> 0
  42. ddmax013 max 0 0 -> 0
  43. ddmax014 max 0 1 -> 1
  44. ddmax015 max 0 2 -> 2
  45. ddmax016 max 1 -2 -> 1
  46. ddmax017 max 1 -1 -> 1
  47. ddmax018 max 1 0 -> 1
  48. ddmax019 max 1 1 -> 1
  49. ddmax020 max 1 2 -> 2
  50. ddmax021 max 2 -2 -> 2
  51. ddmax022 max 2 -1 -> 2
  52. ddmax023 max 2 0 -> 2
  53. ddmax025 max 2 1 -> 2
  54. ddmax026 max 2 2 -> 2
  55. -- extended zeros
  56. ddmax030 max 0 0 -> 0
  57. ddmax031 max 0 -0 -> 0
  58. ddmax032 max 0 -0.0 -> 0
  59. ddmax033 max 0 0.0 -> 0
  60. ddmax034 max -0 0 -> 0 -- note: -0 = 0, but 0 chosen
  61. ddmax035 max -0 -0 -> -0
  62. ddmax036 max -0 -0.0 -> -0.0
  63. ddmax037 max -0 0.0 -> 0.0
  64. ddmax038 max 0.0 0 -> 0
  65. ddmax039 max 0.0 -0 -> 0.0
  66. ddmax040 max 0.0 -0.0 -> 0.0
  67. ddmax041 max 0.0 0.0 -> 0.0
  68. ddmax042 max -0.0 0 -> 0
  69. ddmax043 max -0.0 -0 -> -0.0
  70. ddmax044 max -0.0 -0.0 -> -0.0
  71. ddmax045 max -0.0 0.0 -> 0.0
  72. ddmax050 max -0E1 0E1 -> 0E+1
  73. ddmax051 max -0E2 0E2 -> 0E+2
  74. ddmax052 max -0E2 0E1 -> 0E+1
  75. ddmax053 max -0E1 0E2 -> 0E+2
  76. ddmax054 max 0E1 -0E1 -> 0E+1
  77. ddmax055 max 0E2 -0E2 -> 0E+2
  78. ddmax056 max 0E2 -0E1 -> 0E+2
  79. ddmax057 max 0E1 -0E2 -> 0E+1
  80. ddmax058 max 0E1 0E1 -> 0E+1
  81. ddmax059 max 0E2 0E2 -> 0E+2
  82. ddmax060 max 0E2 0E1 -> 0E+2
  83. ddmax061 max 0E1 0E2 -> 0E+2
  84. ddmax062 max -0E1 -0E1 -> -0E+1
  85. ddmax063 max -0E2 -0E2 -> -0E+2
  86. ddmax064 max -0E2 -0E1 -> -0E+1
  87. ddmax065 max -0E1 -0E2 -> -0E+1
  88. -- Specials
  89. ddmax090 max Inf -Inf -> Infinity
  90. ddmax091 max Inf -1000 -> Infinity
  91. ddmax092 max Inf -1 -> Infinity
  92. ddmax093 max Inf -0 -> Infinity
  93. ddmax094 max Inf 0 -> Infinity
  94. ddmax095 max Inf 1 -> Infinity
  95. ddmax096 max Inf 1000 -> Infinity
  96. ddmax097 max Inf Inf -> Infinity
  97. ddmax098 max -1000 Inf -> Infinity
  98. ddmax099 max -Inf Inf -> Infinity
  99. ddmax100 max -1 Inf -> Infinity
  100. ddmax101 max -0 Inf -> Infinity
  101. ddmax102 max 0 Inf -> Infinity
  102. ddmax103 max 1 Inf -> Infinity
  103. ddmax104 max 1000 Inf -> Infinity
  104. ddmax105 max Inf Inf -> Infinity
  105. ddmax120 max -Inf -Inf -> -Infinity
  106. ddmax121 max -Inf -1000 -> -1000
  107. ddmax122 max -Inf -1 -> -1
  108. ddmax123 max -Inf -0 -> -0
  109. ddmax124 max -Inf 0 -> 0
  110. ddmax125 max -Inf 1 -> 1
  111. ddmax126 max -Inf 1000 -> 1000
  112. ddmax127 max -Inf Inf -> Infinity
  113. ddmax128 max -Inf -Inf -> -Infinity
  114. ddmax129 max -1000 -Inf -> -1000
  115. ddmax130 max -1 -Inf -> -1
  116. ddmax131 max -0 -Inf -> -0
  117. ddmax132 max 0 -Inf -> 0
  118. ddmax133 max 1 -Inf -> 1
  119. ddmax134 max 1000 -Inf -> 1000
  120. ddmax135 max Inf -Inf -> Infinity
  121. -- 2004.08.02 754r chooses number over NaN in mixed cases
  122. ddmax141 max NaN -Inf -> -Infinity
  123. ddmax142 max NaN -1000 -> -1000
  124. ddmax143 max NaN -1 -> -1
  125. ddmax144 max NaN -0 -> -0
  126. ddmax145 max NaN 0 -> 0
  127. ddmax146 max NaN 1 -> 1
  128. ddmax147 max NaN 1000 -> 1000
  129. ddmax148 max NaN Inf -> Infinity
  130. ddmax149 max NaN NaN -> NaN
  131. ddmax150 max -Inf NaN -> -Infinity
  132. ddmax151 max -1000 NaN -> -1000
  133. ddmax152 max -1 NaN -> -1
  134. ddmax153 max -0 NaN -> -0
  135. ddmax154 max 0 NaN -> 0
  136. ddmax155 max 1 NaN -> 1
  137. ddmax156 max 1000 NaN -> 1000
  138. ddmax157 max Inf NaN -> Infinity
  139. ddmax161 max sNaN -Inf -> NaN Invalid_operation
  140. ddmax162 max sNaN -1000 -> NaN Invalid_operation
  141. ddmax163 max sNaN -1 -> NaN Invalid_operation
  142. ddmax164 max sNaN -0 -> NaN Invalid_operation
  143. ddmax165 max sNaN 0 -> NaN Invalid_operation
  144. ddmax166 max sNaN 1 -> NaN Invalid_operation
  145. ddmax167 max sNaN 1000 -> NaN Invalid_operation
  146. ddmax168 max sNaN NaN -> NaN Invalid_operation
  147. ddmax169 max sNaN sNaN -> NaN Invalid_operation
  148. ddmax170 max NaN sNaN -> NaN Invalid_operation
  149. ddmax171 max -Inf sNaN -> NaN Invalid_operation
  150. ddmax172 max -1000 sNaN -> NaN Invalid_operation
  151. ddmax173 max -1 sNaN -> NaN Invalid_operation
  152. ddmax174 max -0 sNaN -> NaN Invalid_operation
  153. ddmax175 max 0 sNaN -> NaN Invalid_operation
  154. ddmax176 max 1 sNaN -> NaN Invalid_operation
  155. ddmax177 max 1000 sNaN -> NaN Invalid_operation
  156. ddmax178 max Inf sNaN -> NaN Invalid_operation
  157. ddmax179 max NaN sNaN -> NaN Invalid_operation
  158. -- propagating NaNs
  159. ddmax181 max NaN9 -Inf -> -Infinity
  160. ddmax182 max NaN8 9 -> 9
  161. ddmax183 max -NaN7 Inf -> Infinity
  162. ddmax184 max -NaN1 NaN11 -> -NaN1
  163. ddmax185 max NaN2 NaN12 -> NaN2
  164. ddmax186 max -NaN13 -NaN7 -> -NaN13
  165. ddmax187 max NaN14 -NaN5 -> NaN14
  166. ddmax188 max -Inf NaN4 -> -Infinity
  167. ddmax189 max -9 -NaN3 -> -9
  168. ddmax190 max Inf NaN2 -> Infinity
  169. ddmax191 max sNaN99 -Inf -> NaN99 Invalid_operation
  170. ddmax192 max sNaN98 -1 -> NaN98 Invalid_operation
  171. ddmax193 max -sNaN97 NaN -> -NaN97 Invalid_operation
  172. ddmax194 max sNaN96 sNaN94 -> NaN96 Invalid_operation
  173. ddmax195 max NaN95 sNaN93 -> NaN93 Invalid_operation
  174. ddmax196 max -Inf sNaN92 -> NaN92 Invalid_operation
  175. ddmax197 max 0 sNaN91 -> NaN91 Invalid_operation
  176. ddmax198 max Inf -sNaN90 -> -NaN90 Invalid_operation
  177. ddmax199 max NaN sNaN89 -> NaN89 Invalid_operation
  178. -- old rounding checks
  179. ddmax221 max 12345678000 1 -> 12345678000
  180. ddmax222 max 1 12345678000 -> 12345678000
  181. ddmax223 max 1234567800 1 -> 1234567800
  182. ddmax224 max 1 1234567800 -> 1234567800
  183. ddmax225 max 1234567890 1 -> 1234567890
  184. ddmax226 max 1 1234567890 -> 1234567890
  185. ddmax227 max 1234567891 1 -> 1234567891
  186. ddmax228 max 1 1234567891 -> 1234567891
  187. ddmax229 max 12345678901 1 -> 12345678901
  188. ddmax230 max 1 12345678901 -> 12345678901
  189. ddmax231 max 1234567896 1 -> 1234567896
  190. ddmax232 max 1 1234567896 -> 1234567896
  191. ddmax233 max -1234567891 1 -> 1
  192. ddmax234 max 1 -1234567891 -> 1
  193. ddmax235 max -12345678901 1 -> 1
  194. ddmax236 max 1 -12345678901 -> 1
  195. ddmax237 max -1234567896 1 -> 1
  196. ddmax238 max 1 -1234567896 -> 1
  197. -- from examples
  198. ddmax280 max '3' '2' -> '3'
  199. ddmax281 max '-10' '3' -> '3'
  200. ddmax282 max '1.0' '1' -> '1'
  201. ddmax283 max '1' '1.0' -> '1'
  202. ddmax284 max '7' 'NaN' -> '7'
  203. -- expanded list from min/max 754r purple prose
  204. -- [explicit tests for exponent ordering]
  205. ddmax401 max Inf 1.1 -> Infinity
  206. ddmax402 max 1.1 1 -> 1.1
  207. ddmax403 max 1 1.0 -> 1
  208. ddmax404 max 1.0 0.1 -> 1.0
  209. ddmax405 max 0.1 0.10 -> 0.1
  210. ddmax406 max 0.10 0.100 -> 0.10
  211. ddmax407 max 0.10 0 -> 0.10
  212. ddmax408 max 0 0.0 -> 0
  213. ddmax409 max 0.0 -0 -> 0.0
  214. ddmax410 max 0.0 -0.0 -> 0.0
  215. ddmax411 max 0.00 -0.0 -> 0.00
  216. ddmax412 max 0.0 -0.00 -> 0.0
  217. ddmax413 max 0 -0.0 -> 0
  218. ddmax414 max 0 -0 -> 0
  219. ddmax415 max -0.0 -0 -> -0.0
  220. ddmax416 max -0 -0.100 -> -0
  221. ddmax417 max -0.100 -0.10 -> -0.100
  222. ddmax418 max -0.10 -0.1 -> -0.10
  223. ddmax419 max -0.1 -1.0 -> -0.1
  224. ddmax420 max -1.0 -1 -> -1.0
  225. ddmax421 max -1 -1.1 -> -1
  226. ddmax423 max -1.1 -Inf -> -1.1
  227. -- same with operands reversed
  228. ddmax431 max 1.1 Inf -> Infinity
  229. ddmax432 max 1 1.1 -> 1.1
  230. ddmax433 max 1.0 1 -> 1
  231. ddmax434 max 0.1 1.0 -> 1.0
  232. ddmax435 max 0.10 0.1 -> 0.1
  233. ddmax436 max 0.100 0.10 -> 0.10
  234. ddmax437 max 0 0.10 -> 0.10
  235. ddmax438 max 0.0 0 -> 0
  236. ddmax439 max -0 0.0 -> 0.0
  237. ddmax440 max -0.0 0.0 -> 0.0
  238. ddmax441 max -0.0 0.00 -> 0.00
  239. ddmax442 max -0.00 0.0 -> 0.0
  240. ddmax443 max -0.0 0 -> 0
  241. ddmax444 max -0 0 -> 0
  242. ddmax445 max -0 -0.0 -> -0.0
  243. ddmax446 max -0.100 -0 -> -0
  244. ddmax447 max -0.10 -0.100 -> -0.100
  245. ddmax448 max -0.1 -0.10 -> -0.10
  246. ddmax449 max -1.0 -0.1 -> -0.1
  247. ddmax450 max -1 -1.0 -> -1.0
  248. ddmax451 max -1.1 -1 -> -1
  249. ddmax453 max -Inf -1.1 -> -1.1
  250. -- largies
  251. ddmax460 max 1000 1E+3 -> 1E+3
  252. ddmax461 max 1E+3 1000 -> 1E+3
  253. ddmax462 max 1000 -1E+3 -> 1000
  254. ddmax463 max 1E+3 -1000 -> 1E+3
  255. ddmax464 max -1000 1E+3 -> 1E+3
  256. ddmax465 max -1E+3 1000 -> 1000
  257. ddmax466 max -1000 -1E+3 -> -1000
  258. ddmax467 max -1E+3 -1000 -> -1000
  259. -- misalignment traps for little-endian
  260. ddmax471 max 1.0 0.1 -> 1.0
  261. ddmax472 max 0.1 1.0 -> 1.0
  262. ddmax473 max 10.0 0.1 -> 10.0
  263. ddmax474 max 0.1 10.0 -> 10.0
  264. ddmax475 max 100 1.0 -> 100
  265. ddmax476 max 1.0 100 -> 100
  266. ddmax477 max 1000 10.0 -> 1000
  267. ddmax478 max 10.0 1000 -> 1000
  268. ddmax479 max 10000 100.0 -> 10000
  269. ddmax480 max 100.0 10000 -> 10000
  270. ddmax481 max 100000 1000.0 -> 100000
  271. ddmax482 max 1000.0 100000 -> 100000
  272. ddmax483 max 1000000 10000.0 -> 1000000
  273. ddmax484 max 10000.0 1000000 -> 1000000
  274. -- subnormals
  275. ddmax510 max 1.00E-383 0 -> 1.00E-383
  276. ddmax511 max 0.1E-383 0 -> 1E-384 Subnormal
  277. ddmax512 max 0.10E-383 0 -> 1.0E-384 Subnormal
  278. ddmax513 max 0.100E-383 0 -> 1.00E-384 Subnormal
  279. ddmax514 max 0.01E-383 0 -> 1E-385 Subnormal
  280. ddmax515 max 0.999E-383 0 -> 9.99E-384 Subnormal
  281. ddmax516 max 0.099E-383 0 -> 9.9E-385 Subnormal
  282. ddmax517 max 0.009E-383 0 -> 9E-386 Subnormal
  283. ddmax518 max 0.001E-383 0 -> 1E-386 Subnormal
  284. ddmax519 max 0.0009E-383 0 -> 9E-387 Subnormal
  285. ddmax520 max 0.0001E-383 0 -> 1E-387 Subnormal
  286. ddmax530 max -1.00E-383 0 -> 0
  287. ddmax531 max -0.1E-383 0 -> 0
  288. ddmax532 max -0.10E-383 0 -> 0
  289. ddmax533 max -0.100E-383 0 -> 0
  290. ddmax534 max -0.01E-383 0 -> 0
  291. ddmax535 max -0.999E-383 0 -> 0
  292. ddmax536 max -0.099E-383 0 -> 0
  293. ddmax537 max -0.009E-383 0 -> 0
  294. ddmax538 max -0.001E-383 0 -> 0
  295. ddmax539 max -0.0009E-383 0 -> 0
  296. ddmax540 max -0.0001E-383 0 -> 0
  297. -- Null tests
  298. ddmax900 max 10 # -> NaN Invalid_operation
  299. ddmax901 max # 10 -> NaN Invalid_operation