ddMaxMag.decTest 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. ------------------------------------------------------------------------
  2. -- ddMaxMag.decTest -- decDouble maxnummag --
  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. ddmxg001 maxmag -2 -2 -> -2
  31. ddmxg002 maxmag -2 -1 -> -2
  32. ddmxg003 maxmag -2 0 -> -2
  33. ddmxg004 maxmag -2 1 -> -2
  34. ddmxg005 maxmag -2 2 -> 2
  35. ddmxg006 maxmag -1 -2 -> -2
  36. ddmxg007 maxmag -1 -1 -> -1
  37. ddmxg008 maxmag -1 0 -> -1
  38. ddmxg009 maxmag -1 1 -> 1
  39. ddmxg010 maxmag -1 2 -> 2
  40. ddmxg011 maxmag 0 -2 -> -2
  41. ddmxg012 maxmag 0 -1 -> -1
  42. ddmxg013 maxmag 0 0 -> 0
  43. ddmxg014 maxmag 0 1 -> 1
  44. ddmxg015 maxmag 0 2 -> 2
  45. ddmxg016 maxmag 1 -2 -> -2
  46. ddmxg017 maxmag 1 -1 -> 1
  47. ddmxg018 maxmag 1 0 -> 1
  48. ddmxg019 maxmag 1 1 -> 1
  49. ddmxg020 maxmag 1 2 -> 2
  50. ddmxg021 maxmag 2 -2 -> 2
  51. ddmxg022 maxmag 2 -1 -> 2
  52. ddmxg023 maxmag 2 0 -> 2
  53. ddmxg025 maxmag 2 1 -> 2
  54. ddmxg026 maxmag 2 2 -> 2
  55. -- extended zeros
  56. ddmxg030 maxmag 0 0 -> 0
  57. ddmxg031 maxmag 0 -0 -> 0
  58. ddmxg032 maxmag 0 -0.0 -> 0
  59. ddmxg033 maxmag 0 0.0 -> 0
  60. ddmxg034 maxmag -0 0 -> 0 -- note: -0 = 0, but 0 chosen
  61. ddmxg035 maxmag -0 -0 -> -0
  62. ddmxg036 maxmag -0 -0.0 -> -0.0
  63. ddmxg037 maxmag -0 0.0 -> 0.0
  64. ddmxg038 maxmag 0.0 0 -> 0
  65. ddmxg039 maxmag 0.0 -0 -> 0.0
  66. ddmxg040 maxmag 0.0 -0.0 -> 0.0
  67. ddmxg041 maxmag 0.0 0.0 -> 0.0
  68. ddmxg042 maxmag -0.0 0 -> 0
  69. ddmxg043 maxmag -0.0 -0 -> -0.0
  70. ddmxg044 maxmag -0.0 -0.0 -> -0.0
  71. ddmxg045 maxmag -0.0 0.0 -> 0.0
  72. ddmxg050 maxmag -0E1 0E1 -> 0E+1
  73. ddmxg051 maxmag -0E2 0E2 -> 0E+2
  74. ddmxg052 maxmag -0E2 0E1 -> 0E+1
  75. ddmxg053 maxmag -0E1 0E2 -> 0E+2
  76. ddmxg054 maxmag 0E1 -0E1 -> 0E+1
  77. ddmxg055 maxmag 0E2 -0E2 -> 0E+2
  78. ddmxg056 maxmag 0E2 -0E1 -> 0E+2
  79. ddmxg057 maxmag 0E1 -0E2 -> 0E+1
  80. ddmxg058 maxmag 0E1 0E1 -> 0E+1
  81. ddmxg059 maxmag 0E2 0E2 -> 0E+2
  82. ddmxg060 maxmag 0E2 0E1 -> 0E+2
  83. ddmxg061 maxmag 0E1 0E2 -> 0E+2
  84. ddmxg062 maxmag -0E1 -0E1 -> -0E+1
  85. ddmxg063 maxmag -0E2 -0E2 -> -0E+2
  86. ddmxg064 maxmag -0E2 -0E1 -> -0E+1
  87. ddmxg065 maxmag -0E1 -0E2 -> -0E+1
  88. -- Specials
  89. ddmxg090 maxmag Inf -Inf -> Infinity
  90. ddmxg091 maxmag Inf -1000 -> Infinity
  91. ddmxg092 maxmag Inf -1 -> Infinity
  92. ddmxg093 maxmag Inf -0 -> Infinity
  93. ddmxg094 maxmag Inf 0 -> Infinity
  94. ddmxg095 maxmag Inf 1 -> Infinity
  95. ddmxg096 maxmag Inf 1000 -> Infinity
  96. ddmxg097 maxmag Inf Inf -> Infinity
  97. ddmxg098 maxmag -1000 Inf -> Infinity
  98. ddmxg099 maxmag -Inf Inf -> Infinity
  99. ddmxg100 maxmag -1 Inf -> Infinity
  100. ddmxg101 maxmag -0 Inf -> Infinity
  101. ddmxg102 maxmag 0 Inf -> Infinity
  102. ddmxg103 maxmag 1 Inf -> Infinity
  103. ddmxg104 maxmag 1000 Inf -> Infinity
  104. ddmxg105 maxmag Inf Inf -> Infinity
  105. ddmxg120 maxmag -Inf -Inf -> -Infinity
  106. ddmxg121 maxmag -Inf -1000 -> -Infinity
  107. ddmxg122 maxmag -Inf -1 -> -Infinity
  108. ddmxg123 maxmag -Inf -0 -> -Infinity
  109. ddmxg124 maxmag -Inf 0 -> -Infinity
  110. ddmxg125 maxmag -Inf 1 -> -Infinity
  111. ddmxg126 maxmag -Inf 1000 -> -Infinity
  112. ddmxg127 maxmag -Inf Inf -> Infinity
  113. ddmxg128 maxmag -Inf -Inf -> -Infinity
  114. ddmxg129 maxmag -1000 -Inf -> -Infinity
  115. ddmxg130 maxmag -1 -Inf -> -Infinity
  116. ddmxg131 maxmag -0 -Inf -> -Infinity
  117. ddmxg132 maxmag 0 -Inf -> -Infinity
  118. ddmxg133 maxmag 1 -Inf -> -Infinity
  119. ddmxg134 maxmag 1000 -Inf -> -Infinity
  120. ddmxg135 maxmag Inf -Inf -> Infinity
  121. -- 2004.08.02 754r chooses number over NaN in mixed cases
  122. ddmxg141 maxmag NaN -Inf -> -Infinity
  123. ddmxg142 maxmag NaN -1000 -> -1000
  124. ddmxg143 maxmag NaN -1 -> -1
  125. ddmxg144 maxmag NaN -0 -> -0
  126. ddmxg145 maxmag NaN 0 -> 0
  127. ddmxg146 maxmag NaN 1 -> 1
  128. ddmxg147 maxmag NaN 1000 -> 1000
  129. ddmxg148 maxmag NaN Inf -> Infinity
  130. ddmxg149 maxmag NaN NaN -> NaN
  131. ddmxg150 maxmag -Inf NaN -> -Infinity
  132. ddmxg151 maxmag -1000 NaN -> -1000
  133. ddmxg152 maxmag -1 NaN -> -1
  134. ddmxg153 maxmag -0 NaN -> -0
  135. ddmxg154 maxmag 0 NaN -> 0
  136. ddmxg155 maxmag 1 NaN -> 1
  137. ddmxg156 maxmag 1000 NaN -> 1000
  138. ddmxg157 maxmag Inf NaN -> Infinity
  139. ddmxg161 maxmag sNaN -Inf -> NaN Invalid_operation
  140. ddmxg162 maxmag sNaN -1000 -> NaN Invalid_operation
  141. ddmxg163 maxmag sNaN -1 -> NaN Invalid_operation
  142. ddmxg164 maxmag sNaN -0 -> NaN Invalid_operation
  143. ddmxg165 maxmag sNaN 0 -> NaN Invalid_operation
  144. ddmxg166 maxmag sNaN 1 -> NaN Invalid_operation
  145. ddmxg167 maxmag sNaN 1000 -> NaN Invalid_operation
  146. ddmxg168 maxmag sNaN NaN -> NaN Invalid_operation
  147. ddmxg169 maxmag sNaN sNaN -> NaN Invalid_operation
  148. ddmxg170 maxmag NaN sNaN -> NaN Invalid_operation
  149. ddmxg171 maxmag -Inf sNaN -> NaN Invalid_operation
  150. ddmxg172 maxmag -1000 sNaN -> NaN Invalid_operation
  151. ddmxg173 maxmag -1 sNaN -> NaN Invalid_operation
  152. ddmxg174 maxmag -0 sNaN -> NaN Invalid_operation
  153. ddmxg175 maxmag 0 sNaN -> NaN Invalid_operation
  154. ddmxg176 maxmag 1 sNaN -> NaN Invalid_operation
  155. ddmxg177 maxmag 1000 sNaN -> NaN Invalid_operation
  156. ddmxg178 maxmag Inf sNaN -> NaN Invalid_operation
  157. ddmxg179 maxmag NaN sNaN -> NaN Invalid_operation
  158. -- propagating NaNs
  159. ddmxg181 maxmag NaN9 -Inf -> -Infinity
  160. ddmxg182 maxmag NaN8 9 -> 9
  161. ddmxg183 maxmag -NaN7 Inf -> Infinity
  162. ddmxg184 maxmag -NaN1 NaN11 -> -NaN1
  163. ddmxg185 maxmag NaN2 NaN12 -> NaN2
  164. ddmxg186 maxmag -NaN13 -NaN7 -> -NaN13
  165. ddmxg187 maxmag NaN14 -NaN5 -> NaN14
  166. ddmxg188 maxmag -Inf NaN4 -> -Infinity
  167. ddmxg189 maxmag -9 -NaN3 -> -9
  168. ddmxg190 maxmag Inf NaN2 -> Infinity
  169. ddmxg191 maxmag sNaN99 -Inf -> NaN99 Invalid_operation
  170. ddmxg192 maxmag sNaN98 -1 -> NaN98 Invalid_operation
  171. ddmxg193 maxmag -sNaN97 NaN -> -NaN97 Invalid_operation
  172. ddmxg194 maxmag sNaN96 sNaN94 -> NaN96 Invalid_operation
  173. ddmxg195 maxmag NaN95 sNaN93 -> NaN93 Invalid_operation
  174. ddmxg196 maxmag -Inf sNaN92 -> NaN92 Invalid_operation
  175. ddmxg197 maxmag 0 sNaN91 -> NaN91 Invalid_operation
  176. ddmxg198 maxmag Inf -sNaN90 -> -NaN90 Invalid_operation
  177. ddmxg199 maxmag NaN sNaN89 -> NaN89 Invalid_operation
  178. -- old rounding checks
  179. ddmxg221 maxmag 12345678000 1 -> 12345678000
  180. ddmxg222 maxmag 1 12345678000 -> 12345678000
  181. ddmxg223 maxmag 1234567800 1 -> 1234567800
  182. ddmxg224 maxmag 1 1234567800 -> 1234567800
  183. ddmxg225 maxmag 1234567890 1 -> 1234567890
  184. ddmxg226 maxmag 1 1234567890 -> 1234567890
  185. ddmxg227 maxmag 1234567891 1 -> 1234567891
  186. ddmxg228 maxmag 1 1234567891 -> 1234567891
  187. ddmxg229 maxmag 12345678901 1 -> 12345678901
  188. ddmxg230 maxmag 1 12345678901 -> 12345678901
  189. ddmxg231 maxmag 1234567896 1 -> 1234567896
  190. ddmxg232 maxmag 1 1234567896 -> 1234567896
  191. ddmxg233 maxmag -1234567891 1 -> -1234567891
  192. ddmxg234 maxmag 1 -1234567891 -> -1234567891
  193. ddmxg235 maxmag -12345678901 1 -> -12345678901
  194. ddmxg236 maxmag 1 -12345678901 -> -12345678901
  195. ddmxg237 maxmag -1234567896 1 -> -1234567896
  196. ddmxg238 maxmag 1 -1234567896 -> -1234567896
  197. -- from examples
  198. ddmxg280 maxmag '3' '2' -> '3'
  199. ddmxg281 maxmag '-10' '3' -> '-10'
  200. ddmxg282 maxmag '1.0' '1' -> '1'
  201. ddmxg283 maxmag '1' '1.0' -> '1'
  202. ddmxg284 maxmag '7' 'NaN' -> '7'
  203. -- expanded list from min/max 754r purple prose
  204. -- [explicit tests for exponent ordering]
  205. ddmxg401 maxmag Inf 1.1 -> Infinity
  206. ddmxg402 maxmag 1.1 1 -> 1.1
  207. ddmxg403 maxmag 1 1.0 -> 1
  208. ddmxg404 maxmag 1.0 0.1 -> 1.0
  209. ddmxg405 maxmag 0.1 0.10 -> 0.1
  210. ddmxg406 maxmag 0.10 0.100 -> 0.10
  211. ddmxg407 maxmag 0.10 0 -> 0.10
  212. ddmxg408 maxmag 0 0.0 -> 0
  213. ddmxg409 maxmag 0.0 -0 -> 0.0
  214. ddmxg410 maxmag 0.0 -0.0 -> 0.0
  215. ddmxg411 maxmag 0.00 -0.0 -> 0.00
  216. ddmxg412 maxmag 0.0 -0.00 -> 0.0
  217. ddmxg413 maxmag 0 -0.0 -> 0
  218. ddmxg414 maxmag 0 -0 -> 0
  219. ddmxg415 maxmag -0.0 -0 -> -0.0
  220. ddmxg416 maxmag -0 -0.100 -> -0.100
  221. ddmxg417 maxmag -0.100 -0.10 -> -0.100
  222. ddmxg418 maxmag -0.10 -0.1 -> -0.10
  223. ddmxg419 maxmag -0.1 -1.0 -> -1.0
  224. ddmxg420 maxmag -1.0 -1 -> -1.0
  225. ddmxg421 maxmag -1 -1.1 -> -1.1
  226. ddmxg423 maxmag -1.1 -Inf -> -Infinity
  227. -- same with operands reversed
  228. ddmxg431 maxmag 1.1 Inf -> Infinity
  229. ddmxg432 maxmag 1 1.1 -> 1.1
  230. ddmxg433 maxmag 1.0 1 -> 1
  231. ddmxg434 maxmag 0.1 1.0 -> 1.0
  232. ddmxg435 maxmag 0.10 0.1 -> 0.1
  233. ddmxg436 maxmag 0.100 0.10 -> 0.10
  234. ddmxg437 maxmag 0 0.10 -> 0.10
  235. ddmxg438 maxmag 0.0 0 -> 0
  236. ddmxg439 maxmag -0 0.0 -> 0.0
  237. ddmxg440 maxmag -0.0 0.0 -> 0.0
  238. ddmxg441 maxmag -0.0 0.00 -> 0.00
  239. ddmxg442 maxmag -0.00 0.0 -> 0.0
  240. ddmxg443 maxmag -0.0 0 -> 0
  241. ddmxg444 maxmag -0 0 -> 0
  242. ddmxg445 maxmag -0 -0.0 -> -0.0
  243. ddmxg446 maxmag -0.100 -0 -> -0.100
  244. ddmxg447 maxmag -0.10 -0.100 -> -0.100
  245. ddmxg448 maxmag -0.1 -0.10 -> -0.10
  246. ddmxg449 maxmag -1.0 -0.1 -> -1.0
  247. ddmxg450 maxmag -1 -1.0 -> -1.0
  248. ddmxg451 maxmag -1.1 -1 -> -1.1
  249. ddmxg453 maxmag -Inf -1.1 -> -Infinity
  250. -- largies
  251. ddmxg460 maxmag 1000 1E+3 -> 1E+3
  252. ddmxg461 maxmag 1E+3 1000 -> 1E+3
  253. ddmxg462 maxmag 1000 -1E+3 -> 1000
  254. ddmxg463 maxmag 1E+3 -1000 -> 1E+3
  255. ddmxg464 maxmag -1000 1E+3 -> 1E+3
  256. ddmxg465 maxmag -1E+3 1000 -> 1000
  257. ddmxg466 maxmag -1000 -1E+3 -> -1000
  258. ddmxg467 maxmag -1E+3 -1000 -> -1000
  259. -- subnormals
  260. ddmxg510 maxmag 1.00E-383 0 -> 1.00E-383
  261. ddmxg511 maxmag 0.1E-383 0 -> 1E-384 Subnormal
  262. ddmxg512 maxmag 0.10E-383 0 -> 1.0E-384 Subnormal
  263. ddmxg513 maxmag 0.100E-383 0 -> 1.00E-384 Subnormal
  264. ddmxg514 maxmag 0.01E-383 0 -> 1E-385 Subnormal
  265. ddmxg515 maxmag 0.999E-383 0 -> 9.99E-384 Subnormal
  266. ddmxg516 maxmag 0.099E-383 0 -> 9.9E-385 Subnormal
  267. ddmxg517 maxmag 0.009E-383 0 -> 9E-386 Subnormal
  268. ddmxg518 maxmag 0.001E-383 0 -> 1E-386 Subnormal
  269. ddmxg519 maxmag 0.0009E-383 0 -> 9E-387 Subnormal
  270. ddmxg520 maxmag 0.0001E-383 0 -> 1E-387 Subnormal
  271. ddmxg530 maxmag -1.00E-383 0 -> -1.00E-383
  272. ddmxg531 maxmag -0.1E-383 0 -> -1E-384 Subnormal
  273. ddmxg532 maxmag -0.10E-383 0 -> -1.0E-384 Subnormal
  274. ddmxg533 maxmag -0.100E-383 0 -> -1.00E-384 Subnormal
  275. ddmxg534 maxmag -0.01E-383 0 -> -1E-385 Subnormal
  276. ddmxg535 maxmag -0.999E-383 0 -> -9.99E-384 Subnormal
  277. ddmxg536 maxmag -0.099E-383 0 -> -9.9E-385 Subnormal
  278. ddmxg537 maxmag -0.009E-383 0 -> -9E-386 Subnormal
  279. ddmxg538 maxmag -0.001E-383 0 -> -1E-386 Subnormal
  280. ddmxg539 maxmag -0.0009E-383 0 -> -9E-387 Subnormal
  281. ddmxg540 maxmag -0.0001E-383 0 -> -1E-387 Subnormal
  282. -- Null tests
  283. ddmxg900 maxmag 10 # -> NaN Invalid_operation
  284. ddmxg901 maxmag # 10 -> NaN Invalid_operation