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