Repository URL to install this package:
------------------------------------------------------------------------ -- ddRemainderNear.decTest -- decDouble remainder-near -- -- 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 precision: 16 maxExponent: 384 minExponent: -383 extended: 1 clamp: 1 rounding: half_even -- sanity checks (as base, above) ddrmn001 remaindernear 1 1 -> 0 ddrmn002 remaindernear 2 1 -> 0 ddrmn003 remaindernear 1 2 -> 1 ddrmn004 remaindernear 2 2 -> 0 ddrmn005 remaindernear 0 1 -> 0 ddrmn006 remaindernear 0 2 -> 0 ddrmn007 remaindernear 1 3 -> 1 ddrmn008 remaindernear 2 3 -> -1 ddrmn009 remaindernear 3 3 -> 0 ddrmn010 remaindernear 2.4 1 -> 0.4 ddrmn011 remaindernear 2.4 -1 -> 0.4 ddrmn012 remaindernear -2.4 1 -> -0.4 ddrmn013 remaindernear -2.4 -1 -> -0.4 ddrmn014 remaindernear 2.40 1 -> 0.40 ddrmn015 remaindernear 2.400 1 -> 0.400 ddrmn016 remaindernear 2.4 2 -> 0.4 ddrmn017 remaindernear 2.400 2 -> 0.400 ddrmn018 remaindernear 2. 2 -> 0 ddrmn019 remaindernear 20 20 -> 0 ddrmn020 remaindernear 187 187 -> 0 ddrmn021 remaindernear 5 2 -> 1 ddrmn022 remaindernear 5 2.0 -> 1.0 ddrmn023 remaindernear 5 2.000 -> 1.000 ddrmn024 remaindernear 5 0.200 -> 0.000 ddrmn025 remaindernear 5 0.200 -> 0.000 ddrmn030 remaindernear 1 2 -> 1 ddrmn031 remaindernear 1 4 -> 1 ddrmn032 remaindernear 1 8 -> 1 ddrmn033 remaindernear 1 16 -> 1 ddrmn034 remaindernear 1 32 -> 1 ddrmn035 remaindernear 1 64 -> 1 ddrmn040 remaindernear 1 -2 -> 1 ddrmn041 remaindernear 1 -4 -> 1 ddrmn042 remaindernear 1 -8 -> 1 ddrmn043 remaindernear 1 -16 -> 1 ddrmn044 remaindernear 1 -32 -> 1 ddrmn045 remaindernear 1 -64 -> 1 ddrmn050 remaindernear -1 2 -> -1 ddrmn051 remaindernear -1 4 -> -1 ddrmn052 remaindernear -1 8 -> -1 ddrmn053 remaindernear -1 16 -> -1 ddrmn054 remaindernear -1 32 -> -1 ddrmn055 remaindernear -1 64 -> -1 ddrmn060 remaindernear -1 -2 -> -1 ddrmn061 remaindernear -1 -4 -> -1 ddrmn062 remaindernear -1 -8 -> -1 ddrmn063 remaindernear -1 -16 -> -1 ddrmn064 remaindernear -1 -32 -> -1 ddrmn065 remaindernear -1 -64 -> -1 ddrmn066 remaindernear 9.9 1 -> -0.1 ddrmn067 remaindernear 99.7 1 -> -0.3 ddrmn068 remaindernear 999999999 1 -> 0 ddrmn069 remaindernear 999999999.4 1 -> 0.4 ddrmn070 remaindernear 999999999.5 1 -> -0.5 ddrmn071 remaindernear 999999999.9 1 -> -0.1 ddrmn072 remaindernear 999999999.999 1 -> -0.001 ddrmn073 remaindernear 999999.999999 1 -> -0.000001 ddrmn074 remaindernear 9 1 -> 0 ddrmn075 remaindernear 9999999999999999 1 -> 0 ddrmn076 remaindernear 9999999999999999 2 -> -1 ddrmn077 remaindernear 9999999999999999 3 -> 0 ddrmn078 remaindernear 9999999999999999 4 -> -1 ddrmn080 remaindernear 0. 1 -> 0 ddrmn081 remaindernear .0 1 -> 0.0 ddrmn082 remaindernear 0.00 1 -> 0.00 ddrmn083 remaindernear 0.00E+9 1 -> 0 ddrmn084 remaindernear 0.00E+3 1 -> 0 ddrmn085 remaindernear 0.00E+2 1 -> 0 ddrmn086 remaindernear 0.00E+1 1 -> 0.0 ddrmn087 remaindernear 0.00E+0 1 -> 0.00 ddrmn088 remaindernear 0.00E-0 1 -> 0.00 ddrmn089 remaindernear 0.00E-1 1 -> 0.000 ddrmn090 remaindernear 0.00E-2 1 -> 0.0000 ddrmn091 remaindernear 0.00E-3 1 -> 0.00000 ddrmn092 remaindernear 0.00E-4 1 -> 0.000000 ddrmn093 remaindernear 0.00E-5 1 -> 0E-7 ddrmn094 remaindernear 0.00E-6 1 -> 0E-8 ddrmn095 remaindernear 0.0000E-50 1 -> 0E-54 -- Various flavours of remaindernear by 0 ddrmn101 remaindernear 0 0 -> NaN Division_undefined ddrmn102 remaindernear 0 -0 -> NaN Division_undefined ddrmn103 remaindernear -0 0 -> NaN Division_undefined ddrmn104 remaindernear -0 -0 -> NaN Division_undefined ddrmn105 remaindernear 0.0E5 0 -> NaN Division_undefined ddrmn106 remaindernear 0.000 0 -> NaN Division_undefined -- [Some think this next group should be Division_by_zero exception, but -- IEEE 854 is explicit that it is Invalid operation .. for -- remainder-near, anyway] ddrmn107 remaindernear 0.0001 0 -> NaN Invalid_operation ddrmn108 remaindernear 0.01 0 -> NaN Invalid_operation ddrmn109 remaindernear 0.1 0 -> NaN Invalid_operation ddrmn110 remaindernear 1 0 -> NaN Invalid_operation ddrmn111 remaindernear 1 0.0 -> NaN Invalid_operation ddrmn112 remaindernear 10 0.0 -> NaN Invalid_operation ddrmn113 remaindernear 1E+100 0.0 -> NaN Invalid_operation ddrmn114 remaindernear 1E+380 0 -> NaN Invalid_operation ddrmn115 remaindernear 0.0001 -0 -> NaN Invalid_operation ddrmn116 remaindernear 0.01 -0 -> NaN Invalid_operation ddrmn119 remaindernear 0.1 -0 -> NaN Invalid_operation ddrmn120 remaindernear 1 -0 -> NaN Invalid_operation ddrmn121 remaindernear 1 -0.0 -> NaN Invalid_operation ddrmn122 remaindernear 10 -0.0 -> NaN Invalid_operation ddrmn123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation ddrmn124 remaindernear 1E+384 -0 -> NaN Invalid_operation -- and zeros on left ddrmn130 remaindernear 0 1 -> 0 ddrmn131 remaindernear 0 -1 -> 0 ddrmn132 remaindernear 0.0 1 -> 0.0 ddrmn133 remaindernear 0.0 -1 -> 0.0 ddrmn134 remaindernear -0 1 -> -0 ddrmn135 remaindernear -0 -1 -> -0 ddrmn136 remaindernear -0.0 1 -> -0.0 ddrmn137 remaindernear -0.0 -1 -> -0.0 -- 0.5ers ddrmn143 remaindernear 0.5 2 -> 0.5 ddrmn144 remaindernear 0.5 2.1 -> 0.5 ddrmn145 remaindernear 0.5 2.01 -> 0.50 ddrmn146 remaindernear 0.5 2.001 -> 0.500 ddrmn147 remaindernear 0.50 2 -> 0.50 ddrmn148 remaindernear 0.50 2.01 -> 0.50 ddrmn149 remaindernear 0.50 2.001 -> 0.500 -- steadies ddrmn150 remaindernear 1 1 -> 0 ddrmn151 remaindernear 1 2 -> 1 ddrmn152 remaindernear 1 3 -> 1 ddrmn153 remaindernear 1 4 -> 1 ddrmn154 remaindernear 1 5 -> 1 ddrmn155 remaindernear 1 6 -> 1 ddrmn156 remaindernear 1 7 -> 1 ddrmn157 remaindernear 1 8 -> 1 ddrmn158 remaindernear 1 9 -> 1 ddrmn159 remaindernear 1 10 -> 1 ddrmn160 remaindernear 1 1 -> 0 ddrmn161 remaindernear 2 1 -> 0 ddrmn162 remaindernear 3 1 -> 0 ddrmn163 remaindernear 4 1 -> 0 ddrmn164 remaindernear 5 1 -> 0 ddrmn165 remaindernear 6 1 -> 0 ddrmn166 remaindernear 7 1 -> 0 ddrmn167 remaindernear 8 1 -> 0 ddrmn168 remaindernear 9 1 -> 0 ddrmn169 remaindernear 10 1 -> 0 -- some differences from remainder ddrmn171 remaindernear 0.4 1.020 -> 0.400 ddrmn172 remaindernear 0.50 1.020 -> 0.500 ddrmn173 remaindernear 0.51 1.020 -> 0.510 ddrmn174 remaindernear 0.52 1.020 -> -0.500 ddrmn175 remaindernear 0.6 1.020 -> -0.420 -- More flavours of remaindernear by 0 ddrmn201 remaindernear 0 0 -> NaN Division_undefined ddrmn202 remaindernear 0.0E5 0 -> NaN Division_undefined ddrmn203 remaindernear 0.000 0 -> NaN Division_undefined ddrmn204 remaindernear 0.0001 0 -> NaN Invalid_operation ddrmn205 remaindernear 0.01 0 -> NaN Invalid_operation ddrmn206 remaindernear 0.1 0 -> NaN Invalid_operation ddrmn207 remaindernear 1 0 -> NaN Invalid_operation ddrmn208 remaindernear 1 0.0 -> NaN Invalid_operation ddrmn209 remaindernear 10 0.0 -> NaN Invalid_operation ddrmn210 remaindernear 1E+100 0.0 -> NaN Invalid_operation ddrmn211 remaindernear 1E+380 0 -> NaN Invalid_operation -- tests from the extended specification ddrmn221 remaindernear 2.1 3 -> -0.9 ddrmn222 remaindernear 10 6 -> -2 ddrmn223 remaindernear 10 3 -> 1 ddrmn224 remaindernear -10 3 -> -1 ddrmn225 remaindernear 10.2 1 -> 0.2 ddrmn226 remaindernear 10 0.3 -> 0.1 ddrmn227 remaindernear 3.6 1.3 -> -0.3 -- some differences from remainder ddrmn231 remaindernear -0.4 1.020 -> -0.400 ddrmn232 remaindernear -0.50 1.020 -> -0.500 ddrmn233 remaindernear -0.51 1.020 -> -0.510 ddrmn234 remaindernear -0.52 1.020 -> 0.500 ddrmn235 remaindernear -0.6 1.020 -> 0.420 -- high Xs ddrmn240 remaindernear 1E+2 1.00 -> 0.00 -- ddrmn3xx are from DiagBigDecimal ddrmn301 remaindernear 1 3 -> 1 ddrmn302 remaindernear 5 5 -> 0 ddrmn303 remaindernear 13 10 -> 3 ddrmn304 remaindernear 13 50 -> 13 ddrmn305 remaindernear 13 100 -> 13 ddrmn306 remaindernear 13 1000 -> 13 ddrmn307 remaindernear .13 1 -> 0.13 ddrmn308 remaindernear 0.133 1 -> 0.133 ddrmn309 remaindernear 0.1033 1 -> 0.1033 ddrmn310 remaindernear 1.033 1 -> 0.033 ddrmn311 remaindernear 10.33 1 -> 0.33 ddrmn312 remaindernear 10.33 10 -> 0.33 ddrmn313 remaindernear 103.3 1 -> 0.3 ddrmn314 remaindernear 133 10 -> 3 ddrmn315 remaindernear 1033 10 -> 3 ddrmn316 remaindernear 1033 50 -> -17 ddrmn317 remaindernear 101.0 3 -> -1.0 ddrmn318 remaindernear 102.0 3 -> 0.0 ddrmn319 remaindernear 103.0 3 -> 1.0 ddrmn320 remaindernear 2.40 1 -> 0.40 ddrmn321 remaindernear 2.400 1 -> 0.400 ddrmn322 remaindernear 2.4 1 -> 0.4 ddrmn323 remaindernear 2.4 2 -> 0.4 ddrmn324 remaindernear 2.400 2 -> 0.400 ddrmn325 remaindernear 1 0.3 -> 0.1 ddrmn326 remaindernear 1 0.30 -> 0.10 ddrmn327 remaindernear 1 0.300 -> 0.100 ddrmn328 remaindernear 1 0.3000 -> 0.1000 ddrmn329 remaindernear 1.0 0.3 -> 0.1 ddrmn330 remaindernear 1.00 0.3 -> 0.10 ddrmn331 remaindernear 1.000 0.3 -> 0.100 ddrmn332 remaindernear 1.0000 0.3 -> 0.1000 ddrmn333 remaindernear 0.5 2 -> 0.5 ddrmn334 remaindernear 0.5 2.1 -> 0.5 ddrmn335 remaindernear 0.5 2.01 -> 0.50 ddrmn336 remaindernear 0.5 2.001 -> 0.500 ddrmn337 remaindernear 0.50 2 -> 0.50 ddrmn338 remaindernear 0.50 2.01 -> 0.50 ddrmn339 remaindernear 0.50 2.001 -> 0.500 ddrmn340 remaindernear 0.5 0.5000001 -> -1E-7 ddrmn341 remaindernear 0.5 0.50000001 -> -1E-8 ddrmn342 remaindernear 0.5 0.500000001 -> -1E-9 ddrmn343 remaindernear 0.5 0.5000000001 -> -1E-10 ddrmn344 remaindernear 0.5 0.50000000001 -> -1E-11 ddrmn345 remaindernear 0.5 0.4999999 -> 1E-7 ddrmn346 remaindernear 0.5 0.49999999 -> 1E-8 ddrmn347 remaindernear 0.5 0.499999999 -> 1E-9 ddrmn348 remaindernear 0.5 0.4999999999 -> 1E-10 ddrmn349 remaindernear 0.5 0.49999999999 -> 1E-11 ddrmn350 remaindernear 0.5 0.499999999999 -> 1E-12 ddrmn351 remaindernear 0.03 7 -> 0.03 ddrmn352 remaindernear 5 2 -> 1 ddrmn353 remaindernear 4.1 2 -> 0.1 ddrmn354 remaindernear 4.01 2 -> 0.01 ddrmn355 remaindernear 4.001 2 -> 0.001 ddrmn356 remaindernear 4.0001 2 -> 0.0001 ddrmn357 remaindernear 4.00001 2 -> 0.00001 ddrmn358 remaindernear 4.000001 2 -> 0.000001 ddrmn359 remaindernear 4.0000001 2 -> 1E-7 ddrmn360 remaindernear 1.2 0.7345 -> -0.2690 ddrmn361 remaindernear 0.8 12 -> 0.8 ddrmn362 remaindernear 0.8 0.2 -> 0.0 ddrmn363 remaindernear 0.8 0.3 -> -0.1 ddrmn364 remaindernear 0.800 12 -> 0.800 ddrmn365 remaindernear 0.800 1.7 -> 0.800 ddrmn366 remaindernear 2.400 2 -> 0.400 -- round to even ddrmn371 remaindernear 121 2 -> 1 ddrmn372 remaindernear 122 2 -> 0 ddrmn373 remaindernear 123 2 -> -1 ddrmn374 remaindernear 124 2 -> 0 ddrmn375 remaindernear 125 2 -> 1 ddrmn376 remaindernear 126 2 -> 0 ddrmn377 remaindernear 127 2 -> -1 ddrmn381 remaindernear 12345 1 -> 0 ddrmn382 remaindernear 12345 1.0001 -> -0.2344 ddrmn383 remaindernear 12345 1.001 -> -0.333 ddrmn384 remaindernear 12345 1.01 -> -0.23 ddrmn385 remaindernear 12345 1.1 -> -0.3 ddrmn386 remaindernear 12355 4 -> -1 ddrmn387 remaindernear 12345 4 -> 1 ddrmn388 remaindernear 12355 4.0001 -> -1.3089 ddrmn389 remaindernear 12345 4.0001 -> 0.6914 ddrmn390 remaindernear 12345 4.9 -> 1.9 ddrmn391 remaindernear 12345 4.99 -> -0.26 ddrmn392 remaindernear 12345 4.999 -> 2.469 ddrmn393 remaindernear 12345 4.9999 -> 0.2469 ddrmn394 remaindernear 12345 5 -> 0 ddrmn395 remaindernear 12345 5.0001 -> -0.2469 ddrmn396 remaindernear 12345 5.001 -> -2.469 ddrmn397 remaindernear 12345 5.01 -> 0.36 ddrmn398 remaindernear 12345 5.1 -> -2.1 -- the nasty division-by-1 cases ddrmn401 remaindernear 0.4 1 -> 0.4 ddrmn402 remaindernear 0.45 1 -> 0.45 ddrmn403 remaindernear 0.455 1 -> 0.455 ddrmn404 remaindernear 0.4555 1 -> 0.4555 ddrmn405 remaindernear 0.45555 1 -> 0.45555 ddrmn406 remaindernear 0.455555 1 -> 0.455555 ddrmn407 remaindernear 0.4555555 1 -> 0.4555555 ddrmn408 remaindernear 0.45555555 1 -> 0.45555555 ddrmn409 remaindernear 0.455555555 1 -> 0.455555555 -- with spill... [412 exercises sticktab loop] ddrmn411 remaindernear 0.5 1 -> 0.5 ddrmn412 remaindernear 0.55 1 -> -0.45 ddrmn413 remaindernear 0.555 1 -> -0.445 ddrmn414 remaindernear 0.5555 1 -> -0.4445 ddrmn415 remaindernear 0.55555 1 -> -0.44445 ddrmn416 remaindernear 0.555555 1 -> -0.444445 ddrmn417 remaindernear 0.5555555 1 -> -0.4444445 ddrmn418 remaindernear 0.55555555 1 -> -0.44444445 ddrmn419 remaindernear 0.555555555 1 -> -0.444444445 -- folddowns ddrmn421 remaindernear 1E+384 1 -> NaN Division_impossible ddrmn422 remaindernear 1E+384 1E+383 -> 0E+369 Clamped ddrmn423 remaindernear 1E+384 2E+383 -> 0E+369 Clamped ddrmn424 remaindernear 1E+384 3E+383 -> 1.00000000000000E+383 ClampedLoading ...