dqCompare.decTest 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. ------------------------------------------------------------------------
  2. -- dqCompare.decTest -- decQuad 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. -- All operands and results are decQuads.
  25. extended: 1
  26. clamp: 1
  27. precision: 34
  28. maxExponent: 6144
  29. minExponent: -6143
  30. rounding: half_even
  31. -- sanity checks
  32. dqcom001 compare -2 -2 -> 0
  33. dqcom002 compare -2 -1 -> -1
  34. dqcom003 compare -2 0 -> -1
  35. dqcom004 compare -2 1 -> -1
  36. dqcom005 compare -2 2 -> -1
  37. dqcom006 compare -1 -2 -> 1
  38. dqcom007 compare -1 -1 -> 0
  39. dqcom008 compare -1 0 -> -1
  40. dqcom009 compare -1 1 -> -1
  41. dqcom010 compare -1 2 -> -1
  42. dqcom011 compare 0 -2 -> 1
  43. dqcom012 compare 0 -1 -> 1
  44. dqcom013 compare 0 0 -> 0
  45. dqcom014 compare 0 1 -> -1
  46. dqcom015 compare 0 2 -> -1
  47. dqcom016 compare 1 -2 -> 1
  48. dqcom017 compare 1 -1 -> 1
  49. dqcom018 compare 1 0 -> 1
  50. dqcom019 compare 1 1 -> 0
  51. dqcom020 compare 1 2 -> -1
  52. dqcom021 compare 2 -2 -> 1
  53. dqcom022 compare 2 -1 -> 1
  54. dqcom023 compare 2 0 -> 1
  55. dqcom025 compare 2 1 -> 1
  56. dqcom026 compare 2 2 -> 0
  57. dqcom031 compare -20 -20 -> 0
  58. dqcom032 compare -20 -10 -> -1
  59. dqcom033 compare -20 00 -> -1
  60. dqcom034 compare -20 10 -> -1
  61. dqcom035 compare -20 20 -> -1
  62. dqcom036 compare -10 -20 -> 1
  63. dqcom037 compare -10 -10 -> 0
  64. dqcom038 compare -10 00 -> -1
  65. dqcom039 compare -10 10 -> -1
  66. dqcom040 compare -10 20 -> -1
  67. dqcom041 compare 00 -20 -> 1
  68. dqcom042 compare 00 -10 -> 1
  69. dqcom043 compare 00 00 -> 0
  70. dqcom044 compare 00 10 -> -1
  71. dqcom045 compare 00 20 -> -1
  72. dqcom046 compare 10 -20 -> 1
  73. dqcom047 compare 10 -10 -> 1
  74. dqcom048 compare 10 00 -> 1
  75. dqcom049 compare 10 10 -> 0
  76. dqcom050 compare 10 20 -> -1
  77. dqcom051 compare 20 -20 -> 1
  78. dqcom052 compare 20 -10 -> 1
  79. dqcom053 compare 20 00 -> 1
  80. dqcom055 compare 20 10 -> 1
  81. dqcom056 compare 20 20 -> 0
  82. dqcom061 compare -2.0 -2.0 -> 0
  83. dqcom062 compare -2.0 -1.0 -> -1
  84. dqcom063 compare -2.0 0.0 -> -1
  85. dqcom064 compare -2.0 1.0 -> -1
  86. dqcom065 compare -2.0 2.0 -> -1
  87. dqcom066 compare -1.0 -2.0 -> 1
  88. dqcom067 compare -1.0 -1.0 -> 0
  89. dqcom068 compare -1.0 0.0 -> -1
  90. dqcom069 compare -1.0 1.0 -> -1
  91. dqcom070 compare -1.0 2.0 -> -1
  92. dqcom071 compare 0.0 -2.0 -> 1
  93. dqcom072 compare 0.0 -1.0 -> 1
  94. dqcom073 compare 0.0 0.0 -> 0
  95. dqcom074 compare 0.0 1.0 -> -1
  96. dqcom075 compare 0.0 2.0 -> -1
  97. dqcom076 compare 1.0 -2.0 -> 1
  98. dqcom077 compare 1.0 -1.0 -> 1
  99. dqcom078 compare 1.0 0.0 -> 1
  100. dqcom079 compare 1.0 1.0 -> 0
  101. dqcom080 compare 1.0 2.0 -> -1
  102. dqcom081 compare 2.0 -2.0 -> 1
  103. dqcom082 compare 2.0 -1.0 -> 1
  104. dqcom083 compare 2.0 0.0 -> 1
  105. dqcom085 compare 2.0 1.0 -> 1
  106. dqcom086 compare 2.0 2.0 -> 0
  107. -- now some cases which might overflow if subtract were used
  108. dqcom090 compare 9.999999999999999999999999999999999E+6144 9.999999999999999999999999999999999E+6144 -> 0
  109. dqcom091 compare -9.999999999999999999999999999999999E+6144 9.999999999999999999999999999999999E+6144 -> -1
  110. dqcom092 compare 9.999999999999999999999999999999999E+6144 -9.999999999999999999999999999999999E+6144 -> 1
  111. dqcom093 compare -9.999999999999999999999999999999999E+6144 -9.999999999999999999999999999999999E+6144 -> 0
  112. -- some differing length/exponent cases
  113. dqcom100 compare 7.0 7.0 -> 0
  114. dqcom101 compare 7.0 7 -> 0
  115. dqcom102 compare 7 7.0 -> 0
  116. dqcom103 compare 7E+0 7.0 -> 0
  117. dqcom104 compare 70E-1 7.0 -> 0
  118. dqcom105 compare 0.7E+1 7 -> 0
  119. dqcom106 compare 70E-1 7 -> 0
  120. dqcom107 compare 7.0 7E+0 -> 0
  121. dqcom108 compare 7.0 70E-1 -> 0
  122. dqcom109 compare 7 0.7E+1 -> 0
  123. dqcom110 compare 7 70E-1 -> 0
  124. dqcom120 compare 8.0 7.0 -> 1
  125. dqcom121 compare 8.0 7 -> 1
  126. dqcom122 compare 8 7.0 -> 1
  127. dqcom123 compare 8E+0 7.0 -> 1
  128. dqcom124 compare 80E-1 7.0 -> 1
  129. dqcom125 compare 0.8E+1 7 -> 1
  130. dqcom126 compare 80E-1 7 -> 1
  131. dqcom127 compare 8.0 7E+0 -> 1
  132. dqcom128 compare 8.0 70E-1 -> 1
  133. dqcom129 compare 8 0.7E+1 -> 1
  134. dqcom130 compare 8 70E-1 -> 1
  135. dqcom140 compare 8.0 9.0 -> -1
  136. dqcom141 compare 8.0 9 -> -1
  137. dqcom142 compare 8 9.0 -> -1
  138. dqcom143 compare 8E+0 9.0 -> -1
  139. dqcom144 compare 80E-1 9.0 -> -1
  140. dqcom145 compare 0.8E+1 9 -> -1
  141. dqcom146 compare 80E-1 9 -> -1
  142. dqcom147 compare 8.0 9E+0 -> -1
  143. dqcom148 compare 8.0 90E-1 -> -1
  144. dqcom149 compare 8 0.9E+1 -> -1
  145. dqcom150 compare 8 90E-1 -> -1
  146. -- and again, with sign changes -+ ..
  147. dqcom200 compare -7.0 7.0 -> -1
  148. dqcom201 compare -7.0 7 -> -1
  149. dqcom202 compare -7 7.0 -> -1
  150. dqcom203 compare -7E+0 7.0 -> -1
  151. dqcom204 compare -70E-1 7.0 -> -1
  152. dqcom205 compare -0.7E+1 7 -> -1
  153. dqcom206 compare -70E-1 7 -> -1
  154. dqcom207 compare -7.0 7E+0 -> -1
  155. dqcom208 compare -7.0 70E-1 -> -1
  156. dqcom209 compare -7 0.7E+1 -> -1
  157. dqcom210 compare -7 70E-1 -> -1
  158. dqcom220 compare -8.0 7.0 -> -1
  159. dqcom221 compare -8.0 7 -> -1
  160. dqcom222 compare -8 7.0 -> -1
  161. dqcom223 compare -8E+0 7.0 -> -1
  162. dqcom224 compare -80E-1 7.0 -> -1
  163. dqcom225 compare -0.8E+1 7 -> -1
  164. dqcom226 compare -80E-1 7 -> -1
  165. dqcom227 compare -8.0 7E+0 -> -1
  166. dqcom228 compare -8.0 70E-1 -> -1
  167. dqcom229 compare -8 0.7E+1 -> -1
  168. dqcom230 compare -8 70E-1 -> -1
  169. dqcom240 compare -8.0 9.0 -> -1
  170. dqcom241 compare -8.0 9 -> -1
  171. dqcom242 compare -8 9.0 -> -1
  172. dqcom243 compare -8E+0 9.0 -> -1
  173. dqcom244 compare -80E-1 9.0 -> -1
  174. dqcom245 compare -0.8E+1 9 -> -1
  175. dqcom246 compare -80E-1 9 -> -1
  176. dqcom247 compare -8.0 9E+0 -> -1
  177. dqcom248 compare -8.0 90E-1 -> -1
  178. dqcom249 compare -8 0.9E+1 -> -1
  179. dqcom250 compare -8 90E-1 -> -1
  180. -- and again, with sign changes +- ..
  181. dqcom300 compare 7.0 -7.0 -> 1
  182. dqcom301 compare 7.0 -7 -> 1
  183. dqcom302 compare 7 -7.0 -> 1
  184. dqcom303 compare 7E+0 -7.0 -> 1
  185. dqcom304 compare 70E-1 -7.0 -> 1
  186. dqcom305 compare .7E+1 -7 -> 1
  187. dqcom306 compare 70E-1 -7 -> 1
  188. dqcom307 compare 7.0 -7E+0 -> 1
  189. dqcom308 compare 7.0 -70E-1 -> 1
  190. dqcom309 compare 7 -.7E+1 -> 1
  191. dqcom310 compare 7 -70E-1 -> 1
  192. dqcom320 compare 8.0 -7.0 -> 1
  193. dqcom321 compare 8.0 -7 -> 1
  194. dqcom322 compare 8 -7.0 -> 1
  195. dqcom323 compare 8E+0 -7.0 -> 1
  196. dqcom324 compare 80E-1 -7.0 -> 1
  197. dqcom325 compare .8E+1 -7 -> 1
  198. dqcom326 compare 80E-1 -7 -> 1
  199. dqcom327 compare 8.0 -7E+0 -> 1
  200. dqcom328 compare 8.0 -70E-1 -> 1
  201. dqcom329 compare 8 -.7E+1 -> 1
  202. dqcom330 compare 8 -70E-1 -> 1
  203. dqcom340 compare 8.0 -9.0 -> 1
  204. dqcom341 compare 8.0 -9 -> 1
  205. dqcom342 compare 8 -9.0 -> 1
  206. dqcom343 compare 8E+0 -9.0 -> 1
  207. dqcom344 compare 80E-1 -9.0 -> 1
  208. dqcom345 compare .8E+1 -9 -> 1
  209. dqcom346 compare 80E-1 -9 -> 1
  210. dqcom347 compare 8.0 -9E+0 -> 1
  211. dqcom348 compare 8.0 -90E-1 -> 1
  212. dqcom349 compare 8 -.9E+1 -> 1
  213. dqcom350 compare 8 -90E-1 -> 1
  214. -- and again, with sign changes -- ..
  215. dqcom400 compare -7.0 -7.0 -> 0
  216. dqcom401 compare -7.0 -7 -> 0
  217. dqcom402 compare -7 -7.0 -> 0
  218. dqcom403 compare -7E+0 -7.0 -> 0
  219. dqcom404 compare -70E-1 -7.0 -> 0
  220. dqcom405 compare -.7E+1 -7 -> 0
  221. dqcom406 compare -70E-1 -7 -> 0
  222. dqcom407 compare -7.0 -7E+0 -> 0
  223. dqcom408 compare -7.0 -70E-1 -> 0
  224. dqcom409 compare -7 -.7E+1 -> 0
  225. dqcom410 compare -7 -70E-1 -> 0
  226. dqcom420 compare -8.0 -7.0 -> -1
  227. dqcom421 compare -8.0 -7 -> -1
  228. dqcom422 compare -8 -7.0 -> -1
  229. dqcom423 compare -8E+0 -7.0 -> -1
  230. dqcom424 compare -80E-1 -7.0 -> -1
  231. dqcom425 compare -.8E+1 -7 -> -1
  232. dqcom426 compare -80E-1 -7 -> -1
  233. dqcom427 compare -8.0 -7E+0 -> -1
  234. dqcom428 compare -8.0 -70E-1 -> -1
  235. dqcom429 compare -8 -.7E+1 -> -1
  236. dqcom430 compare -8 -70E-1 -> -1
  237. dqcom440 compare -8.0 -9.0 -> 1
  238. dqcom441 compare -8.0 -9 -> 1
  239. dqcom442 compare -8 -9.0 -> 1
  240. dqcom443 compare -8E+0 -9.0 -> 1
  241. dqcom444 compare -80E-1 -9.0 -> 1
  242. dqcom445 compare -.8E+1 -9 -> 1
  243. dqcom446 compare -80E-1 -9 -> 1
  244. dqcom447 compare -8.0 -9E+0 -> 1
  245. dqcom448 compare -8.0 -90E-1 -> 1
  246. dqcom449 compare -8 -.9E+1 -> 1
  247. dqcom450 compare -8 -90E-1 -> 1
  248. -- misalignment traps for little-endian
  249. dqcom451 compare 1.0 0.1 -> 1
  250. dqcom452 compare 0.1 1.0 -> -1
  251. dqcom453 compare 10.0 0.1 -> 1
  252. dqcom454 compare 0.1 10.0 -> -1
  253. dqcom455 compare 100 1.0 -> 1
  254. dqcom456 compare 1.0 100 -> -1
  255. dqcom457 compare 1000 10.0 -> 1
  256. dqcom458 compare 10.0 1000 -> -1
  257. dqcom459 compare 10000 100.0 -> 1
  258. dqcom460 compare 100.0 10000 -> -1
  259. dqcom461 compare 100000 1000.0 -> 1
  260. dqcom462 compare 1000.0 100000 -> -1
  261. dqcom463 compare 1000000 10000.0 -> 1
  262. dqcom464 compare 10000.0 1000000 -> -1
  263. -- testcases that subtract to lots of zeros at boundaries [pgr]
  264. dqcom473 compare 123.9999999999999999994560000000000E-89 123.999999999999999999456E-89 -> 0
  265. dqcom474 compare 123.999999999999999999456000000000E+89 123.999999999999999999456E+89 -> 0
  266. dqcom475 compare 123.99999999999999999945600000000E-89 123.999999999999999999456E-89 -> 0
  267. dqcom476 compare 123.9999999999999999994560000000E+89 123.999999999999999999456E+89 -> 0
  268. dqcom477 compare 123.999999999999999999456000000E-89 123.999999999999999999456E-89 -> 0
  269. dqcom478 compare 123.99999999999999999945600000E+89 123.999999999999999999456E+89 -> 0
  270. dqcom479 compare 123.9999999999999999994560000E-89 123.999999999999999999456E-89 -> 0
  271. dqcom480 compare 123.999999999999999999456000E+89 123.999999999999999999456E+89 -> 0
  272. dqcom481 compare 123.99999999999999999945600E-89 123.999999999999999999456E-89 -> 0
  273. dqcom482 compare 123.9999999999999999994560E+89 123.999999999999999999456E+89 -> 0
  274. dqcom483 compare 123.999999999999999999456E-89 123.999999999999999999456E-89 -> 0
  275. dqcom487 compare 123.999999999999999999456E+89 123.9999999999999999994560000000000E+89 -> 0
  276. dqcom488 compare 123.999999999999999999456E-89 123.999999999999999999456000000000E-89 -> 0
  277. dqcom489 compare 123.999999999999999999456E+89 123.99999999999999999945600000000E+89 -> 0
  278. dqcom490 compare 123.999999999999999999456E-89 123.9999999999999999994560000000E-89 -> 0
  279. dqcom491 compare 123.999999999999999999456E+89 123.999999999999999999456000000E+89 -> 0
  280. dqcom492 compare 123.999999999999999999456E-89 123.99999999999999999945600000E-89 -> 0
  281. dqcom493 compare 123.999999999999999999456E+89 123.9999999999999999994560000E+89 -> 0
  282. dqcom494 compare 123.999999999999999999456E-89 123.999999999999999999456000E-89 -> 0
  283. dqcom495 compare 123.999999999999999999456E+89 123.99999999999999999945600E+89 -> 0
  284. dqcom496 compare 123.999999999999999999456E-89 123.9999999999999999994560E-89 -> 0
  285. dqcom497 compare 123.999999999999999999456E+89 123.999999999999999999456E+89 -> 0
  286. -- wide-ranging, around precision; signs equal
  287. dqcom500 compare 1 1E-15 -> 1
  288. dqcom501 compare 1 1E-14 -> 1
  289. dqcom502 compare 1 1E-13 -> 1
  290. dqcom503 compare 1 1E-12 -> 1
  291. dqcom504 compare 1 1E-11 -> 1
  292. dqcom505 compare 1 1E-10 -> 1
  293. dqcom506 compare 1 1E-9 -> 1
  294. dqcom507 compare 1 1E-8 -> 1
  295. dqcom508 compare 1 1E-7 -> 1
  296. dqcom509 compare 1 1E-6 -> 1
  297. dqcom510 compare 1 1E-5 -> 1
  298. dqcom511 compare 1 1E-4 -> 1
  299. dqcom512 compare 1 1E-3 -> 1
  300. dqcom513 compare 1 1E-2 -> 1
  301. dqcom514 compare 1 1E-1 -> 1
  302. dqcom515 compare 1 1E-0 -> 0
  303. dqcom516 compare 1 1E+1 -> -1
  304. dqcom517 compare 1 1E+2 -> -1
  305. dqcom518 compare 1 1E+3 -> -1
  306. dqcom519 compare 1 1E+4 -> -1
  307. dqcom521 compare 1 1E+5 -> -1
  308. dqcom522 compare 1 1E+6 -> -1
  309. dqcom523 compare 1 1E+7 -> -1
  310. dqcom524 compare 1 1E+8 -> -1
  311. dqcom525 compare 1 1E+9 -> -1
  312. dqcom526 compare 1 1E+10 -> -1
  313. dqcom527 compare 1 1E+11 -> -1
  314. dqcom528 compare 1 1E+12 -> -1
  315. dqcom529 compare 1 1E+13 -> -1
  316. dqcom530 compare 1 1E+14 -> -1
  317. dqcom531 compare 1 1E+15 -> -1
  318. -- LR swap
  319. dqcom540 compare 1E-15 1 -> -1
  320. dqcom541 compare 1E-14 1 -> -1
  321. dqcom542 compare 1E-13 1 -> -1
  322. dqcom543 compare 1E-12 1 -> -1
  323. dqcom544 compare 1E-11 1 -> -1
  324. dqcom545 compare 1E-10 1 -> -1
  325. dqcom546 compare 1E-9 1 -> -1
  326. dqcom547 compare 1E-8 1 -> -1
  327. dqcom548 compare 1E-7 1 -> -1
  328. dqcom549 compare 1E-6 1 -> -1
  329. dqcom550 compare 1E-5 1 -> -1
  330. dqcom551 compare 1E-4 1 -> -1
  331. dqcom552 compare 1E-3 1 -> -1
  332. dqcom553 compare 1E-2 1 -> -1
  333. dqcom554 compare 1E-1 1 -> -1
  334. dqcom555 compare 1E-0 1 -> 0
  335. dqcom556 compare 1E+1 1 -> 1
  336. dqcom557 compare 1E+2 1 -> 1
  337. dqcom558 compare 1E+3 1 -> 1
  338. dqcom559 compare 1E+4 1 -> 1
  339. dqcom561 compare 1E+5 1 -> 1
  340. dqcom562 compare 1E+6 1 -> 1
  341. dqcom563 compare 1E+7 1 -> 1
  342. dqcom564 compare 1E+8 1 -> 1
  343. dqcom565 compare 1E+9 1 -> 1
  344. dqcom566 compare 1E+10 1 -> 1
  345. dqcom567 compare 1E+11 1 -> 1
  346. dqcom568 compare 1E+12 1 -> 1
  347. dqcom569 compare 1E+13 1 -> 1
  348. dqcom570 compare 1E+14 1 -> 1
  349. dqcom571 compare 1E+15 1 -> 1
  350. -- similar with a useful coefficient, one side only
  351. dqcom580 compare 0.000000987654321 1E-15 -> 1
  352. dqcom581 compare 0.000000987654321 1E-14 -> 1
  353. dqcom582 compare 0.000000987654321 1E-13 -> 1
  354. dqcom583 compare 0.000000987654321 1E-12 -> 1
  355. dqcom584 compare 0.000000987654321 1E-11 -> 1
  356. dqcom585 compare 0.000000987654321 1E-10 -> 1
  357. dqcom586 compare 0.000000987654321 1E-9 -> 1
  358. dqcom587 compare 0.000000987654321 1E-8 -> 1
  359. dqcom588 compare 0.000000987654321 1E-7 -> 1
  360. dqcom589 compare 0.000000987654321 1E-6 -> -1
  361. dqcom590 compare 0.000000987654321 1E-5 -> -1
  362. dqcom591 compare 0.000000987654321 1E-4 -> -1
  363. dqcom592 compare 0.000000987654321 1E-3 -> -1
  364. dqcom593 compare 0.000000987654321 1E-2 -> -1
  365. dqcom594 compare 0.000000987654321 1E-1 -> -1
  366. dqcom595 compare 0.000000987654321 1E-0 -> -1
  367. dqcom596 compare 0.000000987654321 1E+1 -> -1
  368. dqcom597 compare 0.000000987654321 1E+2 -> -1
  369. dqcom598 compare 0.000000987654321 1E+3 -> -1
  370. dqcom599 compare 0.000000987654321 1E+4 -> -1
  371. -- check some unit-y traps
  372. dqcom600 compare 12 12.2345 -> -1
  373. dqcom601 compare 12.0 12.2345 -> -1
  374. dqcom602 compare 12.00 12.2345 -> -1
  375. dqcom603 compare 12.000 12.2345 -> -1
  376. dqcom604 compare 12.0000 12.2345 -> -1
  377. dqcom605 compare 12.00000 12.2345 -> -1
  378. dqcom606 compare 12.000000 12.2345 -> -1
  379. dqcom607 compare 12.0000000 12.2345 -> -1
  380. dqcom608 compare 12.00000000 12.2345 -> -1
  381. dqcom609 compare 12.000000000 12.2345 -> -1
  382. dqcom610 compare 12.1234 12 -> 1
  383. dqcom611 compare 12.1234 12.0 -> 1
  384. dqcom612 compare 12.1234 12.00 -> 1
  385. dqcom613 compare 12.1234 12.000 -> 1
  386. dqcom614 compare 12.1234 12.0000 -> 1
  387. dqcom615 compare 12.1234 12.00000 -> 1
  388. dqcom616 compare 12.1234 12.000000 -> 1
  389. dqcom617 compare 12.1234 12.0000000 -> 1
  390. dqcom618 compare 12.1234 12.00000000 -> 1
  391. dqcom619 compare 12.1234 12.000000000 -> 1
  392. dqcom620 compare -12 -12.2345 -> 1
  393. dqcom621 compare -12.0 -12.2345 -> 1
  394. dqcom622 compare -12.00 -12.2345 -> 1
  395. dqcom623 compare -12.000 -12.2345 -> 1
  396. dqcom624 compare -12.0000 -12.2345 -> 1
  397. dqcom625 compare -12.00000 -12.2345 -> 1
  398. dqcom626 compare -12.000000 -12.2345 -> 1
  399. dqcom627 compare -12.0000000 -12.2345 -> 1
  400. dqcom628 compare -12.00000000 -12.2345 -> 1
  401. dqcom629 compare -12.000000000 -12.2345 -> 1
  402. dqcom630 compare -12.1234 -12 -> -1
  403. dqcom631 compare -12.1234 -12.0 -> -1
  404. dqcom632 compare -12.1234 -12.00 -> -1
  405. dqcom633 compare -12.1234 -12.000 -> -1
  406. dqcom634 compare -12.1234 -12.0000 -> -1
  407. dqcom635 compare -12.1234 -12.00000 -> -1
  408. dqcom636 compare -12.1234 -12.000000 -> -1
  409. dqcom637 compare -12.1234 -12.0000000 -> -1
  410. dqcom638 compare -12.1234 -12.00000000 -> -1
  411. dqcom639 compare -12.1234 -12.000000000 -> -1
  412. -- extended zeros
  413. dqcom640 compare 0 0 -> 0
  414. dqcom641 compare 0 -0 -> 0
  415. dqcom642 compare 0 -0.0 -> 0
  416. dqcom643 compare 0 0.0 -> 0
  417. dqcom644 compare -0 0 -> 0
  418. dqcom645 compare -0 -0 -> 0
  419. dqcom646 compare -0 -0.0 -> 0
  420. dqcom647 compare -0 0.0 -> 0
  421. dqcom648 compare 0.0 0 -> 0
  422. dqcom649 compare 0.0 -0 -> 0
  423. dqcom650 compare 0.0 -0.0 -> 0
  424. dqcom651 compare 0.0 0.0 -> 0
  425. dqcom652 compare -0.0 0 -> 0
  426. dqcom653 compare -0.0 -0 -> 0
  427. dqcom654 compare -0.0 -0.0 -> 0
  428. dqcom655 compare -0.0 0.0 -> 0
  429. dqcom656 compare -0E1 0.0 -> 0
  430. dqcom657 compare -0E2 0.0 -> 0
  431. dqcom658 compare 0E1 0.0 -> 0
  432. dqcom659 compare 0E2 0.0 -> 0
  433. dqcom660 compare -0E1 0 -> 0
  434. dqcom661 compare -0E2 0 -> 0
  435. dqcom662 compare 0E1 0 -> 0
  436. dqcom663 compare 0E2 0 -> 0
  437. dqcom664 compare -0E1 -0E1 -> 0
  438. dqcom665 compare -0E2 -0E1 -> 0
  439. dqcom666 compare 0E1 -0E1 -> 0
  440. dqcom667 compare 0E2 -0E1 -> 0
  441. dqcom668 compare -0E1 -0E2 -> 0
  442. dqcom669 compare -0E2 -0E2 -> 0
  443. dqcom670 compare 0E1 -0E2 -> 0
  444. dqcom671 compare 0E2 -0E2 -> 0
  445. dqcom672 compare -0E1 0E1 -> 0
  446. dqcom673 compare -0E2 0E1 -> 0
  447. dqcom674 compare 0E1 0E1 -> 0
  448. dqcom675 compare 0E2 0E1 -> 0
  449. dqcom676 compare -0E1 0E2 -> 0
  450. dqcom677 compare -0E2 0E2 -> 0
  451. dqcom678 compare 0E1 0E2 -> 0
  452. dqcom679 compare 0E2 0E2 -> 0
  453. -- trailing zeros; unit-y
  454. dqcom680 compare 12 12 -> 0
  455. dqcom681 compare 12 12.0 -> 0
  456. dqcom682 compare 12 12.00 -> 0
  457. dqcom683 compare 12 12.000 -> 0
  458. dqcom684 compare 12 12.0000 -> 0
  459. dqcom685 compare 12 12.00000 -> 0
  460. dqcom686 compare 12 12.000000 -> 0
  461. dqcom687 compare 12 12.0000000 -> 0
  462. dqcom688 compare 12 12.00000000 -> 0
  463. dqcom689 compare 12 12.000000000 -> 0
  464. dqcom690 compare 12 12 -> 0
  465. dqcom691 compare 12.0 12 -> 0
  466. dqcom692 compare 12.00 12 -> 0
  467. dqcom693 compare 12.000 12 -> 0
  468. dqcom694 compare 12.0000 12 -> 0
  469. dqcom695 compare 12.00000 12 -> 0
  470. dqcom696 compare 12.000000 12 -> 0
  471. dqcom697 compare 12.0000000 12 -> 0
  472. dqcom698 compare 12.00000000 12 -> 0
  473. dqcom699 compare 12.000000000 12 -> 0
  474. -- first, second, & last digit
  475. dqcom700 compare 1234567899999999999999999990123456 1234567899999999999999999990123455 -> 1
  476. dqcom701 compare 1234567899999999999999999990123456 1234567899999999999999999990123456 -> 0
  477. dqcom702 compare 1234567899999999999999999990123456 1234567899999999999999999990123457 -> -1
  478. dqcom703 compare 1234567899999999999999999990123456 0234567899999999999999999990123456 -> 1
  479. dqcom704 compare 1234567899999999999999999990123456 1234567899999999999999999990123456 -> 0
  480. dqcom705 compare 1234567899999999999999999990123456 2234567899999999999999999990123456 -> -1
  481. dqcom706 compare 1134567899999999999999999990123456 1034567899999999999999999990123456 -> 1
  482. dqcom707 compare 1134567899999999999999999990123456 1134567899999999999999999990123456 -> 0
  483. dqcom708 compare 1134567899999999999999999990123456 1234567899999999999999999990123456 -> -1
  484. -- miscellaneous
  485. dqcom721 compare 12345678000 1 -> 1
  486. dqcom722 compare 1 12345678000 -> -1
  487. dqcom723 compare 1234567800 1 -> 1
  488. dqcom724 compare 1 1234567800 -> -1
  489. dqcom725 compare 1234567890 1 -> 1
  490. dqcom726 compare 1 1234567890 -> -1
  491. dqcom727 compare 1234567891 1 -> 1
  492. dqcom728 compare 1 1234567891 -> -1
  493. dqcom729 compare 12345678901 1 -> 1
  494. dqcom730 compare 1 12345678901 -> -1
  495. dqcom731 compare 1234567896 1 -> 1
  496. dqcom732 compare 1 1234567896 -> -1
  497. -- residue cases at lower precision
  498. dqcom740 compare 1 0.9999999 -> 1
  499. dqcom741 compare 1 0.999999 -> 1
  500. dqcom742 compare 1 0.99999 -> 1
  501. dqcom743 compare 1 1.0000 -> 0
  502. dqcom744 compare 1 1.00001 -> -1
  503. dqcom745 compare 1 1.000001 -> -1
  504. dqcom746 compare 1 1.0000001 -> -1
  505. dqcom750 compare 0.9999999 1 -> -1
  506. dqcom751 compare 0.999999 1 -> -1
  507. dqcom752 compare 0.99999 1 -> -1
  508. dqcom753 compare 1.0000 1 -> 0
  509. dqcom754 compare 1.00001 1 -> 1
  510. dqcom755 compare 1.000001 1 -> 1
  511. dqcom756 compare 1.0000001 1 -> 1
  512. -- Specials
  513. dqcom780 compare Inf -Inf -> 1
  514. dqcom781 compare Inf -1000 -> 1
  515. dqcom782 compare Inf -1 -> 1
  516. dqcom783 compare Inf -0 -> 1
  517. dqcom784 compare Inf 0 -> 1
  518. dqcom785 compare Inf 1 -> 1
  519. dqcom786 compare Inf 1000 -> 1
  520. dqcom787 compare Inf Inf -> 0
  521. dqcom788 compare -1000 Inf -> -1
  522. dqcom789 compare -Inf Inf -> -1
  523. dqcom790 compare -1 Inf -> -1
  524. dqcom791 compare -0 Inf -> -1
  525. dqcom792 compare 0 Inf -> -1
  526. dqcom793 compare 1 Inf -> -1
  527. dqcom794 compare 1000 Inf -> -1
  528. dqcom795 compare Inf Inf -> 0
  529. dqcom800 compare -Inf -Inf -> 0
  530. dqcom801 compare -Inf -1000 -> -1
  531. dqcom802 compare -Inf -1 -> -1
  532. dqcom803 compare -Inf -0 -> -1
  533. dqcom804 compare -Inf 0 -> -1
  534. dqcom805 compare -Inf 1 -> -1
  535. dqcom806 compare -Inf 1000 -> -1
  536. dqcom807 compare -Inf Inf -> -1
  537. dqcom808 compare -Inf -Inf -> 0
  538. dqcom809 compare -1000 -Inf -> 1
  539. dqcom810 compare -1 -Inf -> 1
  540. dqcom811 compare -0 -Inf -> 1
  541. dqcom812 compare 0 -Inf -> 1
  542. dqcom813 compare 1 -Inf -> 1
  543. dqcom814 compare 1000 -Inf -> 1
  544. dqcom815 compare Inf -Inf -> 1
  545. dqcom821 compare NaN -Inf -> NaN
  546. dqcom822 compare NaN -1000 -> NaN
  547. dqcom823 compare NaN -1 -> NaN
  548. dqcom824 compare NaN -0 -> NaN
  549. dqcom825 compare NaN 0 -> NaN
  550. dqcom826 compare NaN 1 -> NaN
  551. dqcom827 compare NaN 1000 -> NaN
  552. dqcom828 compare NaN Inf -> NaN
  553. dqcom829 compare NaN NaN -> NaN
  554. dqcom830 compare -Inf NaN -> NaN
  555. dqcom831 compare -1000 NaN -> NaN
  556. dqcom832 compare -1 NaN -> NaN
  557. dqcom833 compare -0 NaN -> NaN
  558. dqcom834 compare 0 NaN -> NaN
  559. dqcom835 compare 1 NaN -> NaN
  560. dqcom836 compare 1000 NaN -> NaN
  561. dqcom837 compare Inf NaN -> NaN
  562. dqcom838 compare -NaN -NaN -> -NaN
  563. dqcom839 compare +NaN -NaN -> NaN
  564. dqcom840 compare -NaN +NaN -> -NaN
  565. dqcom841 compare sNaN -Inf -> NaN Invalid_operation
  566. dqcom842 compare sNaN -1000 -> NaN Invalid_operation
  567. dqcom843 compare sNaN -1 -> NaN Invalid_operation
  568. dqcom844 compare sNaN -0 -> NaN Invalid_operation
  569. dqcom845 compare sNaN 0 -> NaN Invalid_operation
  570. dqcom846 compare sNaN 1 -> NaN Invalid_operation
  571. dqcom847 compare sNaN 1000 -> NaN Invalid_operation
  572. dqcom848 compare sNaN NaN -> NaN Invalid_operation
  573. dqcom849 compare sNaN sNaN -> NaN Invalid_operation
  574. dqcom850 compare NaN sNaN -> NaN Invalid_operation
  575. dqcom851 compare -Inf sNaN -> NaN Invalid_operation
  576. dqcom852 compare -1000 sNaN -> NaN Invalid_operation
  577. dqcom853 compare -1 sNaN -> NaN Invalid_operation
  578. dqcom854 compare -0 sNaN -> NaN Invalid_operation
  579. dqcom855 compare 0 sNaN -> NaN Invalid_operation
  580. dqcom856 compare 1 sNaN -> NaN Invalid_operation
  581. dqcom857 compare 1000 sNaN -> NaN Invalid_operation
  582. dqcom858 compare Inf sNaN -> NaN Invalid_operation
  583. dqcom859 compare NaN sNaN -> NaN Invalid_operation
  584. -- propagating NaNs
  585. dqcom860 compare NaN9 -Inf -> NaN9
  586. dqcom861 compare NaN8 999 -> NaN8
  587. dqcom862 compare NaN77 Inf -> NaN77
  588. dqcom863 compare -NaN67 NaN5 -> -NaN67
  589. dqcom864 compare -Inf -NaN4 -> -NaN4
  590. dqcom865 compare -999 -NaN33 -> -NaN33
  591. dqcom866 compare Inf NaN2 -> NaN2
  592. dqcom867 compare -NaN41 -NaN42 -> -NaN41
  593. dqcom868 compare +NaN41 -NaN42 -> NaN41
  594. dqcom869 compare -NaN41 +NaN42 -> -NaN41
  595. dqcom870 compare +NaN41 +NaN42 -> NaN41
  596. dqcom871 compare -sNaN99 -Inf -> -NaN99 Invalid_operation
  597. dqcom872 compare sNaN98 -11 -> NaN98 Invalid_operation
  598. dqcom873 compare sNaN97 NaN -> NaN97 Invalid_operation
  599. dqcom874 compare sNaN16 sNaN94 -> NaN16 Invalid_operation
  600. dqcom875 compare NaN85 sNaN83 -> NaN83 Invalid_operation
  601. dqcom876 compare -Inf sNaN92 -> NaN92 Invalid_operation
  602. dqcom877 compare 088 sNaN81 -> NaN81 Invalid_operation
  603. dqcom878 compare Inf sNaN90 -> NaN90 Invalid_operation
  604. dqcom879 compare NaN -sNaN89 -> -NaN89 Invalid_operation
  605. -- wide range
  606. dqcom880 compare +1.23456789012345E-0 9E+6144 -> -1
  607. dqcom881 compare 9E+6144 +1.23456789012345E-0 -> 1
  608. dqcom882 compare +0.100 9E-6143 -> 1
  609. dqcom883 compare 9E-6143 +0.100 -> -1
  610. dqcom885 compare -1.23456789012345E-0 9E+6144 -> -1
  611. dqcom886 compare 9E+6144 -1.23456789012345E-0 -> 1
  612. dqcom887 compare -0.100 9E-6143 -> -1
  613. dqcom888 compare 9E-6143 -0.100 -> 1
  614. -- signs
  615. dqcom901 compare 1e+77 1e+11 -> 1
  616. dqcom902 compare 1e+77 -1e+11 -> 1
  617. dqcom903 compare -1e+77 1e+11 -> -1
  618. dqcom904 compare -1e+77 -1e+11 -> -1
  619. dqcom905 compare 1e-77 1e-11 -> -1
  620. dqcom906 compare 1e-77 -1e-11 -> 1
  621. dqcom907 compare -1e-77 1e-11 -> -1
  622. dqcom908 compare -1e-77 -1e-11 -> 1
  623. -- full alignment range, both ways
  624. dqcomp1001 compare 1 1.000000000000000000000000000000000 -> 0
  625. dqcomp1002 compare 1 1.00000000000000000000000000000000 -> 0
  626. dqcomp1003 compare 1 1.0000000000000000000000000000000 -> 0
  627. dqcomp1004 compare 1 1.000000000000000000000000000000 -> 0
  628. dqcomp1005 compare 1 1.00000000000000000000000000000 -> 0
  629. dqcomp1006 compare 1 1.0000000000000000000000000000 -> 0
  630. dqcomp1007 compare 1 1.000000000000000000000000000 -> 0
  631. dqcomp1008 compare 1 1.00000000000000000000000000 -> 0
  632. dqcomp1009 compare 1 1.0000000000000000000000000 -> 0
  633. dqcomp1010 compare 1 1.000000000000000000000000 -> 0
  634. dqcomp1011 compare 1 1.00000000000000000000000 -> 0
  635. dqcomp1012 compare 1 1.0000000000000000000000 -> 0
  636. dqcomp1013 compare 1 1.000000000000000000000 -> 0
  637. dqcomp1014 compare 1 1.00000000000000000000 -> 0
  638. dqcomp1015 compare 1 1.0000000000000000000 -> 0
  639. dqcomp1016 compare 1 1.000000000000000000 -> 0
  640. dqcomp1017 compare 1 1.00000000000000000 -> 0
  641. dqcomp1018 compare 1 1.0000000000000000 -> 0
  642. dqcomp1019 compare 1 1.000000000000000 -> 0
  643. dqcomp1020 compare 1 1.00000000000000 -> 0
  644. dqcomp1021 compare 1 1.0000000000000 -> 0
  645. dqcomp1022 compare 1 1.000000000000 -> 0
  646. dqcomp1023 compare 1 1.00000000000 -> 0
  647. dqcomp1024 compare 1 1.0000000000 -> 0
  648. dqcomp1025 compare 1 1.000000000 -> 0
  649. dqcomp1026 compare 1 1.00000000 -> 0
  650. dqcomp1027 compare 1 1.0000000 -> 0
  651. dqcomp1028 compare 1 1.000000 -> 0
  652. dqcomp1029 compare 1 1.00000 -> 0
  653. dqcomp1030 compare 1 1.0000 -> 0
  654. dqcomp1031 compare 1 1.000 -> 0
  655. dqcomp1032 compare 1 1.00 -> 0
  656. dqcomp1033 compare 1 1.0 -> 0
  657. dqcomp1041 compare 1.000000000000000000000000000000000 1 -> 0
  658. dqcomp1042 compare 1.00000000000000000000000000000000 1 -> 0
  659. dqcomp1043 compare 1.0000000000000000000000000000000 1 -> 0
  660. dqcomp1044 compare 1.000000000000000000000000000000 1 -> 0
  661. dqcomp1045 compare 1.00000000000000000000000000000 1 -> 0
  662. dqcomp1046 compare 1.0000000000000000000000000000 1 -> 0
  663. dqcomp1047 compare 1.000000000000000000000000000 1 -> 0
  664. dqcomp1048 compare 1.00000000000000000000000000 1 -> 0
  665. dqcomp1049 compare 1.0000000000000000000000000 1 -> 0
  666. dqcomp1050 compare 1.000000000000000000000000 1 -> 0
  667. dqcomp1051 compare 1.00000000000000000000000 1 -> 0
  668. dqcomp1052 compare 1.0000000000000000000000 1 -> 0
  669. dqcomp1053 compare 1.000000000000000000000 1 -> 0
  670. dqcomp1054 compare 1.00000000000000000000 1 -> 0
  671. dqcomp1055 compare 1.0000000000000000000 1 -> 0
  672. dqcomp1056 compare 1.000000000000000000 1 -> 0
  673. dqcomp1057 compare 1.00000000000000000 1 -> 0
  674. dqcomp1058 compare 1.0000000000000000 1 -> 0
  675. dqcomp1059 compare 1.000000000000000 1 -> 0
  676. dqcomp1060 compare 1.00000000000000 1 -> 0
  677. dqcomp1061 compare 1.0000000000000 1 -> 0
  678. dqcomp1062 compare 1.000000000000 1 -> 0
  679. dqcomp1063 compare 1.00000000000 1 -> 0
  680. dqcomp1064 compare 1.0000000000 1 -> 0
  681. dqcomp1065 compare 1.000000000 1 -> 0
  682. dqcomp1066 compare 1.00000000 1 -> 0
  683. dqcomp1067 compare 1.0000000 1 -> 0
  684. dqcomp1068 compare 1.000000 1 -> 0
  685. dqcomp1069 compare 1.00000 1 -> 0
  686. dqcomp1070 compare 1.0000 1 -> 0
  687. dqcomp1071 compare 1.000 1 -> 0
  688. dqcomp1072 compare 1.00 1 -> 0
  689. dqcomp1073 compare 1.0 1 -> 0
  690. -- check MSD always detected non-zero
  691. dqcomp1080 compare 0 0.000000000000000000000000000000000 -> 0
  692. dqcomp1081 compare 0 1.000000000000000000000000000000000 -> -1
  693. dqcomp1082 compare 0 2.000000000000000000000000000000000 -> -1
  694. dqcomp1083 compare 0 3.000000000000000000000000000000000 -> -1
  695. dqcomp1084 compare 0 4.000000000000000000000000000000000 -> -1
  696. dqcomp1085 compare 0 5.000000000000000000000000000000000 -> -1
  697. dqcomp1086 compare 0 6.000000000000000000000000000000000 -> -1
  698. dqcomp1087 compare 0 7.000000000000000000000000000000000 -> -1
  699. dqcomp1088 compare 0 8.000000000000000000000000000000000 -> -1
  700. dqcomp1089 compare 0 9.000000000000000000000000000000000 -> -1
  701. dqcomp1090 compare 0.000000000000000000000000000000000 0 -> 0
  702. dqcomp1091 compare 1.000000000000000000000000000000000 0 -> 1
  703. dqcomp1092 compare 2.000000000000000000000000000000000 0 -> 1
  704. dqcomp1093 compare 3.000000000000000000000000000000000 0 -> 1
  705. dqcomp1094 compare 4.000000000000000000000000000000000 0 -> 1
  706. dqcomp1095 compare 5.000000000000000000000000000000000 0 -> 1
  707. dqcomp1096 compare 6.000000000000000000000000000000000 0 -> 1
  708. dqcomp1097 compare 7.000000000000000000000000000000000 0 -> 1
  709. dqcomp1098 compare 8.000000000000000000000000000000000 0 -> 1
  710. dqcomp1099 compare 9.000000000000000000000000000000000 0 -> 1
  711. -- Null tests
  712. dqcom990 compare 10 # -> NaN Invalid_operation
  713. dqcom991 compare # 10 -> NaN Invalid_operation