Repository URL to install this package:
------------------------------------------------------------------------ -- compare.decTest -- decimal comparison that allows quiet NaNs -- -- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.59 -- Note that we cannot assume add/subtract tests cover paths adequately, -- here, because the code might be quite different (comparison cannot -- overflow or underflow, so actual subtractions are not necessary). extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks comx001 compare -2 -2 -> 0 comx002 compare -2 -1 -> -1 comx003 compare -2 0 -> -1 comx004 compare -2 1 -> -1 comx005 compare -2 2 -> -1 comx006 compare -1 -2 -> 1 comx007 compare -1 -1 -> 0 comx008 compare -1 0 -> -1 comx009 compare -1 1 -> -1 comx010 compare -1 2 -> -1 comx011 compare 0 -2 -> 1 comx012 compare 0 -1 -> 1 comx013 compare 0 0 -> 0 comx014 compare 0 1 -> -1 comx015 compare 0 2 -> -1 comx016 compare 1 -2 -> 1 comx017 compare 1 -1 -> 1 comx018 compare 1 0 -> 1 comx019 compare 1 1 -> 0 comx020 compare 1 2 -> -1 comx021 compare 2 -2 -> 1 comx022 compare 2 -1 -> 1 comx023 compare 2 0 -> 1 comx025 compare 2 1 -> 1 comx026 compare 2 2 -> 0 comx031 compare -20 -20 -> 0 comx032 compare -20 -10 -> -1 comx033 compare -20 00 -> -1 comx034 compare -20 10 -> -1 comx035 compare -20 20 -> -1 comx036 compare -10 -20 -> 1 comx037 compare -10 -10 -> 0 comx038 compare -10 00 -> -1 comx039 compare -10 10 -> -1 comx040 compare -10 20 -> -1 comx041 compare 00 -20 -> 1 comx042 compare 00 -10 -> 1 comx043 compare 00 00 -> 0 comx044 compare 00 10 -> -1 comx045 compare 00 20 -> -1 comx046 compare 10 -20 -> 1 comx047 compare 10 -10 -> 1 comx048 compare 10 00 -> 1 comx049 compare 10 10 -> 0 comx050 compare 10 20 -> -1 comx051 compare 20 -20 -> 1 comx052 compare 20 -10 -> 1 comx053 compare 20 00 -> 1 comx055 compare 20 10 -> 1 comx056 compare 20 20 -> 0 comx061 compare -2.0 -2.0 -> 0 comx062 compare -2.0 -1.0 -> -1 comx063 compare -2.0 0.0 -> -1 comx064 compare -2.0 1.0 -> -1 comx065 compare -2.0 2.0 -> -1 comx066 compare -1.0 -2.0 -> 1 comx067 compare -1.0 -1.0 -> 0 comx068 compare -1.0 0.0 -> -1 comx069 compare -1.0 1.0 -> -1 comx070 compare -1.0 2.0 -> -1 comx071 compare 0.0 -2.0 -> 1 comx072 compare 0.0 -1.0 -> 1 comx073 compare 0.0 0.0 -> 0 comx074 compare 0.0 1.0 -> -1 comx075 compare 0.0 2.0 -> -1 comx076 compare 1.0 -2.0 -> 1 comx077 compare 1.0 -1.0 -> 1 comx078 compare 1.0 0.0 -> 1 comx079 compare 1.0 1.0 -> 0 comx080 compare 1.0 2.0 -> -1 comx081 compare 2.0 -2.0 -> 1 comx082 compare 2.0 -1.0 -> 1 comx083 compare 2.0 0.0 -> 1 comx085 compare 2.0 1.0 -> 1 comx086 compare 2.0 2.0 -> 0 -- now some cases which might overflow if subtract were used maxexponent: 999999999 minexponent: -999999999 comx095 compare 9.99999999E+999999999 9.99999999E+999999999 -> 0 comx096 compare -9.99999999E+999999999 9.99999999E+999999999 -> -1 comx097 compare 9.99999999E+999999999 -9.99999999E+999999999 -> 1 comx098 compare -9.99999999E+999999999 -9.99999999E+999999999 -> 0 -- some differing length/exponent cases comx100 compare 7.0 7.0 -> 0 comx101 compare 7.0 7 -> 0 comx102 compare 7 7.0 -> 0 comx103 compare 7E+0 7.0 -> 0 comx104 compare 70E-1 7.0 -> 0 comx105 compare 0.7E+1 7 -> 0 comx106 compare 70E-1 7 -> 0 comx107 compare 7.0 7E+0 -> 0 comx108 compare 7.0 70E-1 -> 0 comx109 compare 7 0.7E+1 -> 0 comx110 compare 7 70E-1 -> 0 comx120 compare 8.0 7.0 -> 1 comx121 compare 8.0 7 -> 1 comx122 compare 8 7.0 -> 1 comx123 compare 8E+0 7.0 -> 1 comx124 compare 80E-1 7.0 -> 1 comx125 compare 0.8E+1 7 -> 1 comx126 compare 80E-1 7 -> 1 comx127 compare 8.0 7E+0 -> 1 comx128 compare 8.0 70E-1 -> 1 comx129 compare 8 0.7E+1 -> 1 comx130 compare 8 70E-1 -> 1 comx140 compare 8.0 9.0 -> -1 comx141 compare 8.0 9 -> -1 comx142 compare 8 9.0 -> -1 comx143 compare 8E+0 9.0 -> -1 comx144 compare 80E-1 9.0 -> -1 comx145 compare 0.8E+1 9 -> -1 comx146 compare 80E-1 9 -> -1 comx147 compare 8.0 9E+0 -> -1 comx148 compare 8.0 90E-1 -> -1 comx149 compare 8 0.9E+1 -> -1 comx150 compare 8 90E-1 -> -1 -- and again, with sign changes -+ .. comx200 compare -7.0 7.0 -> -1 comx201 compare -7.0 7 -> -1 comx202 compare -7 7.0 -> -1 comx203 compare -7E+0 7.0 -> -1 comx204 compare -70E-1 7.0 -> -1 comx205 compare -0.7E+1 7 -> -1 comx206 compare -70E-1 7 -> -1 comx207 compare -7.0 7E+0 -> -1 comx208 compare -7.0 70E-1 -> -1 comx209 compare -7 0.7E+1 -> -1 comx210 compare -7 70E-1 -> -1 comx220 compare -8.0 7.0 -> -1 comx221 compare -8.0 7 -> -1 comx222 compare -8 7.0 -> -1 comx223 compare -8E+0 7.0 -> -1 comx224 compare -80E-1 7.0 -> -1 comx225 compare -0.8E+1 7 -> -1 comx226 compare -80E-1 7 -> -1 comx227 compare -8.0 7E+0 -> -1 comx228 compare -8.0 70E-1 -> -1 comx229 compare -8 0.7E+1 -> -1 comx230 compare -8 70E-1 -> -1 comx240 compare -8.0 9.0 -> -1 comx241 compare -8.0 9 -> -1 comx242 compare -8 9.0 -> -1 comx243 compare -8E+0 9.0 -> -1 comx244 compare -80E-1 9.0 -> -1 comx245 compare -0.8E+1 9 -> -1 comx246 compare -80E-1 9 -> -1 comx247 compare -8.0 9E+0 -> -1 comx248 compare -8.0 90E-1 -> -1 comx249 compare -8 0.9E+1 -> -1 comx250 compare -8 90E-1 -> -1 -- and again, with sign changes +- .. comx300 compare 7.0 -7.0 -> 1 comx301 compare 7.0 -7 -> 1 comx302 compare 7 -7.0 -> 1 comx303 compare 7E+0 -7.0 -> 1 comx304 compare 70E-1 -7.0 -> 1 comx305 compare .7E+1 -7 -> 1 comx306 compare 70E-1 -7 -> 1 comx307 compare 7.0 -7E+0 -> 1 comx308 compare 7.0 -70E-1 -> 1 comx309 compare 7 -.7E+1 -> 1 comx310 compare 7 -70E-1 -> 1 comx320 compare 8.0 -7.0 -> 1 comx321 compare 8.0 -7 -> 1 comx322 compare 8 -7.0 -> 1 comx323 compare 8E+0 -7.0 -> 1 comx324 compare 80E-1 -7.0 -> 1 comx325 compare .8E+1 -7 -> 1 comx326 compare 80E-1 -7 -> 1 comx327 compare 8.0 -7E+0 -> 1 comx328 compare 8.0 -70E-1 -> 1 comx329 compare 8 -.7E+1 -> 1 comx330 compare 8 -70E-1 -> 1 comx340 compare 8.0 -9.0 -> 1 comx341 compare 8.0 -9 -> 1 comx342 compare 8 -9.0 -> 1 comx343 compare 8E+0 -9.0 -> 1 comx344 compare 80E-1 -9.0 -> 1 comx345 compare .8E+1 -9 -> 1 comx346 compare 80E-1 -9 -> 1 comx347 compare 8.0 -9E+0 -> 1 comx348 compare 8.0 -90E-1 -> 1 comx349 compare 8 -.9E+1 -> 1 comx350 compare 8 -90E-1 -> 1 -- and again, with sign changes -- .. comx400 compare -7.0 -7.0 -> 0 comx401 compare -7.0 -7 -> 0 comx402 compare -7 -7.0 -> 0 comx403 compare -7E+0 -7.0 -> 0 comx404 compare -70E-1 -7.0 -> 0 comx405 compare -.7E+1 -7 -> 0 comx406 compare -70E-1 -7 -> 0 comx407 compare -7.0 -7E+0 -> 0 comx408 compare -7.0 -70E-1 -> 0 comx409 compare -7 -.7E+1 -> 0 comx410 compare -7 -70E-1 -> 0 comx420 compare -8.0 -7.0 -> -1 comx421 compare -8.0 -7 -> -1 comx422 compare -8 -7.0 -> -1 comx423 compare -8E+0 -7.0 -> -1 comx424 compare -80E-1 -7.0 -> -1 comx425 compare -.8E+1 -7 -> -1 comx426 compare -80E-1 -7 -> -1 comx427 compare -8.0 -7E+0 -> -1 comx428 compare -8.0 -70E-1 -> -1 comx429 compare -8 -.7E+1 -> -1 comx430 compare -8 -70E-1 -> -1 comx440 compare -8.0 -9.0 -> 1 comx441 compare -8.0 -9 -> 1 comx442 compare -8 -9.0 -> 1 comx443 compare -8E+0 -9.0 -> 1 comx444 compare -80E-1 -9.0 -> 1 comx445 compare -.8E+1 -9 -> 1 comx446 compare -80E-1 -9 -> 1 comx447 compare -8.0 -9E+0 -> 1 comx448 compare -8.0 -90E-1 -> 1 comx449 compare -8 -.9E+1 -> 1 comx450 compare -8 -90E-1 -> 1 -- misalignment traps for little-endian comx451 compare 1.0 0.1 -> 1 comx452 compare 0.1 1.0 -> -1 comx453 compare 10.0 0.1 -> 1 comx454 compare 0.1 10.0 -> -1 comx455 compare 100 1.0 -> 1 comx456 compare 1.0 100 -> -1 comx457 compare 1000 10.0 -> 1 comx458 compare 10.0 1000 -> -1 comx459 compare 10000 100.0 -> 1 comx460 compare 100.0 10000 -> -1 comx461 compare 100000 1000.0 -> 1 comx462 compare 1000.0 100000 -> -1 comx463 compare 1000000 10000.0 -> 1 comx464 compare 10000.0 1000000 -> -1 -- testcases that subtract to lots of zeros at boundaries [pgr] precision: 40 comx470 compare 123.4560000000000000E789 123.456E789 -> 0 comx471 compare 123.456000000000000E-89 123.456E-89 -> 0 comx472 compare 123.45600000000000E789 123.456E789 -> 0 comx473 compare 123.4560000000000E-89 123.456E-89 -> 0 comx474 compare 123.456000000000E789 123.456E789 -> 0 comx475 compare 123.45600000000E-89 123.456E-89 -> 0 comx476 compare 123.4560000000E789 123.456E789 -> 0 comx477 compare 123.456000000E-89 123.456E-89 -> 0 comx478 compare 123.45600000E789 123.456E789 -> 0 comx479 compare 123.4560000E-89 123.456E-89 -> 0 comx480 compare 123.456000E789 123.456E789 -> 0 comx481 compare 123.45600E-89 123.456E-89 -> 0 comx482 compare 123.4560E789 123.456E789 -> 0 comx483 compare 123.456E-89 123.456E-89 -> 0 comx484 compare 123.456E-89 123.4560000000000000E-89 -> 0 comx485 compare 123.456E789 123.456000000000000E789 -> 0 comx486 compare 123.456E-89 123.45600000000000E-89 -> 0 comx487 compare 123.456E789 123.4560000000000E789 -> 0 comx488 compare 123.456E-89 123.456000000000E-89 -> 0 comx489 compare 123.456E789 123.45600000000E789 -> 0 comx490 compare 123.456E-89 123.4560000000E-89 -> 0 comx491 compare 123.456E789 123.456000000E789 -> 0 comx492 compare 123.456E-89 123.45600000E-89 -> 0 comx493 compare 123.456E789 123.4560000E789 -> 0 comx494 compare 123.456E-89 123.456000E-89 -> 0 comx495 compare 123.456E789 123.45600E789 -> 0 comx496 compare 123.456E-89 123.4560E-89 -> 0 comx497 compare 123.456E789 123.456E789 -> 0 -- wide-ranging, around precision; signs equal precision: 9 comx500 compare 1 1E-15 -> 1 comx501 compare 1 1E-14 -> 1 comx502 compare 1 1E-13 -> 1 comx503 compare 1 1E-12 -> 1 comx504 compare 1 1E-11 -> 1 comx505 compare 1 1E-10 -> 1 comx506 compare 1 1E-9 -> 1 comx507 compare 1 1E-8 -> 1 comx508 compare 1 1E-7 -> 1 comx509 compare 1 1E-6 -> 1 comx510 compare 1 1E-5 -> 1 comx511 compare 1 1E-4 -> 1 comx512 compare 1 1E-3 -> 1 comx513 compare 1 1E-2 -> 1 comx514 compare 1 1E-1 -> 1 comx515 compare 1 1E-0 -> 0 comx516 compare 1 1E+1 -> -1 comx517 compare 1 1E+2 -> -1 comx518 compare 1 1E+3 -> -1 comx519 compare 1 1E+4 -> -1 comx521 compare 1 1E+5 -> -1 comx522 compare 1 1E+6 -> -1 comx523 compare 1 1E+7 -> -1 comx524 compare 1 1E+8 -> -1 comx525 compare 1 1E+9 -> -1 comx526 compare 1 1E+10 -> -1 comx527 compare 1 1E+11 -> -1 comx528 compare 1 1E+12 -> -1 comx529 compare 1 1E+13 -> -1Loading ...