1------------------------------------------------------------------------ 2-- ddDivideInt.decTest -- decDouble integer division -- 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------------------------------------------------------------------------ 20version: 2.59 21 22precision: 16 23maxExponent: 384 24minExponent: -383 25extended: 1 26clamp: 1 27rounding: half_even 28 29dddvi001 divideint 1 1 -> 1 30dddvi002 divideint 2 1 -> 2 31dddvi003 divideint 1 2 -> 0 32dddvi004 divideint 2 2 -> 1 33dddvi005 divideint 0 1 -> 0 34dddvi006 divideint 0 2 -> 0 35dddvi007 divideint 1 3 -> 0 36dddvi008 divideint 2 3 -> 0 37dddvi009 divideint 3 3 -> 1 38 39dddvi010 divideint 2.4 1 -> 2 40dddvi011 divideint 2.4 -1 -> -2 41dddvi012 divideint -2.4 1 -> -2 42dddvi013 divideint -2.4 -1 -> 2 43dddvi014 divideint 2.40 1 -> 2 44dddvi015 divideint 2.400 1 -> 2 45dddvi016 divideint 2.4 2 -> 1 46dddvi017 divideint 2.400 2 -> 1 47dddvi018 divideint 2. 2 -> 1 48dddvi019 divideint 20 20 -> 1 49 50dddvi020 divideint 187 187 -> 1 51dddvi021 divideint 5 2 -> 2 52dddvi022 divideint 5 2.0 -> 2 53dddvi023 divideint 5 2.000 -> 2 54dddvi024 divideint 5 0.200 -> 25 55dddvi025 divideint 5 0.200 -> 25 56 57dddvi030 divideint 1 2 -> 0 58dddvi031 divideint 1 4 -> 0 59dddvi032 divideint 1 8 -> 0 60dddvi033 divideint 1 16 -> 0 61dddvi034 divideint 1 32 -> 0 62dddvi035 divideint 1 64 -> 0 63dddvi040 divideint 1 -2 -> -0 64dddvi041 divideint 1 -4 -> -0 65dddvi042 divideint 1 -8 -> -0 66dddvi043 divideint 1 -16 -> -0 67dddvi044 divideint 1 -32 -> -0 68dddvi045 divideint 1 -64 -> -0 69dddvi050 divideint -1 2 -> -0 70dddvi051 divideint -1 4 -> -0 71dddvi052 divideint -1 8 -> -0 72dddvi053 divideint -1 16 -> -0 73dddvi054 divideint -1 32 -> -0 74dddvi055 divideint -1 64 -> -0 75dddvi060 divideint -1 -2 -> 0 76dddvi061 divideint -1 -4 -> 0 77dddvi062 divideint -1 -8 -> 0 78dddvi063 divideint -1 -16 -> 0 79dddvi064 divideint -1 -32 -> 0 80dddvi065 divideint -1 -64 -> 0 81 82-- similar with powers of ten 83dddvi160 divideint 1 1 -> 1 84dddvi161 divideint 1 10 -> 0 85dddvi162 divideint 1 100 -> 0 86dddvi163 divideint 1 1000 -> 0 87dddvi164 divideint 1 10000 -> 0 88dddvi165 divideint 1 100000 -> 0 89dddvi166 divideint 1 1000000 -> 0 90dddvi167 divideint 1 10000000 -> 0 91dddvi168 divideint 1 100000000 -> 0 92dddvi170 divideint 1 -1 -> -1 93dddvi171 divideint 1 -10 -> -0 94dddvi172 divideint 1 -100 -> -0 95dddvi173 divideint 1 -1000 -> -0 96dddvi174 divideint 1 -10000 -> -0 97dddvi175 divideint 1 -100000 -> -0 98dddvi176 divideint 1 -1000000 -> -0 99dddvi177 divideint 1 -10000000 -> -0 100dddvi178 divideint 1 -100000000 -> -0 101dddvi180 divideint -1 1 -> -1 102dddvi181 divideint -1 10 -> -0 103dddvi182 divideint -1 100 -> -0 104dddvi183 divideint -1 1000 -> -0 105dddvi184 divideint -1 10000 -> -0 106dddvi185 divideint -1 100000 -> -0 107dddvi186 divideint -1 1000000 -> -0 108dddvi187 divideint -1 10000000 -> -0 109dddvi188 divideint -1 100000000 -> -0 110dddvi190 divideint -1 -1 -> 1 111dddvi191 divideint -1 -10 -> 0 112dddvi192 divideint -1 -100 -> 0 113dddvi193 divideint -1 -1000 -> 0 114dddvi194 divideint -1 -10000 -> 0 115dddvi195 divideint -1 -100000 -> 0 116dddvi196 divideint -1 -1000000 -> 0 117dddvi197 divideint -1 -10000000 -> 0 118dddvi198 divideint -1 -100000000 -> 0 119 120-- some long operand (at p=9) cases 121dddvi070 divideint 999999999 1 -> 999999999 122dddvi071 divideint 999999999.4 1 -> 999999999 123dddvi072 divideint 999999999.5 1 -> 999999999 124dddvi073 divideint 999999999.9 1 -> 999999999 125dddvi074 divideint 999999999.999 1 -> 999999999 126 127dddvi090 divideint 0. 1 -> 0 128dddvi091 divideint .0 1 -> 0 129dddvi092 divideint 0.00 1 -> 0 130dddvi093 divideint 0.00E+9 1 -> 0 131dddvi094 divideint 0.0000E-50 1 -> 0 132 133dddvi100 divideint 1 1 -> 1 134dddvi101 divideint 1 2 -> 0 135dddvi102 divideint 1 3 -> 0 136dddvi103 divideint 1 4 -> 0 137dddvi104 divideint 1 5 -> 0 138dddvi105 divideint 1 6 -> 0 139dddvi106 divideint 1 7 -> 0 140dddvi107 divideint 1 8 -> 0 141dddvi108 divideint 1 9 -> 0 142dddvi109 divideint 1 10 -> 0 143dddvi110 divideint 1 1 -> 1 144dddvi111 divideint 2 1 -> 2 145dddvi112 divideint 3 1 -> 3 146dddvi113 divideint 4 1 -> 4 147dddvi114 divideint 5 1 -> 5 148dddvi115 divideint 6 1 -> 6 149dddvi116 divideint 7 1 -> 7 150dddvi117 divideint 8 1 -> 8 151dddvi118 divideint 9 1 -> 9 152dddvi119 divideint 10 1 -> 10 153 154-- from DiagBigDecimal 155dddvi131 divideint 101.3 1 -> 101 156dddvi132 divideint 101.0 1 -> 101 157dddvi133 divideint 101.3 3 -> 33 158dddvi134 divideint 101.0 3 -> 33 159dddvi135 divideint 2.4 1 -> 2 160dddvi136 divideint 2.400 1 -> 2 161dddvi137 divideint 18 18 -> 1 162dddvi138 divideint 1120 1000 -> 1 163dddvi139 divideint 2.4 2 -> 1 164dddvi140 divideint 2.400 2 -> 1 165dddvi141 divideint 0.5 2.000 -> 0 166dddvi142 divideint 8.005 7 -> 1 167dddvi143 divideint 5 2 -> 2 168dddvi144 divideint 0 2 -> 0 169dddvi145 divideint 0.00 2 -> 0 170 171-- Others 172dddvi150 divideint 12345 4.999 -> 2469 173dddvi151 divideint 12345 4.99 -> 2473 174dddvi152 divideint 12345 4.9 -> 2519 175dddvi153 divideint 12345 5 -> 2469 176dddvi154 divideint 12345 5.1 -> 2420 177dddvi155 divideint 12345 5.01 -> 2464 178dddvi156 divideint 12345 5.001 -> 2468 179dddvi157 divideint 101 7.6 -> 13 180 181-- Various flavours of divideint by 0 182dddvi201 divideint 0 0 -> NaN Division_undefined 183dddvi202 divideint 0.0E5 0 -> NaN Division_undefined 184dddvi203 divideint 0.000 0 -> NaN Division_undefined 185dddvi204 divideint 0.0001 0 -> Infinity Division_by_zero 186dddvi205 divideint 0.01 0 -> Infinity Division_by_zero 187dddvi206 divideint 0.1 0 -> Infinity Division_by_zero 188dddvi207 divideint 1 0 -> Infinity Division_by_zero 189dddvi208 divideint 1 0.0 -> Infinity Division_by_zero 190dddvi209 divideint 10 0.0 -> Infinity Division_by_zero 191dddvi210 divideint 1E+100 0.0 -> Infinity Division_by_zero 192dddvi211 divideint 1E+380 0 -> Infinity Division_by_zero 193dddvi214 divideint -0.0001 0 -> -Infinity Division_by_zero 194dddvi215 divideint -0.01 0 -> -Infinity Division_by_zero 195dddvi216 divideint -0.1 0 -> -Infinity Division_by_zero 196dddvi217 divideint -1 0 -> -Infinity Division_by_zero 197dddvi218 divideint -1 0.0 -> -Infinity Division_by_zero 198dddvi219 divideint -10 0.0 -> -Infinity Division_by_zero 199dddvi220 divideint -1E+100 0.0 -> -Infinity Division_by_zero 200dddvi221 divideint -1E+380 0 -> -Infinity Division_by_zero 201 202-- test some cases that are close to exponent overflow 203dddvi270 divideint 1 1e384 -> 0 204dddvi271 divideint 1 0.9e384 -> 0 205dddvi272 divideint 1 0.99e384 -> 0 206dddvi273 divideint 1 0.9999999999999999e384 -> 0 207dddvi274 divideint 9e384 1 -> NaN Division_impossible 208dddvi275 divideint 9.9e384 1 -> NaN Division_impossible 209dddvi276 divideint 9.99e384 1 -> NaN Division_impossible 210dddvi277 divideint 9.999999999999999e384 1 -> NaN Division_impossible 211 212dddvi280 divideint 0.1 9e-383 -> NaN Division_impossible 213dddvi281 divideint 0.1 99e-383 -> NaN Division_impossible 214dddvi282 divideint 0.1 999e-383 -> NaN Division_impossible 215dddvi283 divideint 0.1 9e-382 -> NaN Division_impossible 216dddvi284 divideint 0.1 99e-382 -> NaN Division_impossible 217 218-- GD edge cases: lhs smaller than rhs but more digits 219dddvi301 divideint 0.9 2 -> 0 220dddvi302 divideint 0.9 2.0 -> 0 221dddvi303 divideint 0.9 2.1 -> 0 222dddvi304 divideint 0.9 2.00 -> 0 223dddvi305 divideint 0.9 2.01 -> 0 224dddvi306 divideint 0.12 1 -> 0 225dddvi307 divideint 0.12 1.0 -> 0 226dddvi308 divideint 0.12 1.00 -> 0 227dddvi309 divideint 0.12 1.0 -> 0 228dddvi310 divideint 0.12 1.00 -> 0 229dddvi311 divideint 0.12 2 -> 0 230dddvi312 divideint 0.12 2.0 -> 0 231dddvi313 divideint 0.12 2.1 -> 0 232dddvi314 divideint 0.12 2.00 -> 0 233dddvi315 divideint 0.12 2.01 -> 0 234 235-- edge cases of impossible 236dddvi330 divideint 1234567890123456 10 -> 123456789012345 237dddvi331 divideint 1234567890123456 1 -> 1234567890123456 238dddvi332 divideint 1234567890123456 0.1 -> NaN Division_impossible 239dddvi333 divideint 1234567890123456 0.01 -> NaN Division_impossible 240 241-- overflow and underflow tests [from divide] 242dddvi1051 divideint 1e+277 1e-311 -> NaN Division_impossible 243dddvi1052 divideint 1e+277 -1e-311 -> NaN Division_impossible 244dddvi1053 divideint -1e+277 1e-311 -> NaN Division_impossible 245dddvi1054 divideint -1e+277 -1e-311 -> NaN Division_impossible 246dddvi1055 divideint 1e-277 1e+311 -> 0 247dddvi1056 divideint 1e-277 -1e+311 -> -0 248dddvi1057 divideint -1e-277 1e+311 -> -0 249dddvi1058 divideint -1e-277 -1e+311 -> 0 250 251-- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) 252dddvi1060 divideint 1e-291 1e+101 -> 0 253dddvi1061 divideint 1e-291 1e+102 -> 0 254dddvi1062 divideint 1e-291 1e+103 -> 0 255dddvi1063 divideint 1e-291 1e+104 -> 0 256dddvi1064 divideint 1e-291 1e+105 -> 0 257dddvi1065 divideint 1e-291 1e+106 -> 0 258dddvi1066 divideint 1e-291 1e+107 -> 0 259dddvi1067 divideint 1e-291 1e+108 -> 0 260dddvi1068 divideint 1e-291 1e+109 -> 0 261dddvi1069 divideint 1e-291 1e+110 -> 0 262 263dddvi1101 divideint 1.0000E-394 1 -> 0 264dddvi1102 divideint 1.000E-394 1e+1 -> 0 265dddvi1103 divideint 1.00E-394 1e+2 -> 0 266 267dddvi1118 divideint 1E-394 1e+4 -> 0 268dddvi1119 divideint 3E-394 -1e+5 -> -0 269dddvi1120 divideint 5E-394 1e+5 -> 0 270 271dddvi1124 divideint 1E-394 -1e+4 -> -0 272dddvi1130 divideint 3.0E-394 -1e+5 -> -0 273 274dddvi1131 divideint 1.0E-199 1e+200 -> 0 275dddvi1132 divideint 1.0E-199 1e+199 -> 0 276dddvi1133 divideint 1.0E-199 1e+198 -> 0 277dddvi1134 divideint 2.0E-199 2e+198 -> 0 278dddvi1135 divideint 4.0E-199 4e+198 -> 0 279 280-- long operand checks 281dddvi401 divideint 12345678000 100 -> 123456780 282dddvi402 divideint 1 12345678000 -> 0 283dddvi403 divideint 1234567800 10 -> 123456780 284dddvi404 divideint 1 1234567800 -> 0 285dddvi405 divideint 1234567890 10 -> 123456789 286dddvi406 divideint 1 1234567890 -> 0 287dddvi407 divideint 1234567891 10 -> 123456789 288dddvi408 divideint 1 1234567891 -> 0 289dddvi409 divideint 12345678901 100 -> 123456789 290dddvi410 divideint 1 12345678901 -> 0 291dddvi411 divideint 1234567896 10 -> 123456789 292dddvi412 divideint 1 1234567896 -> 0 293dddvi413 divideint 12345678948 100 -> 123456789 294dddvi414 divideint 12345678949 100 -> 123456789 295dddvi415 divideint 12345678950 100 -> 123456789 296dddvi416 divideint 12345678951 100 -> 123456789 297dddvi417 divideint 12345678999 100 -> 123456789 298dddvi441 divideint 12345678000 1 -> 12345678000 299dddvi442 divideint 1 12345678000 -> 0 300dddvi443 divideint 1234567800 1 -> 1234567800 301dddvi444 divideint 1 1234567800 -> 0 302dddvi445 divideint 1234567890 1 -> 1234567890 303dddvi446 divideint 1 1234567890 -> 0 304dddvi447 divideint 1234567891 1 -> 1234567891 305dddvi448 divideint 1 1234567891 -> 0 306dddvi449 divideint 12345678901 1 -> 12345678901 307dddvi450 divideint 1 12345678901 -> 0 308dddvi451 divideint 1234567896 1 -> 1234567896 309dddvi452 divideint 1 1234567896 -> 0 310 311-- more zeros, etc. 312dddvi531 divideint 5.00 1E-3 -> 5000 313dddvi532 divideint 00.00 0.000 -> NaN Division_undefined 314dddvi533 divideint 00.00 0E-3 -> NaN Division_undefined 315dddvi534 divideint 0 -0 -> NaN Division_undefined 316dddvi535 divideint -0 0 -> NaN Division_undefined 317dddvi536 divideint -0 -0 -> NaN Division_undefined 318 319dddvi541 divideint 0 -1 -> -0 320dddvi542 divideint -0 -1 -> 0 321dddvi543 divideint 0 1 -> 0 322dddvi544 divideint -0 1 -> -0 323dddvi545 divideint -1 0 -> -Infinity Division_by_zero 324dddvi546 divideint -1 -0 -> Infinity Division_by_zero 325dddvi547 divideint 1 0 -> Infinity Division_by_zero 326dddvi548 divideint 1 -0 -> -Infinity Division_by_zero 327 328dddvi551 divideint 0.0 -1 -> -0 329dddvi552 divideint -0.0 -1 -> 0 330dddvi553 divideint 0.0 1 -> 0 331dddvi554 divideint -0.0 1 -> -0 332dddvi555 divideint -1.0 0 -> -Infinity Division_by_zero 333dddvi556 divideint -1.0 -0 -> Infinity Division_by_zero 334dddvi557 divideint 1.0 0 -> Infinity Division_by_zero 335dddvi558 divideint 1.0 -0 -> -Infinity Division_by_zero 336 337dddvi561 divideint 0 -1.0 -> -0 338dddvi562 divideint -0 -1.0 -> 0 339dddvi563 divideint 0 1.0 -> 0 340dddvi564 divideint -0 1.0 -> -0 341dddvi565 divideint -1 0.0 -> -Infinity Division_by_zero 342dddvi566 divideint -1 -0.0 -> Infinity Division_by_zero 343dddvi567 divideint 1 0.0 -> Infinity Division_by_zero 344dddvi568 divideint 1 -0.0 -> -Infinity Division_by_zero 345 346dddvi571 divideint 0.0 -1.0 -> -0 347dddvi572 divideint -0.0 -1.0 -> 0 348dddvi573 divideint 0.0 1.0 -> 0 349dddvi574 divideint -0.0 1.0 -> -0 350dddvi575 divideint -1.0 0.0 -> -Infinity Division_by_zero 351dddvi576 divideint -1.0 -0.0 -> Infinity Division_by_zero 352dddvi577 divideint 1.0 0.0 -> Infinity Division_by_zero 353dddvi578 divideint 1.0 -0.0 -> -Infinity Division_by_zero 354 355-- Specials 356dddvi580 divideint Inf -Inf -> NaN Invalid_operation 357dddvi581 divideint Inf -1000 -> -Infinity 358dddvi582 divideint Inf -1 -> -Infinity 359dddvi583 divideint Inf -0 -> -Infinity 360dddvi584 divideint Inf 0 -> Infinity 361dddvi585 divideint Inf 1 -> Infinity 362dddvi586 divideint Inf 1000 -> Infinity 363dddvi587 divideint Inf Inf -> NaN Invalid_operation 364dddvi588 divideint -1000 Inf -> -0 365dddvi589 divideint -Inf Inf -> NaN Invalid_operation 366dddvi590 divideint -1 Inf -> -0 367dddvi591 divideint -0 Inf -> -0 368dddvi592 divideint 0 Inf -> 0 369dddvi593 divideint 1 Inf -> 0 370dddvi594 divideint 1000 Inf -> 0 371dddvi595 divideint Inf Inf -> NaN Invalid_operation 372 373dddvi600 divideint -Inf -Inf -> NaN Invalid_operation 374dddvi601 divideint -Inf -1000 -> Infinity 375dddvi602 divideint -Inf -1 -> Infinity 376dddvi603 divideint -Inf -0 -> Infinity 377dddvi604 divideint -Inf 0 -> -Infinity 378dddvi605 divideint -Inf 1 -> -Infinity 379dddvi606 divideint -Inf 1000 -> -Infinity 380dddvi607 divideint -Inf Inf -> NaN Invalid_operation 381dddvi608 divideint -1000 Inf -> -0 382dddvi609 divideint -Inf -Inf -> NaN Invalid_operation 383dddvi610 divideint -1 -Inf -> 0 384dddvi611 divideint -0 -Inf -> 0 385dddvi612 divideint 0 -Inf -> -0 386dddvi613 divideint 1 -Inf -> -0 387dddvi614 divideint 1000 -Inf -> -0 388dddvi615 divideint Inf -Inf -> NaN Invalid_operation 389 390dddvi621 divideint NaN -Inf -> NaN 391dddvi622 divideint NaN -1000 -> NaN 392dddvi623 divideint NaN -1 -> NaN 393dddvi624 divideint NaN -0 -> NaN 394dddvi625 divideint NaN 0 -> NaN 395dddvi626 divideint NaN 1 -> NaN 396dddvi627 divideint NaN 1000 -> NaN 397dddvi628 divideint NaN Inf -> NaN 398dddvi629 divideint NaN NaN -> NaN 399dddvi630 divideint -Inf NaN -> NaN 400dddvi631 divideint -1000 NaN -> NaN 401dddvi632 divideint -1 NaN -> NaN 402dddvi633 divideint -0 NaN -> NaN 403dddvi634 divideint 0 NaN -> NaN 404dddvi635 divideint 1 NaN -> NaN 405dddvi636 divideint 1000 NaN -> NaN 406dddvi637 divideint Inf NaN -> NaN 407 408dddvi641 divideint sNaN -Inf -> NaN Invalid_operation 409dddvi642 divideint sNaN -1000 -> NaN Invalid_operation 410dddvi643 divideint sNaN -1 -> NaN Invalid_operation 411dddvi644 divideint sNaN -0 -> NaN Invalid_operation 412dddvi645 divideint sNaN 0 -> NaN Invalid_operation 413dddvi646 divideint sNaN 1 -> NaN Invalid_operation 414dddvi647 divideint sNaN 1000 -> NaN Invalid_operation 415dddvi648 divideint sNaN NaN -> NaN Invalid_operation 416dddvi649 divideint sNaN sNaN -> NaN Invalid_operation 417dddvi650 divideint NaN sNaN -> NaN Invalid_operation 418dddvi651 divideint -Inf sNaN -> NaN Invalid_operation 419dddvi652 divideint -1000 sNaN -> NaN Invalid_operation 420dddvi653 divideint -1 sNaN -> NaN Invalid_operation 421dddvi654 divideint -0 sNaN -> NaN Invalid_operation 422dddvi655 divideint 0 sNaN -> NaN Invalid_operation 423dddvi656 divideint 1 sNaN -> NaN Invalid_operation 424dddvi657 divideint 1000 sNaN -> NaN Invalid_operation 425dddvi658 divideint Inf sNaN -> NaN Invalid_operation 426dddvi659 divideint NaN sNaN -> NaN Invalid_operation 427 428-- propagating NaNs 429dddvi661 divideint NaN9 -Inf -> NaN9 430dddvi662 divideint NaN8 1000 -> NaN8 431dddvi663 divideint NaN7 Inf -> NaN7 432dddvi664 divideint -NaN6 NaN5 -> -NaN6 433dddvi665 divideint -Inf NaN4 -> NaN4 434dddvi666 divideint -1000 NaN3 -> NaN3 435dddvi667 divideint Inf -NaN2 -> -NaN2 436 437dddvi671 divideint -sNaN99 -Inf -> -NaN99 Invalid_operation 438dddvi672 divideint sNaN98 -1 -> NaN98 Invalid_operation 439dddvi673 divideint sNaN97 NaN -> NaN97 Invalid_operation 440dddvi674 divideint sNaN96 sNaN94 -> NaN96 Invalid_operation 441dddvi675 divideint NaN95 sNaN93 -> NaN93 Invalid_operation 442dddvi676 divideint -Inf sNaN92 -> NaN92 Invalid_operation 443dddvi677 divideint 0 sNaN91 -> NaN91 Invalid_operation 444dddvi678 divideint Inf -sNaN90 -> -NaN90 Invalid_operation 445dddvi679 divideint NaN sNaN89 -> NaN89 Invalid_operation 446 447-- Null tests 448dddvi900 divideint 10 # -> NaN Invalid_operation 449dddvi901 divideint # 10 -> NaN Invalid_operation 450