compare.decTest 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. ------------------------------------------------------------------------
  2. -- compare.decTest -- decimal comparison that allows quiet NaNs --
  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. -- Note that we cannot assume add/subtract tests cover paths adequately,
  22. -- here, because the code might be quite different (comparison cannot
  23. -- overflow or underflow, so actual subtractions are not necessary).
  24. extended: 1
  25. precision: 9
  26. rounding: half_up
  27. maxExponent: 999
  28. minexponent: -999
  29. -- sanity checks
  30. comx001 compare -2 -2 -> 0
  31. comx002 compare -2 -1 -> -1
  32. comx003 compare -2 0 -> -1
  33. comx004 compare -2 1 -> -1
  34. comx005 compare -2 2 -> -1
  35. comx006 compare -1 -2 -> 1
  36. comx007 compare -1 -1 -> 0
  37. comx008 compare -1 0 -> -1
  38. comx009 compare -1 1 -> -1
  39. comx010 compare -1 2 -> -1
  40. comx011 compare 0 -2 -> 1
  41. comx012 compare 0 -1 -> 1
  42. comx013 compare 0 0 -> 0
  43. comx014 compare 0 1 -> -1
  44. comx015 compare 0 2 -> -1
  45. comx016 compare 1 -2 -> 1
  46. comx017 compare 1 -1 -> 1
  47. comx018 compare 1 0 -> 1
  48. comx019 compare 1 1 -> 0
  49. comx020 compare 1 2 -> -1
  50. comx021 compare 2 -2 -> 1
  51. comx022 compare 2 -1 -> 1
  52. comx023 compare 2 0 -> 1
  53. comx025 compare 2 1 -> 1
  54. comx026 compare 2 2 -> 0
  55. comx031 compare -20 -20 -> 0
  56. comx032 compare -20 -10 -> -1
  57. comx033 compare -20 00 -> -1
  58. comx034 compare -20 10 -> -1
  59. comx035 compare -20 20 -> -1
  60. comx036 compare -10 -20 -> 1
  61. comx037 compare -10 -10 -> 0
  62. comx038 compare -10 00 -> -1
  63. comx039 compare -10 10 -> -1
  64. comx040 compare -10 20 -> -1
  65. comx041 compare 00 -20 -> 1
  66. comx042 compare 00 -10 -> 1
  67. comx043 compare 00 00 -> 0
  68. comx044 compare 00 10 -> -1
  69. comx045 compare 00 20 -> -1
  70. comx046 compare 10 -20 -> 1
  71. comx047 compare 10 -10 -> 1
  72. comx048 compare 10 00 -> 1
  73. comx049 compare 10 10 -> 0
  74. comx050 compare 10 20 -> -1
  75. comx051 compare 20 -20 -> 1
  76. comx052 compare 20 -10 -> 1
  77. comx053 compare 20 00 -> 1
  78. comx055 compare 20 10 -> 1
  79. comx056 compare 20 20 -> 0
  80. comx061 compare -2.0 -2.0 -> 0
  81. comx062 compare -2.0 -1.0 -> -1
  82. comx063 compare -2.0 0.0 -> -1
  83. comx064 compare -2.0 1.0 -> -1
  84. comx065 compare -2.0 2.0 -> -1
  85. comx066 compare -1.0 -2.0 -> 1
  86. comx067 compare -1.0 -1.0 -> 0
  87. comx068 compare -1.0 0.0 -> -1
  88. comx069 compare -1.0 1.0 -> -1
  89. comx070 compare -1.0 2.0 -> -1
  90. comx071 compare 0.0 -2.0 -> 1
  91. comx072 compare 0.0 -1.0 -> 1
  92. comx073 compare 0.0 0.0 -> 0
  93. comx074 compare 0.0 1.0 -> -1
  94. comx075 compare 0.0 2.0 -> -1
  95. comx076 compare 1.0 -2.0 -> 1
  96. comx077 compare 1.0 -1.0 -> 1
  97. comx078 compare 1.0 0.0 -> 1
  98. comx079 compare 1.0 1.0 -> 0
  99. comx080 compare 1.0 2.0 -> -1
  100. comx081 compare 2.0 -2.0 -> 1
  101. comx082 compare 2.0 -1.0 -> 1
  102. comx083 compare 2.0 0.0 -> 1
  103. comx085 compare 2.0 1.0 -> 1
  104. comx086 compare 2.0 2.0 -> 0
  105. -- now some cases which might overflow if subtract were used
  106. maxexponent: 999999999
  107. minexponent: -999999999
  108. comx095 compare 9.99999999E+999999999 9.99999999E+999999999 -> 0
  109. comx096 compare -9.99999999E+999999999 9.99999999E+999999999 -> -1
  110. comx097 compare 9.99999999E+999999999 -9.99999999E+999999999 -> 1
  111. comx098 compare -9.99999999E+999999999 -9.99999999E+999999999 -> 0
  112. -- some differing length/exponent cases
  113. comx100 compare 7.0 7.0 -> 0
  114. comx101 compare 7.0 7 -> 0
  115. comx102 compare 7 7.0 -> 0
  116. comx103 compare 7E+0 7.0 -> 0
  117. comx104 compare 70E-1 7.0 -> 0
  118. comx105 compare 0.7E+1 7 -> 0
  119. comx106 compare 70E-1 7 -> 0
  120. comx107 compare 7.0 7E+0 -> 0
  121. comx108 compare 7.0 70E-1 -> 0
  122. comx109 compare 7 0.7E+1 -> 0
  123. comx110 compare 7 70E-1 -> 0
  124. comx120 compare 8.0 7.0 -> 1
  125. comx121 compare 8.0 7 -> 1
  126. comx122 compare 8 7.0 -> 1
  127. comx123 compare 8E+0 7.0 -> 1
  128. comx124 compare 80E-1 7.0 -> 1
  129. comx125 compare 0.8E+1 7 -> 1
  130. comx126 compare 80E-1 7 -> 1
  131. comx127 compare 8.0 7E+0 -> 1
  132. comx128 compare 8.0 70E-1 -> 1
  133. comx129 compare 8 0.7E+1 -> 1
  134. comx130 compare 8 70E-1 -> 1
  135. comx140 compare 8.0 9.0 -> -1
  136. comx141 compare 8.0 9 -> -1
  137. comx142 compare 8 9.0 -> -1
  138. comx143 compare 8E+0 9.0 -> -1
  139. comx144 compare 80E-1 9.0 -> -1
  140. comx145 compare 0.8E+1 9 -> -1
  141. comx146 compare 80E-1 9 -> -1
  142. comx147 compare 8.0 9E+0 -> -1
  143. comx148 compare 8.0 90E-1 -> -1
  144. comx149 compare 8 0.9E+1 -> -1
  145. comx150 compare 8 90E-1 -> -1
  146. -- and again, with sign changes -+ ..
  147. comx200 compare -7.0 7.0 -> -1
  148. comx201 compare -7.0 7 -> -1
  149. comx202 compare -7 7.0 -> -1
  150. comx203 compare -7E+0 7.0 -> -1
  151. comx204 compare -70E-1 7.0 -> -1
  152. comx205 compare -0.7E+1 7 -> -1
  153. comx206 compare -70E-1 7 -> -1
  154. comx207 compare -7.0 7E+0 -> -1
  155. comx208 compare -7.0 70E-1 -> -1
  156. comx209 compare -7 0.7E+1 -> -1
  157. comx210 compare -7 70E-1 -> -1
  158. comx220 compare -8.0 7.0 -> -1
  159. comx221 compare -8.0 7 -> -1
  160. comx222 compare -8 7.0 -> -1
  161. comx223 compare -8E+0 7.0 -> -1
  162. comx224 compare -80E-1 7.0 -> -1
  163. comx225 compare -0.8E+1 7 -> -1
  164. comx226 compare -80E-1 7 -> -1
  165. comx227 compare -8.0 7E+0 -> -1
  166. comx228 compare -8.0 70E-1 -> -1
  167. comx229 compare -8 0.7E+1 -> -1
  168. comx230 compare -8 70E-1 -> -1
  169. comx240 compare -8.0 9.0 -> -1
  170. comx241 compare -8.0 9 -> -1
  171. comx242 compare -8 9.0 -> -1
  172. comx243 compare -8E+0 9.0 -> -1
  173. comx244 compare -80E-1 9.0 -> -1
  174. comx245 compare -0.8E+1 9 -> -1
  175. comx246 compare -80E-1 9 -> -1
  176. comx247 compare -8.0 9E+0 -> -1
  177. comx248 compare -8.0 90E-1 -> -1
  178. comx249 compare -8 0.9E+1 -> -1
  179. comx250 compare -8 90E-1 -> -1
  180. -- and again, with sign changes +- ..
  181. comx300 compare 7.0 -7.0 -> 1
  182. comx301 compare 7.0 -7 -> 1
  183. comx302 compare 7 -7.0 -> 1
  184. comx303 compare 7E+0 -7.0 -> 1
  185. comx304 compare 70E-1 -7.0 -> 1
  186. comx305 compare .7E+1 -7 -> 1
  187. comx306 compare 70E-1 -7 -> 1
  188. comx307 compare 7.0 -7E+0 -> 1
  189. comx308 compare 7.0 -70E-1 -> 1
  190. comx309 compare 7 -.7E+1 -> 1
  191. comx310 compare 7 -70E-1 -> 1
  192. comx320 compare 8.0 -7.0 -> 1
  193. comx321 compare 8.0 -7 -> 1
  194. comx322 compare 8 -7.0 -> 1
  195. comx323 compare 8E+0 -7.0 -> 1
  196. comx324 compare 80E-1 -7.0 -> 1
  197. comx325 compare .8E+1 -7 -> 1
  198. comx326 compare 80E-1 -7 -> 1
  199. comx327 compare 8.0 -7E+0 -> 1
  200. comx328 compare 8.0 -70E-1 -> 1
  201. comx329 compare 8 -.7E+1 -> 1
  202. comx330 compare 8 -70E-1 -> 1
  203. comx340 compare 8.0 -9.0 -> 1
  204. comx341 compare 8.0 -9 -> 1
  205. comx342 compare 8 -9.0 -> 1
  206. comx343 compare 8E+0 -9.0 -> 1
  207. comx344 compare 80E-1 -9.0 -> 1
  208. comx345 compare .8E+1 -9 -> 1
  209. comx346 compare 80E-1 -9 -> 1
  210. comx347 compare 8.0 -9E+0 -> 1
  211. comx348 compare 8.0 -90E-1 -> 1
  212. comx349 compare 8 -.9E+1 -> 1
  213. comx350 compare 8 -90E-1 -> 1
  214. -- and again, with sign changes -- ..
  215. comx400 compare -7.0 -7.0 -> 0
  216. comx401 compare -7.0 -7 -> 0
  217. comx402 compare -7 -7.0 -> 0
  218. comx403 compare -7E+0 -7.0 -> 0
  219. comx404 compare -70E-1 -7.0 -> 0
  220. comx405 compare -.7E+1 -7 -> 0
  221. comx406 compare -70E-1 -7 -> 0
  222. comx407 compare -7.0 -7E+0 -> 0
  223. comx408 compare -7.0 -70E-1 -> 0
  224. comx409 compare -7 -.7E+1 -> 0
  225. comx410 compare -7 -70E-1 -> 0
  226. comx420 compare -8.0 -7.0 -> -1
  227. comx421 compare -8.0 -7 -> -1
  228. comx422 compare -8 -7.0 -> -1
  229. comx423 compare -8E+0 -7.0 -> -1
  230. comx424 compare -80E-1 -7.0 -> -1
  231. comx425 compare -.8E+1 -7 -> -1
  232. comx426 compare -80E-1 -7 -> -1
  233. comx427 compare -8.0 -7E+0 -> -1
  234. comx428 compare -8.0 -70E-1 -> -1
  235. comx429 compare -8 -.7E+1 -> -1
  236. comx430 compare -8 -70E-1 -> -1
  237. comx440 compare -8.0 -9.0 -> 1
  238. comx441 compare -8.0 -9 -> 1
  239. comx442 compare -8 -9.0 -> 1
  240. comx443 compare -8E+0 -9.0 -> 1
  241. comx444 compare -80E-1 -9.0 -> 1
  242. comx445 compare -.8E+1 -9 -> 1
  243. comx446 compare -80E-1 -9 -> 1
  244. comx447 compare -8.0 -9E+0 -> 1
  245. comx448 compare -8.0 -90E-1 -> 1
  246. comx449 compare -8 -.9E+1 -> 1
  247. comx450 compare -8 -90E-1 -> 1
  248. -- misalignment traps for little-endian
  249. comx451 compare 1.0 0.1 -> 1
  250. comx452 compare 0.1 1.0 -> -1
  251. comx453 compare 10.0 0.1 -> 1
  252. comx454 compare 0.1 10.0 -> -1
  253. comx455 compare 100 1.0 -> 1
  254. comx456 compare 1.0 100 -> -1
  255. comx457 compare 1000 10.0 -> 1
  256. comx458 compare 10.0 1000 -> -1
  257. comx459 compare 10000 100.0 -> 1
  258. comx460 compare 100.0 10000 -> -1
  259. comx461 compare 100000 1000.0 -> 1
  260. comx462 compare 1000.0 100000 -> -1
  261. comx463 compare 1000000 10000.0 -> 1
  262. comx464 compare 10000.0 1000000 -> -1
  263. -- testcases that subtract to lots of zeros at boundaries [pgr]
  264. precision: 40
  265. comx470 compare 123.4560000000000000E789 123.456E789 -> 0
  266. comx471 compare 123.456000000000000E-89 123.456E-89 -> 0
  267. comx472 compare 123.45600000000000E789 123.456E789 -> 0
  268. comx473 compare 123.4560000000000E-89 123.456E-89 -> 0
  269. comx474 compare 123.456000000000E789 123.456E789 -> 0
  270. comx475 compare 123.45600000000E-89 123.456E-89 -> 0
  271. comx476 compare 123.4560000000E789 123.456E789 -> 0
  272. comx477 compare 123.456000000E-89 123.456E-89 -> 0
  273. comx478 compare 123.45600000E789 123.456E789 -> 0
  274. comx479 compare 123.4560000E-89 123.456E-89 -> 0
  275. comx480 compare 123.456000E789 123.456E789 -> 0
  276. comx481 compare 123.45600E-89 123.456E-89 -> 0
  277. comx482 compare 123.4560E789 123.456E789 -> 0
  278. comx483 compare 123.456E-89 123.456E-89 -> 0
  279. comx484 compare 123.456E-89 123.4560000000000000E-89 -> 0
  280. comx485 compare 123.456E789 123.456000000000000E789 -> 0
  281. comx486 compare 123.456E-89 123.45600000000000E-89 -> 0
  282. comx487 compare 123.456E789 123.4560000000000E789 -> 0
  283. comx488 compare 123.456E-89 123.456000000000E-89 -> 0
  284. comx489 compare 123.456E789 123.45600000000E789 -> 0
  285. comx490 compare 123.456E-89 123.4560000000E-89 -> 0
  286. comx491 compare 123.456E789 123.456000000E789 -> 0
  287. comx492 compare 123.456E-89 123.45600000E-89 -> 0
  288. comx493 compare 123.456E789 123.4560000E789 -> 0
  289. comx494 compare 123.456E-89 123.456000E-89 -> 0
  290. comx495 compare 123.456E789 123.45600E789 -> 0
  291. comx496 compare 123.456E-89 123.4560E-89 -> 0
  292. comx497 compare 123.456E789 123.456E789 -> 0
  293. -- wide-ranging, around precision; signs equal
  294. precision: 9
  295. comx500 compare 1 1E-15 -> 1
  296. comx501 compare 1 1E-14 -> 1
  297. comx502 compare 1 1E-13 -> 1
  298. comx503 compare 1 1E-12 -> 1
  299. comx504 compare 1 1E-11 -> 1
  300. comx505 compare 1 1E-10 -> 1
  301. comx506 compare 1 1E-9 -> 1
  302. comx507 compare 1 1E-8 -> 1
  303. comx508 compare 1 1E-7 -> 1
  304. comx509 compare 1 1E-6 -> 1
  305. comx510 compare 1 1E-5 -> 1
  306. comx511 compare 1 1E-4 -> 1
  307. comx512 compare 1 1E-3 -> 1
  308. comx513 compare 1 1E-2 -> 1
  309. comx514 compare 1 1E-1 -> 1
  310. comx515 compare 1 1E-0 -> 0
  311. comx516 compare 1 1E+1 -> -1
  312. comx517 compare 1 1E+2 -> -1
  313. comx518 compare 1 1E+3 -> -1
  314. comx519 compare 1 1E+4 -> -1
  315. comx521 compare 1 1E+5 -> -1
  316. comx522 compare 1 1E+6 -> -1
  317. comx523 compare 1 1E+7 -> -1
  318. comx524 compare 1 1E+8 -> -1
  319. comx525 compare 1 1E+9 -> -1
  320. comx526 compare 1 1E+10 -> -1
  321. comx527 compare 1 1E+11 -> -1
  322. comx528 compare 1 1E+12 -> -1
  323. comx529 compare 1 1E+13 -> -1
  324. comx530 compare 1 1E+14 -> -1
  325. comx531 compare 1 1E+15 -> -1
  326. -- LR swap
  327. comx540 compare 1E-15 1 -> -1
  328. comx541 compare 1E-14 1 -> -1
  329. comx542 compare 1E-13 1 -> -1
  330. comx543 compare 1E-12 1 -> -1
  331. comx544 compare 1E-11 1 -> -1
  332. comx545 compare 1E-10 1 -> -1
  333. comx546 compare 1E-9 1 -> -1
  334. comx547 compare 1E-8 1 -> -1
  335. comx548 compare 1E-7 1 -> -1
  336. comx549 compare 1E-6 1 -> -1
  337. comx550 compare 1E-5 1 -> -1
  338. comx551 compare 1E-4 1 -> -1
  339. comx552 compare 1E-3 1 -> -1
  340. comx553 compare 1E-2 1 -> -1
  341. comx554 compare 1E-1 1 -> -1
  342. comx555 compare 1E-0 1 -> 0
  343. comx556 compare 1E+1 1 -> 1
  344. comx557 compare 1E+2 1 -> 1
  345. comx558 compare 1E+3 1 -> 1
  346. comx559 compare 1E+4 1 -> 1
  347. comx561 compare 1E+5 1 -> 1
  348. comx562 compare 1E+6 1 -> 1
  349. comx563 compare 1E+7 1 -> 1
  350. comx564 compare 1E+8 1 -> 1
  351. comx565 compare 1E+9 1 -> 1
  352. comx566 compare 1E+10 1 -> 1
  353. comx567 compare 1E+11 1 -> 1
  354. comx568 compare 1E+12 1 -> 1
  355. comx569 compare 1E+13 1 -> 1
  356. comx570 compare 1E+14 1 -> 1
  357. comx571 compare 1E+15 1 -> 1
  358. -- similar with a useful coefficient, one side only
  359. comx580 compare 0.000000987654321 1E-15 -> 1
  360. comx581 compare 0.000000987654321 1E-14 -> 1
  361. comx582 compare 0.000000987654321 1E-13 -> 1
  362. comx583 compare 0.000000987654321 1E-12 -> 1
  363. comx584 compare 0.000000987654321 1E-11 -> 1
  364. comx585 compare 0.000000987654321 1E-10 -> 1
  365. comx586 compare 0.000000987654321 1E-9 -> 1
  366. comx587 compare 0.000000987654321 1E-8 -> 1
  367. comx588 compare 0.000000987654321 1E-7 -> 1
  368. comx589 compare 0.000000987654321 1E-6 -> -1
  369. comx590 compare 0.000000987654321 1E-5 -> -1
  370. comx591 compare 0.000000987654321 1E-4 -> -1
  371. comx592 compare 0.000000987654321 1E-3 -> -1
  372. comx593 compare 0.000000987654321 1E-2 -> -1
  373. comx594 compare 0.000000987654321 1E-1 -> -1
  374. comx595 compare 0.000000987654321 1E-0 -> -1
  375. comx596 compare 0.000000987654321 1E+1 -> -1
  376. comx597 compare 0.000000987654321 1E+2 -> -1
  377. comx598 compare 0.000000987654321 1E+3 -> -1
  378. comx599 compare 0.000000987654321 1E+4 -> -1
  379. -- check some unit-y traps
  380. precision: 20
  381. comx600 compare 12 12.2345 -> -1
  382. comx601 compare 12.0 12.2345 -> -1
  383. comx602 compare 12.00 12.2345 -> -1
  384. comx603 compare 12.000 12.2345 -> -1
  385. comx604 compare 12.0000 12.2345 -> -1
  386. comx605 compare 12.00000 12.2345 -> -1
  387. comx606 compare 12.000000 12.2345 -> -1
  388. comx607 compare 12.0000000 12.2345 -> -1
  389. comx608 compare 12.00000000 12.2345 -> -1
  390. comx609 compare 12.000000000 12.2345 -> -1
  391. comx610 compare 12.1234 12 -> 1
  392. comx611 compare 12.1234 12.0 -> 1
  393. comx612 compare 12.1234 12.00 -> 1
  394. comx613 compare 12.1234 12.000 -> 1
  395. comx614 compare 12.1234 12.0000 -> 1
  396. comx615 compare 12.1234 12.00000 -> 1
  397. comx616 compare 12.1234 12.000000 -> 1
  398. comx617 compare 12.1234 12.0000000 -> 1
  399. comx618 compare 12.1234 12.00000000 -> 1
  400. comx619 compare 12.1234 12.000000000 -> 1
  401. comx620 compare -12 -12.2345 -> 1
  402. comx621 compare -12.0 -12.2345 -> 1
  403. comx622 compare -12.00 -12.2345 -> 1
  404. comx623 compare -12.000 -12.2345 -> 1
  405. comx624 compare -12.0000 -12.2345 -> 1
  406. comx625 compare -12.00000 -12.2345 -> 1
  407. comx626 compare -12.000000 -12.2345 -> 1
  408. comx627 compare -12.0000000 -12.2345 -> 1
  409. comx628 compare -12.00000000 -12.2345 -> 1
  410. comx629 compare -12.000000000 -12.2345 -> 1
  411. comx630 compare -12.1234 -12 -> -1
  412. comx631 compare -12.1234 -12.0 -> -1
  413. comx632 compare -12.1234 -12.00 -> -1
  414. comx633 compare -12.1234 -12.000 -> -1
  415. comx634 compare -12.1234 -12.0000 -> -1
  416. comx635 compare -12.1234 -12.00000 -> -1
  417. comx636 compare -12.1234 -12.000000 -> -1
  418. comx637 compare -12.1234 -12.0000000 -> -1
  419. comx638 compare -12.1234 -12.00000000 -> -1
  420. comx639 compare -12.1234 -12.000000000 -> -1
  421. precision: 9
  422. -- extended zeros
  423. comx640 compare 0 0 -> 0
  424. comx641 compare 0 -0 -> 0
  425. comx642 compare 0 -0.0 -> 0
  426. comx643 compare 0 0.0 -> 0
  427. comx644 compare -0 0 -> 0
  428. comx645 compare -0 -0 -> 0
  429. comx646 compare -0 -0.0 -> 0
  430. comx647 compare -0 0.0 -> 0
  431. comx648 compare 0.0 0 -> 0
  432. comx649 compare 0.0 -0 -> 0
  433. comx650 compare 0.0 -0.0 -> 0
  434. comx651 compare 0.0 0.0 -> 0
  435. comx652 compare -0.0 0 -> 0
  436. comx653 compare -0.0 -0 -> 0
  437. comx654 compare -0.0 -0.0 -> 0
  438. comx655 compare -0.0 0.0 -> 0
  439. comx656 compare -0E1 0.0 -> 0
  440. comx657 compare -0E2 0.0 -> 0
  441. comx658 compare 0E1 0.0 -> 0
  442. comx659 compare 0E2 0.0 -> 0
  443. comx660 compare -0E1 0 -> 0
  444. comx661 compare -0E2 0 -> 0
  445. comx662 compare 0E1 0 -> 0
  446. comx663 compare 0E2 0 -> 0
  447. comx664 compare -0E1 -0E1 -> 0
  448. comx665 compare -0E2 -0E1 -> 0
  449. comx666 compare 0E1 -0E1 -> 0
  450. comx667 compare 0E2 -0E1 -> 0
  451. comx668 compare -0E1 -0E2 -> 0
  452. comx669 compare -0E2 -0E2 -> 0
  453. comx670 compare 0E1 -0E2 -> 0
  454. comx671 compare 0E2 -0E2 -> 0
  455. comx672 compare -0E1 0E1 -> 0
  456. comx673 compare -0E2 0E1 -> 0
  457. comx674 compare 0E1 0E1 -> 0
  458. comx675 compare 0E2 0E1 -> 0
  459. comx676 compare -0E1 0E2 -> 0
  460. comx677 compare -0E2 0E2 -> 0
  461. comx678 compare 0E1 0E2 -> 0
  462. comx679 compare 0E2 0E2 -> 0
  463. -- trailing zeros; unit-y
  464. precision: 20
  465. comx680 compare 12 12 -> 0
  466. comx681 compare 12 12.0 -> 0
  467. comx682 compare 12 12.00 -> 0
  468. comx683 compare 12 12.000 -> 0
  469. comx684 compare 12 12.0000 -> 0
  470. comx685 compare 12 12.00000 -> 0
  471. comx686 compare 12 12.000000 -> 0
  472. comx687 compare 12 12.0000000 -> 0
  473. comx688 compare 12 12.00000000 -> 0
  474. comx689 compare 12 12.000000000 -> 0
  475. comx690 compare 12 12 -> 0
  476. comx691 compare 12.0 12 -> 0
  477. comx692 compare 12.00 12 -> 0
  478. comx693 compare 12.000 12 -> 0
  479. comx694 compare 12.0000 12 -> 0
  480. comx695 compare 12.00000 12 -> 0
  481. comx696 compare 12.000000 12 -> 0
  482. comx697 compare 12.0000000 12 -> 0
  483. comx698 compare 12.00000000 12 -> 0
  484. comx699 compare 12.000000000 12 -> 0
  485. -- long operand checks
  486. maxexponent: 999
  487. minexponent: -999
  488. precision: 9
  489. comx701 compare 12345678000 1 -> 1
  490. comx702 compare 1 12345678000 -> -1
  491. comx703 compare 1234567800 1 -> 1
  492. comx704 compare 1 1234567800 -> -1
  493. comx705 compare 1234567890 1 -> 1
  494. comx706 compare 1 1234567890 -> -1
  495. comx707 compare 1234567891 1 -> 1
  496. comx708 compare 1 1234567891 -> -1
  497. comx709 compare 12345678901 1 -> 1
  498. comx710 compare 1 12345678901 -> -1
  499. comx711 compare 1234567896 1 -> 1
  500. comx712 compare 1 1234567896 -> -1
  501. comx713 compare -1234567891 1 -> -1
  502. comx714 compare 1 -1234567891 -> 1
  503. comx715 compare -12345678901 1 -> -1
  504. comx716 compare 1 -12345678901 -> 1
  505. comx717 compare -1234567896 1 -> -1
  506. comx718 compare 1 -1234567896 -> 1
  507. precision: 15
  508. -- same with plenty of precision
  509. comx721 compare 12345678000 1 -> 1
  510. comx722 compare 1 12345678000 -> -1
  511. comx723 compare 1234567800 1 -> 1
  512. comx724 compare 1 1234567800 -> -1
  513. comx725 compare 1234567890 1 -> 1
  514. comx726 compare 1 1234567890 -> -1
  515. comx727 compare 1234567891 1 -> 1
  516. comx728 compare 1 1234567891 -> -1
  517. comx729 compare 12345678901 1 -> 1
  518. comx730 compare 1 12345678901 -> -1
  519. comx731 compare 1234567896 1 -> 1
  520. comx732 compare 1 1234567896 -> -1
  521. -- residue cases
  522. precision: 5
  523. comx740 compare 1 0.9999999 -> 1
  524. comx741 compare 1 0.999999 -> 1
  525. comx742 compare 1 0.99999 -> 1
  526. comx743 compare 1 1.0000 -> 0
  527. comx744 compare 1 1.00001 -> -1
  528. comx745 compare 1 1.000001 -> -1
  529. comx746 compare 1 1.0000001 -> -1
  530. comx750 compare 0.9999999 1 -> -1
  531. comx751 compare 0.999999 1 -> -1
  532. comx752 compare 0.99999 1 -> -1
  533. comx753 compare 1.0000 1 -> 0
  534. comx754 compare 1.00001 1 -> 1
  535. comx755 compare 1.000001 1 -> 1
  536. comx756 compare 1.0000001 1 -> 1
  537. -- a selection of longies
  538. comx760 compare -36852134.84194296250843579428931 -5830629.8347085025808756560357940 -> -1
  539. comx761 compare -36852134.84194296250843579428931 -36852134.84194296250843579428931 -> 0
  540. comx762 compare -36852134.94194296250843579428931 -36852134.84194296250843579428931 -> -1
  541. comx763 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  542. -- precisions above or below the difference should have no effect
  543. precision: 11
  544. comx764 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  545. precision: 10
  546. comx765 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  547. precision: 9
  548. comx766 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  549. precision: 8
  550. comx767 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  551. precision: 7
  552. comx768 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  553. precision: 6
  554. comx769 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  555. precision: 5
  556. comx770 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  557. precision: 4
  558. comx771 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  559. precision: 3
  560. comx772 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  561. precision: 2
  562. comx773 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  563. precision: 1
  564. comx774 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1
  565. -- Specials
  566. precision: 9
  567. comx780 compare Inf -Inf -> 1
  568. comx781 compare Inf -1000 -> 1
  569. comx782 compare Inf -1 -> 1
  570. comx783 compare Inf -0 -> 1
  571. comx784 compare Inf 0 -> 1
  572. comx785 compare Inf 1 -> 1
  573. comx786 compare Inf 1000 -> 1
  574. comx787 compare Inf Inf -> 0
  575. comx788 compare -1000 Inf -> -1
  576. comx789 compare -Inf Inf -> -1
  577. comx790 compare -1 Inf -> -1
  578. comx791 compare -0 Inf -> -1
  579. comx792 compare 0 Inf -> -1
  580. comx793 compare 1 Inf -> -1
  581. comx794 compare 1000 Inf -> -1
  582. comx795 compare Inf Inf -> 0
  583. comx800 compare -Inf -Inf -> 0
  584. comx801 compare -Inf -1000 -> -1
  585. comx802 compare -Inf -1 -> -1
  586. comx803 compare -Inf -0 -> -1
  587. comx804 compare -Inf 0 -> -1
  588. comx805 compare -Inf 1 -> -1
  589. comx806 compare -Inf 1000 -> -1
  590. comx807 compare -Inf Inf -> -1
  591. comx808 compare -Inf -Inf -> 0
  592. comx809 compare -1000 -Inf -> 1
  593. comx810 compare -1 -Inf -> 1
  594. comx811 compare -0 -Inf -> 1
  595. comx812 compare 0 -Inf -> 1
  596. comx813 compare 1 -Inf -> 1
  597. comx814 compare 1000 -Inf -> 1
  598. comx815 compare Inf -Inf -> 1
  599. comx821 compare NaN -Inf -> NaN
  600. comx822 compare NaN -1000 -> NaN
  601. comx823 compare NaN -1 -> NaN
  602. comx824 compare NaN -0 -> NaN
  603. comx825 compare NaN 0 -> NaN
  604. comx826 compare NaN 1 -> NaN
  605. comx827 compare NaN 1000 -> NaN
  606. comx828 compare NaN Inf -> NaN
  607. comx829 compare NaN NaN -> NaN
  608. comx830 compare -Inf NaN -> NaN
  609. comx831 compare -1000 NaN -> NaN
  610. comx832 compare -1 NaN -> NaN
  611. comx833 compare -0 NaN -> NaN
  612. comx834 compare 0 NaN -> NaN
  613. comx835 compare 1 NaN -> NaN
  614. comx836 compare 1000 NaN -> NaN
  615. comx837 compare Inf NaN -> NaN
  616. comx838 compare -NaN -NaN -> -NaN
  617. comx839 compare +NaN -NaN -> NaN
  618. comx840 compare -NaN +NaN -> -NaN
  619. comx841 compare sNaN -Inf -> NaN Invalid_operation
  620. comx842 compare sNaN -1000 -> NaN Invalid_operation
  621. comx843 compare sNaN -1 -> NaN Invalid_operation
  622. comx844 compare sNaN -0 -> NaN Invalid_operation
  623. comx845 compare sNaN 0 -> NaN Invalid_operation
  624. comx846 compare sNaN 1 -> NaN Invalid_operation
  625. comx847 compare sNaN 1000 -> NaN Invalid_operation
  626. comx848 compare sNaN NaN -> NaN Invalid_operation
  627. comx849 compare sNaN sNaN -> NaN Invalid_operation
  628. comx850 compare NaN sNaN -> NaN Invalid_operation
  629. comx851 compare -Inf sNaN -> NaN Invalid_operation
  630. comx852 compare -1000 sNaN -> NaN Invalid_operation
  631. comx853 compare -1 sNaN -> NaN Invalid_operation
  632. comx854 compare -0 sNaN -> NaN Invalid_operation
  633. comx855 compare 0 sNaN -> NaN Invalid_operation
  634. comx856 compare 1 sNaN -> NaN Invalid_operation
  635. comx857 compare 1000 sNaN -> NaN Invalid_operation
  636. comx858 compare Inf sNaN -> NaN Invalid_operation
  637. comx859 compare NaN sNaN -> NaN Invalid_operation
  638. -- propagating NaNs
  639. comx860 compare NaN9 -Inf -> NaN9
  640. comx861 compare NaN8 999 -> NaN8
  641. comx862 compare NaN77 Inf -> NaN77
  642. comx863 compare -NaN67 NaN5 -> -NaN67
  643. comx864 compare -Inf -NaN4 -> -NaN4
  644. comx865 compare -999 -NaN33 -> -NaN33
  645. comx866 compare Inf NaN2 -> NaN2
  646. comx867 compare -NaN41 -NaN42 -> -NaN41
  647. comx868 compare +NaN41 -NaN42 -> NaN41
  648. comx869 compare -NaN41 +NaN42 -> -NaN41
  649. comx870 compare +NaN41 +NaN42 -> NaN41
  650. comx871 compare -sNaN99 -Inf -> -NaN99 Invalid_operation
  651. comx872 compare sNaN98 -11 -> NaN98 Invalid_operation
  652. comx873 compare sNaN97 NaN -> NaN97 Invalid_operation
  653. comx874 compare sNaN16 sNaN94 -> NaN16 Invalid_operation
  654. comx875 compare NaN85 sNaN83 -> NaN83 Invalid_operation
  655. comx876 compare -Inf sNaN92 -> NaN92 Invalid_operation
  656. comx877 compare 088 sNaN81 -> NaN81 Invalid_operation
  657. comx878 compare Inf sNaN90 -> NaN90 Invalid_operation
  658. comx879 compare NaN -sNaN89 -> -NaN89 Invalid_operation
  659. -- overflow and underflow tests .. subnormal results now allowed
  660. maxExponent: 999999999
  661. minexponent: -999999999
  662. comx880 compare +1.23456789012345E-0 9E+999999999 -> -1
  663. comx881 compare 9E+999999999 +1.23456789012345E-0 -> 1
  664. comx882 compare +0.100 9E-999999999 -> 1
  665. comx883 compare 9E-999999999 +0.100 -> -1
  666. comx885 compare -1.23456789012345E-0 9E+999999999 -> -1
  667. comx886 compare 9E+999999999 -1.23456789012345E-0 -> 1
  668. comx887 compare -0.100 9E-999999999 -> -1
  669. comx888 compare 9E-999999999 -0.100 -> 1
  670. comx889 compare 1e-599999999 1e-400000001 -> -1
  671. comx890 compare 1e-599999999 1e-400000000 -> -1
  672. comx891 compare 1e-600000000 1e-400000000 -> -1
  673. comx892 compare 9e-999999998 0.01 -> -1
  674. comx893 compare 9e-999999998 0.1 -> -1
  675. comx894 compare 0.01 9e-999999998 -> 1
  676. comx895 compare 1e599999999 1e400000001 -> 1
  677. comx896 compare 1e599999999 1e400000000 -> 1
  678. comx897 compare 1e600000000 1e400000000 -> 1
  679. comx898 compare 9e999999998 100 -> 1
  680. comx899 compare 9e999999998 10 -> 1
  681. comx900 compare 100 9e999999998 -> -1
  682. -- signs
  683. comx901 compare 1e+777777777 1e+411111111 -> 1
  684. comx902 compare 1e+777777777 -1e+411111111 -> 1
  685. comx903 compare -1e+777777777 1e+411111111 -> -1
  686. comx904 compare -1e+777777777 -1e+411111111 -> -1
  687. comx905 compare 1e-777777777 1e-411111111 -> -1
  688. comx906 compare 1e-777777777 -1e-411111111 -> 1
  689. comx907 compare -1e-777777777 1e-411111111 -> -1
  690. comx908 compare -1e-777777777 -1e-411111111 -> 1
  691. -- spread zeros
  692. comx910 compare 0E-383 0 -> 0
  693. comx911 compare 0E-383 -0 -> 0
  694. comx912 compare -0E-383 0 -> 0
  695. comx913 compare -0E-383 -0 -> 0
  696. comx914 compare 0E-383 0E+384 -> 0
  697. comx915 compare 0E-383 -0E+384 -> 0
  698. comx916 compare -0E-383 0E+384 -> 0
  699. comx917 compare -0E-383 -0E+384 -> 0
  700. comx918 compare 0 0E+384 -> 0
  701. comx919 compare 0 -0E+384 -> 0
  702. comx920 compare -0 0E+384 -> 0
  703. comx921 compare -0 -0E+384 -> 0
  704. comx930 compare 0E+384 0 -> 0
  705. comx931 compare 0E+384 -0 -> 0
  706. comx932 compare -0E+384 0 -> 0
  707. comx933 compare -0E+384 -0 -> 0
  708. comx934 compare 0E+384 0E-383 -> 0
  709. comx935 compare 0E+384 -0E-383 -> 0
  710. comx936 compare -0E+384 0E-383 -> 0
  711. comx937 compare -0E+384 -0E-383 -> 0
  712. comx938 compare 0 0E-383 -> 0
  713. comx939 compare 0 -0E-383 -> 0
  714. comx940 compare -0 0E-383 -> 0
  715. comx941 compare -0 -0E-383 -> 0
  716. -- Null tests
  717. comx990 compare 10 # -> NaN Invalid_operation
  718. comx991 compare # 10 -> NaN Invalid_operation