min.decTest 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. ------------------------------------------------------------------------
  2. -- min.decTest -- decimal minimum --
  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. extended: 1
  24. precision: 9
  25. rounding: half_up
  26. maxExponent: 384
  27. minexponent: -383
  28. -- sanity checks
  29. mnmx001 min -2 -2 -> -2
  30. mnmx002 min -2 -1 -> -2
  31. mnmx003 min -2 0 -> -2
  32. mnmx004 min -2 1 -> -2
  33. mnmx005 min -2 2 -> -2
  34. mnmx006 min -1 -2 -> -2
  35. mnmx007 min -1 -1 -> -1
  36. mnmx008 min -1 0 -> -1
  37. mnmx009 min -1 1 -> -1
  38. mnmx010 min -1 2 -> -1
  39. mnmx011 min 0 -2 -> -2
  40. mnmx012 min 0 -1 -> -1
  41. mnmx013 min 0 0 -> 0
  42. mnmx014 min 0 1 -> 0
  43. mnmx015 min 0 2 -> 0
  44. mnmx016 min 1 -2 -> -2
  45. mnmx017 min 1 -1 -> -1
  46. mnmx018 min 1 0 -> 0
  47. mnmx019 min 1 1 -> 1
  48. mnmx020 min 1 2 -> 1
  49. mnmx021 min 2 -2 -> -2
  50. mnmx022 min 2 -1 -> -1
  51. mnmx023 min 2 0 -> 0
  52. mnmx025 min 2 1 -> 1
  53. mnmx026 min 2 2 -> 2
  54. -- extended zeros
  55. mnmx030 min 0 0 -> 0
  56. mnmx031 min 0 -0 -> -0
  57. mnmx032 min 0 -0.0 -> -0.0
  58. mnmx033 min 0 0.0 -> 0.0
  59. mnmx034 min -0 0 -> -0
  60. mnmx035 min -0 -0 -> -0
  61. mnmx036 min -0 -0.0 -> -0
  62. mnmx037 min -0 0.0 -> -0
  63. mnmx038 min 0.0 0 -> 0.0
  64. mnmx039 min 0.0 -0 -> -0
  65. mnmx040 min 0.0 -0.0 -> -0.0
  66. mnmx041 min 0.0 0.0 -> 0.0
  67. mnmx042 min -0.0 0 -> -0.0
  68. mnmx043 min -0.0 -0 -> -0
  69. mnmx044 min -0.0 -0.0 -> -0.0
  70. mnmx045 min -0.0 0.0 -> -0.0
  71. mnmx046 min 0E1 -0E1 -> -0E+1
  72. mnmx047 min -0E1 0E2 -> -0E+1
  73. mnmx048 min 0E2 0E1 -> 0E+1
  74. mnmx049 min 0E1 0E2 -> 0E+1
  75. mnmx050 min -0E3 -0E2 -> -0E+3
  76. mnmx051 min -0E2 -0E3 -> -0E+3
  77. -- Specials
  78. precision: 9
  79. mnmx090 min Inf -Inf -> -Infinity
  80. mnmx091 min Inf -1000 -> -1000
  81. mnmx092 min Inf -1 -> -1
  82. mnmx093 min Inf -0 -> -0
  83. mnmx094 min Inf 0 -> 0
  84. mnmx095 min Inf 1 -> 1
  85. mnmx096 min Inf 1000 -> 1000
  86. mnmx097 min Inf Inf -> Infinity
  87. mnmx098 min -1000 Inf -> -1000
  88. mnmx099 min -Inf Inf -> -Infinity
  89. mnmx100 min -1 Inf -> -1
  90. mnmx101 min -0 Inf -> -0
  91. mnmx102 min 0 Inf -> 0
  92. mnmx103 min 1 Inf -> 1
  93. mnmx104 min 1000 Inf -> 1000
  94. mnmx105 min Inf Inf -> Infinity
  95. mnmx120 min -Inf -Inf -> -Infinity
  96. mnmx121 min -Inf -1000 -> -Infinity
  97. mnmx122 min -Inf -1 -> -Infinity
  98. mnmx123 min -Inf -0 -> -Infinity
  99. mnmx124 min -Inf 0 -> -Infinity
  100. mnmx125 min -Inf 1 -> -Infinity
  101. mnmx126 min -Inf 1000 -> -Infinity
  102. mnmx127 min -Inf Inf -> -Infinity
  103. mnmx128 min -Inf -Inf -> -Infinity
  104. mnmx129 min -1000 -Inf -> -Infinity
  105. mnmx130 min -1 -Inf -> -Infinity
  106. mnmx131 min -0 -Inf -> -Infinity
  107. mnmx132 min 0 -Inf -> -Infinity
  108. mnmx133 min 1 -Inf -> -Infinity
  109. mnmx134 min 1000 -Inf -> -Infinity
  110. mnmx135 min Inf -Inf -> -Infinity
  111. -- 2004.08.02 754r chooses number over NaN in mixed cases
  112. mnmx141 min NaN -Inf -> -Infinity
  113. mnmx142 min NaN -1000 -> -1000
  114. mnmx143 min NaN -1 -> -1
  115. mnmx144 min NaN -0 -> -0
  116. mnmx145 min NaN 0 -> 0
  117. mnmx146 min NaN 1 -> 1
  118. mnmx147 min NaN 1000 -> 1000
  119. mnmx148 min NaN Inf -> Infinity
  120. mnmx149 min NaN NaN -> NaN
  121. mnmx150 min -Inf NaN -> -Infinity
  122. mnmx151 min -1000 NaN -> -1000
  123. mnmx152 min -1 -NaN -> -1
  124. mnmx153 min -0 NaN -> -0
  125. mnmx154 min 0 -NaN -> 0
  126. mnmx155 min 1 NaN -> 1
  127. mnmx156 min 1000 NaN -> 1000
  128. mnmx157 min Inf NaN -> Infinity
  129. mnmx161 min sNaN -Inf -> NaN Invalid_operation
  130. mnmx162 min sNaN -1000 -> NaN Invalid_operation
  131. mnmx163 min sNaN -1 -> NaN Invalid_operation
  132. mnmx164 min sNaN -0 -> NaN Invalid_operation
  133. mnmx165 min -sNaN 0 -> -NaN Invalid_operation
  134. mnmx166 min -sNaN 1 -> -NaN Invalid_operation
  135. mnmx167 min sNaN 1000 -> NaN Invalid_operation
  136. mnmx168 min sNaN NaN -> NaN Invalid_operation
  137. mnmx169 min sNaN sNaN -> NaN Invalid_operation
  138. mnmx170 min NaN sNaN -> NaN Invalid_operation
  139. mnmx171 min -Inf sNaN -> NaN Invalid_operation
  140. mnmx172 min -1000 sNaN -> NaN Invalid_operation
  141. mnmx173 min -1 sNaN -> NaN Invalid_operation
  142. mnmx174 min -0 sNaN -> NaN Invalid_operation
  143. mnmx175 min 0 sNaN -> NaN Invalid_operation
  144. mnmx176 min 1 sNaN -> NaN Invalid_operation
  145. mnmx177 min 1000 sNaN -> NaN Invalid_operation
  146. mnmx178 min Inf sNaN -> NaN Invalid_operation
  147. mnmx179 min NaN sNaN -> NaN Invalid_operation
  148. -- propagating NaNs
  149. mnmx181 min NaN9 -Inf -> -Infinity
  150. mnmx182 min -NaN8 9990 -> 9990
  151. mnmx183 min NaN71 Inf -> Infinity
  152. mnmx184 min NaN1 NaN54 -> NaN1
  153. mnmx185 min NaN22 -NaN53 -> NaN22
  154. mnmx186 min -NaN3 NaN6 -> -NaN3
  155. mnmx187 min -NaN44 NaN7 -> -NaN44
  156. mnmx188 min -Inf NaN41 -> -Infinity
  157. mnmx189 min -9999 -NaN33 -> -9999
  158. mnmx190 min Inf NaN2 -> Infinity
  159. mnmx191 min sNaN99 -Inf -> NaN99 Invalid_operation
  160. mnmx192 min sNaN98 -11 -> NaN98 Invalid_operation
  161. mnmx193 min -sNaN97 NaN8 -> -NaN97 Invalid_operation
  162. mnmx194 min sNaN69 sNaN94 -> NaN69 Invalid_operation
  163. mnmx195 min NaN95 sNaN93 -> NaN93 Invalid_operation
  164. mnmx196 min -Inf sNaN92 -> NaN92 Invalid_operation
  165. mnmx197 min 088 sNaN91 -> NaN91 Invalid_operation
  166. mnmx198 min Inf -sNaN90 -> -NaN90 Invalid_operation
  167. mnmx199 min NaN sNaN86 -> NaN86 Invalid_operation
  168. -- rounding checks -- chosen is rounded, or not
  169. maxExponent: 999
  170. minexponent: -999
  171. precision: 9
  172. mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded
  173. mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded
  174. mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded
  175. mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded
  176. mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded
  177. mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded
  178. mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded
  179. mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded
  180. mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded
  181. mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded
  182. mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded
  183. mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded
  184. mnmx213 min 1234567891 1 -> 1
  185. mnmx214 min 1 1234567891 -> 1
  186. mnmx215 min 12345678901 1 -> 1
  187. mnmx216 min 1 12345678901 -> 1
  188. mnmx217 min 1234567896 1 -> 1
  189. mnmx218 min 1 1234567896 -> 1
  190. precision: 15
  191. mnmx221 min -12345678000 1 -> -12345678000
  192. mnmx222 min 1 -12345678000 -> -12345678000
  193. mnmx223 min -1234567800 1 -> -1234567800
  194. mnmx224 min 1 -1234567800 -> -1234567800
  195. mnmx225 min -1234567890 1 -> -1234567890
  196. mnmx226 min 1 -1234567890 -> -1234567890
  197. mnmx227 min -1234567891 1 -> -1234567891
  198. mnmx228 min 1 -1234567891 -> -1234567891
  199. mnmx229 min -12345678901 1 -> -12345678901
  200. mnmx230 min 1 -12345678901 -> -12345678901
  201. mnmx231 min -1234567896 1 -> -1234567896
  202. mnmx232 min 1 -1234567896 -> -1234567896
  203. mnmx233 min 1234567891 1 -> 1
  204. mnmx234 min 1 1234567891 -> 1
  205. mnmx235 min 12345678901 1 -> 1
  206. mnmx236 min 1 12345678901 -> 1
  207. mnmx237 min 1234567896 1 -> 1
  208. mnmx238 min 1 1234567896 -> 1
  209. -- from examples
  210. mnmx280 min '3' '2' -> '2'
  211. mnmx281 min '-10' '3' -> '-10'
  212. mnmx282 min '1.0' '1' -> '1.0'
  213. mnmx283 min '1' '1.0' -> '1.0'
  214. mnmx284 min '7' 'NaN' -> '7'
  215. -- overflow and underflow tests .. subnormal results [inputs] now allowed
  216. maxExponent: 999999999
  217. minexponent: -999999999
  218. mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999
  219. mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999
  220. mnmx332 min -0.100 -9E-999999999 -> -0.100
  221. mnmx333 min -9E-999999999 -0.100 -> -0.100
  222. mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999
  223. mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999
  224. mnmx337 min +0.100 -9E-999999999 -> -9E-999999999
  225. mnmx338 min -9E-999999999 0.100 -> -9E-999999999
  226. mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001
  227. mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000
  228. mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000
  229. mnmx342 min -9e-999999998 -0.01 -> -0.01
  230. mnmx343 min -9e-999999998 -0.1 -> -0.1
  231. mnmx344 min -0.01 -9e-999999998 -> -0.01
  232. mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999
  233. mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999
  234. mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000
  235. mnmx348 min -9e999999998 -100 -> -9E+999999998
  236. mnmx349 min -9e999999998 -10 -> -9E+999999998
  237. mnmx350 min -100 -9e999999998 -> -9E+999999998
  238. -- signs
  239. mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777
  240. mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777
  241. mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111
  242. mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111
  243. mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111
  244. mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777
  245. mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111
  246. mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777
  247. -- expanded list from min/max 754r purple prose
  248. -- [explicit tests for exponent ordering]
  249. mnmx401 min Inf 1.1 -> 1.1
  250. mnmx402 min 1.1 1 -> 1
  251. mnmx403 min 1 1.0 -> 1.0
  252. mnmx404 min 1.0 0.1 -> 0.1
  253. mnmx405 min 0.1 0.10 -> 0.10
  254. mnmx406 min 0.10 0.100 -> 0.100
  255. mnmx407 min 0.10 0 -> 0
  256. mnmx408 min 0 0.0 -> 0.0
  257. mnmx409 min 0.0 -0 -> -0
  258. mnmx410 min 0.0 -0.0 -> -0.0
  259. mnmx411 min 0.00 -0.0 -> -0.0
  260. mnmx412 min 0.0 -0.00 -> -0.00
  261. mnmx413 min 0 -0.0 -> -0.0
  262. mnmx414 min 0 -0 -> -0
  263. mnmx415 min -0.0 -0 -> -0
  264. mnmx416 min -0 -0.100 -> -0.100
  265. mnmx417 min -0.100 -0.10 -> -0.10
  266. mnmx418 min -0.10 -0.1 -> -0.1
  267. mnmx419 min -0.1 -1.0 -> -1.0
  268. mnmx420 min -1.0 -1 -> -1
  269. mnmx421 min -1 -1.1 -> -1.1
  270. mnmx423 min -1.1 -Inf -> -Infinity
  271. -- same with operands reversed
  272. mnmx431 min 1.1 Inf -> 1.1
  273. mnmx432 min 1 1.1 -> 1
  274. mnmx433 min 1.0 1 -> 1.0
  275. mnmx434 min 0.1 1.0 -> 0.1
  276. mnmx435 min 0.10 0.1 -> 0.10
  277. mnmx436 min 0.100 0.10 -> 0.100
  278. mnmx437 min 0 0.10 -> 0
  279. mnmx438 min 0.0 0 -> 0.0
  280. mnmx439 min -0 0.0 -> -0
  281. mnmx440 min -0.0 0.0 -> -0.0
  282. mnmx441 min -0.0 0.00 -> -0.0
  283. mnmx442 min -0.00 0.0 -> -0.00
  284. mnmx443 min -0.0 0 -> -0.0
  285. mnmx444 min -0 0 -> -0
  286. mnmx445 min -0 -0.0 -> -0
  287. mnmx446 min -0.100 -0 -> -0.100
  288. mnmx447 min -0.10 -0.100 -> -0.10
  289. mnmx448 min -0.1 -0.10 -> -0.1
  290. mnmx449 min -1.0 -0.1 -> -1.0
  291. mnmx450 min -1 -1.0 -> -1
  292. mnmx451 min -1.1 -1 -> -1.1
  293. mnmx453 min -Inf -1.1 -> -Infinity
  294. -- largies
  295. mnmx460 min 1000 1E+3 -> 1000
  296. mnmx461 min 1E+3 1000 -> 1000
  297. mnmx462 min 1000 -1E+3 -> -1E+3
  298. mnmx463 min 1E+3 -1000 -> -1000
  299. mnmx464 min -1000 1E+3 -> -1000
  300. mnmx465 min -1E+3 1000 -> -1E+3
  301. mnmx466 min -1000 -1E+3 -> -1E+3
  302. mnmx467 min -1E+3 -1000 -> -1E+3
  303. -- rounding (results treated as though plus)
  304. maxexponent: 999999999
  305. minexponent: -999999999
  306. precision: 3
  307. mnmx470 min 1 5 -> 1
  308. mnmx471 min 10 50 -> 10
  309. mnmx472 min 100 500 -> 100
  310. mnmx473 min 1000 5000 -> 1.00E+3 Rounded
  311. mnmx474 min 10000 50000 -> 1.00E+4 Rounded
  312. mnmx475 min 6 50 -> 6
  313. mnmx476 min 66 500 -> 66
  314. mnmx477 min 666 5000 -> 666
  315. mnmx478 min 6666 50000 -> 6.67E+3 Rounded Inexact
  316. mnmx479 min 66666 500000 -> 6.67E+4 Rounded Inexact
  317. mnmx480 min 33333 500000 -> 3.33E+4 Rounded Inexact
  318. mnmx481 min 75401 1 -> 1
  319. mnmx482 min 75402 10 -> 10
  320. mnmx483 min 75403 100 -> 100
  321. mnmx484 min 75404 1000 -> 1.00E+3 Rounded
  322. mnmx485 min 75405 10000 -> 1.00E+4 Rounded
  323. mnmx486 min 75406 6 -> 6
  324. mnmx487 min 75407 66 -> 66
  325. mnmx488 min 75408 666 -> 666
  326. mnmx489 min 75409 6666 -> 6.67E+3 Rounded Inexact
  327. mnmx490 min 75410 66666 -> 6.67E+4 Rounded Inexact
  328. mnmx491 min 75411 33333 -> 3.33E+4 Rounded Inexact
  329. -- overflow tests
  330. maxexponent: 999999999
  331. minexponent: -999999999
  332. precision: 3
  333. mnmx500 min 9.999E+999999999 0 -> 0
  334. mnmx501 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded
  335. -- subnormals and underflow
  336. precision: 3
  337. maxexponent: 999
  338. minexponent: -999
  339. mnmx510 min 1.00E-999 0 -> 0
  340. mnmx511 min 0.1E-999 0 -> 0
  341. mnmx512 min 0.10E-999 0 -> 0
  342. mnmx513 min 0.100E-999 0 -> 0
  343. mnmx514 min 0.01E-999 0 -> 0
  344. mnmx515 min 0.999E-999 0 -> 0
  345. mnmx516 min 0.099E-999 0 -> 0
  346. mnmx517 min 0.009E-999 0 -> 0
  347. mnmx518 min 0.001E-999 0 -> 0
  348. mnmx519 min 0.0009E-999 0 -> 0
  349. mnmx520 min 0.0001E-999 0 -> 0
  350. mnmx530 min -1.00E-999 0 -> -1.00E-999
  351. mnmx531 min -0.1E-999 0 -> -1E-1000 Subnormal
  352. mnmx532 min -0.10E-999 0 -> -1.0E-1000 Subnormal
  353. mnmx533 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded
  354. mnmx534 min -0.01E-999 0 -> -1E-1001 Subnormal
  355. -- next is rounded to Nmin
  356. mnmx535 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow
  357. mnmx536 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
  358. mnmx537 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow
  359. mnmx538 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  360. mnmx539 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  361. mnmx540 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  362. -- misalignment traps for little-endian
  363. precision: 9
  364. mnmx551 min 1.0 0.1 -> 0.1
  365. mnmx552 min 0.1 1.0 -> 0.1
  366. mnmx553 min 10.0 0.1 -> 0.1
  367. mnmx554 min 0.1 10.0 -> 0.1
  368. mnmx555 min 100 1.0 -> 1.0
  369. mnmx556 min 1.0 100 -> 1.0
  370. mnmx557 min 1000 10.0 -> 10.0
  371. mnmx558 min 10.0 1000 -> 10.0
  372. mnmx559 min 10000 100.0 -> 100.0
  373. mnmx560 min 100.0 10000 -> 100.0
  374. mnmx561 min 100000 1000.0 -> 1000.0
  375. mnmx562 min 1000.0 100000 -> 1000.0
  376. mnmx563 min 1000000 10000.0 -> 10000.0
  377. mnmx564 min 10000.0 1000000 -> 10000.0
  378. -- Null tests
  379. mnm900 min 10 # -> NaN Invalid_operation
  380. mnm901 min # 10 -> NaN Invalid_operation