1------------------------------------------------------------------------ 2-- divide.decTest -- decimal 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 22extended: 1 23precision: 9 24rounding: half_up 25maxExponent: 384 26minexponent: -383 27 28-- sanity checks 29divx001 divide 1 1 -> 1 30divx002 divide 2 1 -> 2 31divx003 divide 1 2 -> 0.5 32divx004 divide 2 2 -> 1 33divx005 divide 0 1 -> 0 34divx006 divide 0 2 -> 0 35divx007 divide 1 3 -> 0.333333333 Inexact Rounded 36divx008 divide 2 3 -> 0.666666667 Inexact Rounded 37divx009 divide 3 3 -> 1 38 39divx010 divide 2.4 1 -> 2.4 40divx011 divide 2.4 -1 -> -2.4 41divx012 divide -2.4 1 -> -2.4 42divx013 divide -2.4 -1 -> 2.4 43divx014 divide 2.40 1 -> 2.40 44divx015 divide 2.400 1 -> 2.400 45divx016 divide 2.4 2 -> 1.2 46divx017 divide 2.400 2 -> 1.200 47divx018 divide 2. 2 -> 1 48divx019 divide 20 20 -> 1 49 50divx020 divide 187 187 -> 1 51divx021 divide 5 2 -> 2.5 52divx022 divide 50 20 -> 2.5 53divx023 divide 500 200 -> 2.5 54divx024 divide 50.0 20.0 -> 2.5 55divx025 divide 5.00 2.00 -> 2.5 56divx026 divide 5 2.0 -> 2.5 57divx027 divide 5 2.000 -> 2.5 58divx028 divide 5 0.20 -> 25 59divx029 divide 5 0.200 -> 25 60divx030 divide 10 1 -> 10 61divx031 divide 100 1 -> 100 62divx032 divide 1000 1 -> 1000 63divx033 divide 1000 100 -> 10 64 65divx035 divide 1 2 -> 0.5 66divx036 divide 1 4 -> 0.25 67divx037 divide 1 8 -> 0.125 68divx038 divide 1 16 -> 0.0625 69divx039 divide 1 32 -> 0.03125 70divx040 divide 1 64 -> 0.015625 71divx041 divide 1 -2 -> -0.5 72divx042 divide 1 -4 -> -0.25 73divx043 divide 1 -8 -> -0.125 74divx044 divide 1 -16 -> -0.0625 75divx045 divide 1 -32 -> -0.03125 76divx046 divide 1 -64 -> -0.015625 77divx047 divide -1 2 -> -0.5 78divx048 divide -1 4 -> -0.25 79divx049 divide -1 8 -> -0.125 80divx050 divide -1 16 -> -0.0625 81divx051 divide -1 32 -> -0.03125 82divx052 divide -1 64 -> -0.015625 83divx053 divide -1 -2 -> 0.5 84divx054 divide -1 -4 -> 0.25 85divx055 divide -1 -8 -> 0.125 86divx056 divide -1 -16 -> 0.0625 87divx057 divide -1 -32 -> 0.03125 88divx058 divide -1 -64 -> 0.015625 89 90divx070 divide 999999999 1 -> 999999999 91divx071 divide 999999999.4 1 -> 999999999 Inexact Rounded 92divx072 divide 999999999.5 1 -> 1.00000000E+9 Inexact Rounded 93divx073 divide 999999999.9 1 -> 1.00000000E+9 Inexact Rounded 94divx074 divide 999999999.999 1 -> 1.00000000E+9 Inexact Rounded 95precision: 6 96divx080 divide 999999999 1 -> 1.00000E+9 Inexact Rounded 97divx081 divide 99999999 1 -> 1.00000E+8 Inexact Rounded 98divx082 divide 9999999 1 -> 1.00000E+7 Inexact Rounded 99divx083 divide 999999 1 -> 999999 100divx084 divide 99999 1 -> 99999 101divx085 divide 9999 1 -> 9999 102divx086 divide 999 1 -> 999 103divx087 divide 99 1 -> 99 104divx088 divide 9 1 -> 9 105 106precision: 9 107divx090 divide 0. 1 -> 0 108divx091 divide .0 1 -> 0.0 109divx092 divide 0.00 1 -> 0.00 110divx093 divide 0.00E+9 1 -> 0E+7 111divx094 divide 0.0000E-50 1 -> 0E-54 112 113divx095 divide 1 1E-8 -> 1E+8 114divx096 divide 1 1E-9 -> 1E+9 115divx097 divide 1 1E-10 -> 1E+10 116divx098 divide 1 1E-11 -> 1E+11 117divx099 divide 1 1E-12 -> 1E+12 118 119divx100 divide 1 1 -> 1 120divx101 divide 1 2 -> 0.5 121divx102 divide 1 3 -> 0.333333333 Inexact Rounded 122divx103 divide 1 4 -> 0.25 123divx104 divide 1 5 -> 0.2 124divx105 divide 1 6 -> 0.166666667 Inexact Rounded 125divx106 divide 1 7 -> 0.142857143 Inexact Rounded 126divx107 divide 1 8 -> 0.125 127divx108 divide 1 9 -> 0.111111111 Inexact Rounded 128divx109 divide 1 10 -> 0.1 129divx110 divide 1 1 -> 1 130divx111 divide 2 1 -> 2 131divx112 divide 3 1 -> 3 132divx113 divide 4 1 -> 4 133divx114 divide 5 1 -> 5 134divx115 divide 6 1 -> 6 135divx116 divide 7 1 -> 7 136divx117 divide 8 1 -> 8 137divx118 divide 9 1 -> 9 138divx119 divide 10 1 -> 10 139 140divx120 divide 3E+1 0.001 -> 3E+4 141divx121 divide 2.200 2 -> 1.100 142 143divx130 divide 12345 4.999 -> 2469.49390 Inexact Rounded 144divx131 divide 12345 4.99 -> 2473.94790 Inexact Rounded 145divx132 divide 12345 4.9 -> 2519.38776 Inexact Rounded 146divx133 divide 12345 5 -> 2469 147divx134 divide 12345 5.1 -> 2420.58824 Inexact Rounded 148divx135 divide 12345 5.01 -> 2464.07186 Inexact Rounded 149divx136 divide 12345 5.001 -> 2468.50630 Inexact Rounded 150 151precision: 9 152maxexponent: 999999999 153minexponent: -999999999 154 155-- test possibly imprecise results 156divx220 divide 391 597 -> 0.654941374 Inexact Rounded 157divx221 divide 391 -597 -> -0.654941374 Inexact Rounded 158divx222 divide -391 597 -> -0.654941374 Inexact Rounded 159divx223 divide -391 -597 -> 0.654941374 Inexact Rounded 160 161-- test some cases that are close to exponent overflow 162maxexponent: 999999999 163minexponent: -999999999 164divx270 divide 1 1e999999999 -> 1E-999999999 165divx271 divide 1 0.9e999999999 -> 1.11111111E-999999999 Inexact Rounded 166divx272 divide 1 0.99e999999999 -> 1.01010101E-999999999 Inexact Rounded 167divx273 divide 1 0.999999999e999999999 -> 1.00000000E-999999999 Inexact Rounded 168divx274 divide 9e999999999 1 -> 9E+999999999 169divx275 divide 9.9e999999999 1 -> 9.9E+999999999 170divx276 divide 9.99e999999999 1 -> 9.99E+999999999 171divx277 divide 9.99999999e999999999 1 -> 9.99999999E+999999999 172 173divx280 divide 0.1 9e-999999999 -> 1.11111111E+999999997 Inexact Rounded 174divx281 divide 0.1 99e-999999999 -> 1.01010101E+999999996 Inexact Rounded 175divx282 divide 0.1 999e-999999999 -> 1.00100100E+999999995 Inexact Rounded 176 177divx283 divide 0.1 9e-999999998 -> 1.11111111E+999999996 Inexact Rounded 178divx284 divide 0.1 99e-999999998 -> 1.01010101E+999999995 Inexact Rounded 179divx285 divide 0.1 999e-999999998 -> 1.00100100E+999999994 Inexact Rounded 180divx286 divide 0.1 999e-999999997 -> 1.00100100E+999999993 Inexact Rounded 181divx287 divide 0.1 9999e-999999997 -> 1.00010001E+999999992 Inexact Rounded 182divx288 divide 0.1 99999e-999999997 -> 1.00001000E+999999991 Inexact Rounded 183 184-- Divide into 0 tests 185 186divx301 divide 0 7 -> 0 187divx302 divide 0 7E-5 -> 0E+5 188divx303 divide 0 7E-1 -> 0E+1 189divx304 divide 0 7E+1 -> 0.0 190divx305 divide 0 7E+5 -> 0.00000 191divx306 divide 0 7E+6 -> 0.000000 192divx307 divide 0 7E+7 -> 0E-7 193divx308 divide 0 70E-5 -> 0E+5 194divx309 divide 0 70E-1 -> 0E+1 195divx310 divide 0 70E+0 -> 0 196divx311 divide 0 70E+1 -> 0.0 197divx312 divide 0 70E+5 -> 0.00000 198divx313 divide 0 70E+6 -> 0.000000 199divx314 divide 0 70E+7 -> 0E-7 200divx315 divide 0 700E-5 -> 0E+5 201divx316 divide 0 700E-1 -> 0E+1 202divx317 divide 0 700E+0 -> 0 203divx318 divide 0 700E+1 -> 0.0 204divx319 divide 0 700E+5 -> 0.00000 205divx320 divide 0 700E+6 -> 0.000000 206divx321 divide 0 700E+7 -> 0E-7 207divx322 divide 0 700E+77 -> 0E-77 208 209divx331 divide 0E-3 7E-5 -> 0E+2 210divx332 divide 0E-3 7E-1 -> 0.00 211divx333 divide 0E-3 7E+1 -> 0.0000 212divx334 divide 0E-3 7E+5 -> 0E-8 213divx335 divide 0E-1 7E-5 -> 0E+4 214divx336 divide 0E-1 7E-1 -> 0 215divx337 divide 0E-1 7E+1 -> 0.00 216divx338 divide 0E-1 7E+5 -> 0.000000 217divx339 divide 0E+1 7E-5 -> 0E+6 218divx340 divide 0E+1 7E-1 -> 0E+2 219divx341 divide 0E+1 7E+1 -> 0 220divx342 divide 0E+1 7E+5 -> 0.0000 221divx343 divide 0E+3 7E-5 -> 0E+8 222divx344 divide 0E+3 7E-1 -> 0E+4 223divx345 divide 0E+3 7E+1 -> 0E+2 224divx346 divide 0E+3 7E+5 -> 0.00 225 226maxexponent: 92 227minexponent: -92 228precision: 7 229divx351 divide 0E-92 7E-1 -> 0E-91 230divx352 divide 0E-92 7E+1 -> 0E-93 231divx353 divide 0E-92 7E+5 -> 0E-97 232divx354 divide 0E-92 7E+6 -> 0E-98 233divx355 divide 0E-92 7E+7 -> 0E-98 Clamped 234divx356 divide 0E-92 777E-1 -> 0E-91 235divx357 divide 0E-92 777E+1 -> 0E-93 236divx358 divide 0E-92 777E+3 -> 0E-95 237divx359 divide 0E-92 777E+4 -> 0E-96 238divx360 divide 0E-92 777E+5 -> 0E-97 239divx361 divide 0E-92 777E+6 -> 0E-98 240divx362 divide 0E-92 777E+7 -> 0E-98 Clamped 241divx363 divide 0E-92 7E+92 -> 0E-98 Clamped 242 243divx371 divide 0E-92 700E-1 -> 0E-91 244divx372 divide 0E-92 700E+1 -> 0E-93 245divx373 divide 0E-92 700E+3 -> 0E-95 246divx374 divide 0E-92 700E+4 -> 0E-96 247divx375 divide 0E-92 700E+5 -> 0E-97 248divx376 divide 0E-92 700E+6 -> 0E-98 249divx377 divide 0E-92 700E+7 -> 0E-98 Clamped 250 251divx381 divide 0E+92 7E+1 -> 0E+91 252divx382 divide 0E+92 7E+0 -> 0E+92 253divx383 divide 0E+92 7E-1 -> 0E+92 Clamped 254divx384 divide 0E+90 777E+1 -> 0E+89 255divx385 divide 0E+90 777E-1 -> 0E+91 256divx386 divide 0E+90 777E-2 -> 0E+92 257divx387 divide 0E+90 777E-3 -> 0E+92 Clamped 258divx388 divide 0E+90 777E-4 -> 0E+92 Clamped 259 260divx391 divide 0E+90 700E+1 -> 0E+89 261divx392 divide 0E+90 700E-1 -> 0E+91 262divx393 divide 0E+90 700E-2 -> 0E+92 263divx394 divide 0E+90 700E-3 -> 0E+92 Clamped 264divx395 divide 0E+90 700E-4 -> 0E+92 Clamped 265 266-- input rounding checks 267maxexponent: 999 268minexponent: -999 269precision: 9 270divx401 divide 12345678000 1 -> 1.23456780E+10 Rounded 271divx402 divide 1 12345678000 -> 8.10000066E-11 Inexact Rounded 272divx403 divide 1234567800 1 -> 1.23456780E+9 Rounded 273divx404 divide 1 1234567800 -> 8.10000066E-10 Inexact Rounded 274divx405 divide 1234567890 1 -> 1.23456789E+9 Rounded 275divx406 divide 1 1234567890 -> 8.10000007E-10 Inexact Rounded 276divx407 divide 1234567891 1 -> 1.23456789E+9 Inexact Rounded 277divx408 divide 1 1234567891 -> 8.10000007E-10 Inexact Rounded 278divx409 divide 12345678901 1 -> 1.23456789E+10 Inexact Rounded 279divx410 divide 1 12345678901 -> 8.10000007E-11 Inexact Rounded 280divx411 divide 1234567896 1 -> 1.23456790E+9 Inexact Rounded 281divx412 divide 1 1234567896 -> 8.10000003E-10 Inexact Rounded 282divx413 divide 1 1234567897 -> 8.10000003E-10 Inexact Rounded 283divx414 divide 1 1234567898 -> 8.10000002E-10 Inexact Rounded 284divx415 divide 1 1234567899 -> 8.10000001E-10 Inexact Rounded 285divx416 divide 1 1234567900 -> 8.10000001E-10 Inexact Rounded 286divx417 divide 1 1234567901 -> 8.10000000E-10 Inexact Rounded 287divx418 divide 1 1234567902 -> 8.09999999E-10 Inexact Rounded 288-- some longies 289divx421 divide 1234567896.000000000000 1 -> 1.23456790E+9 Inexact Rounded 290divx422 divide 1 1234567896.000000000000 -> 8.10000003E-10 Inexact Rounded 291divx423 divide 1234567896.000000000001 1 -> 1.23456790E+9 Inexact Rounded 292divx424 divide 1 1234567896.000000000001 -> 8.10000003E-10 Inexact Rounded 293divx425 divide 1234567896.000000000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded 294divx426 divide 1 1234567896.000000000000000000000000000000000000000009 -> 8.10000003E-10 Inexact Rounded 295divx427 divide 1234567897.900010000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded 296divx428 divide 1 1234567897.900010000000000000000000000000000000000009 -> 8.10000002E-10 Inexact Rounded 297 298precision: 15 299-- still checking... 300divx441 divide 12345678000 1 -> 12345678000 301divx442 divide 1 12345678000 -> 8.10000066420005E-11 Inexact Rounded 302divx443 divide 1234567800 1 -> 1234567800 303divx444 divide 1 1234567800 -> 8.10000066420005E-10 Inexact Rounded 304divx445 divide 1234567890 1 -> 1234567890 305divx446 divide 1 1234567890 -> 8.10000007371000E-10 Inexact Rounded 306divx447 divide 1234567891 1 -> 1234567891 307divx448 divide 1 1234567891 -> 8.10000006714900E-10 Inexact Rounded 308divx449 divide 12345678901 1 -> 12345678901 309divx450 divide 1 12345678901 -> 8.10000007305390E-11 Inexact Rounded 310divx451 divide 1234567896 1 -> 1234567896 311divx452 divide 1 1234567896 -> 8.10000003434400E-10 Inexact Rounded 312 313-- high-lows 314divx453 divide 1e+1 1 -> 1E+1 315divx454 divide 1e+1 1.0 -> 1E+1 316divx455 divide 1e+1 1.00 -> 1E+1 317divx456 divide 1e+2 2 -> 5E+1 318divx457 divide 1e+2 2.0 -> 5E+1 319divx458 divide 1e+2 2.00 -> 5E+1 320 321-- some from IEEE discussions 322divx460 divide 3e0 2e0 -> 1.5 323divx461 divide 30e-1 2e0 -> 1.5 324divx462 divide 300e-2 2e0 -> 1.50 325divx464 divide 3000e-3 2e0 -> 1.500 326divx465 divide 3e0 20e-1 -> 1.5 327divx466 divide 30e-1 20e-1 -> 1.5 328divx467 divide 300e-2 20e-1 -> 1.5 329divx468 divide 3000e-3 20e-1 -> 1.50 330divx469 divide 3e0 200e-2 -> 1.5 331divx470 divide 30e-1 200e-2 -> 1.5 332divx471 divide 300e-2 200e-2 -> 1.5 333divx472 divide 3000e-3 200e-2 -> 1.5 334divx473 divide 3e0 2000e-3 -> 1.5 335divx474 divide 30e-1 2000e-3 -> 1.5 336divx475 divide 300e-2 2000e-3 -> 1.5 337divx476 divide 3000e-3 2000e-3 -> 1.5 338 339-- some reciprocals 340divx480 divide 1 1.0E+33 -> 1E-33 341divx481 divide 1 10E+33 -> 1E-34 342divx482 divide 1 1.0E-33 -> 1E+33 343divx483 divide 1 10E-33 -> 1E+32 344 345-- RMS discussion table 346maxexponent: 96 347minexponent: -95 348precision: 7 349 350divx484 divide 0e5 1e3 -> 0E+2 351divx485 divide 0e5 2e3 -> 0E+2 352divx486 divide 0e5 10e2 -> 0E+3 353divx487 divide 0e5 20e2 -> 0E+3 354divx488 divide 0e5 100e1 -> 0E+4 355divx489 divide 0e5 200e1 -> 0E+4 356 357divx491 divide 1e5 1e3 -> 1E+2 358divx492 divide 1e5 2e3 -> 5E+1 359divx493 divide 1e5 10e2 -> 1E+2 360divx494 divide 1e5 20e2 -> 5E+1 361divx495 divide 1e5 100e1 -> 1E+2 362divx496 divide 1e5 200e1 -> 5E+1 363 364-- tryzeros cases 365precision: 7 366rounding: half_up 367maxExponent: 92 368minexponent: -92 369divx497 divide 0E+86 1000E-13 -> 0E+92 Clamped 370divx498 divide 0E-98 1000E+13 -> 0E-98 Clamped 371 372precision: 9 373rounding: half_up 374maxExponent: 999 375minexponent: -999 376 377-- focus on trailing zeros issues 378precision: 9 379divx500 divide 1 9.9 -> 0.101010101 Inexact Rounded 380precision: 8 381divx501 divide 1 9.9 -> 0.10101010 Inexact Rounded 382precision: 7 383divx502 divide 1 9.9 -> 0.1010101 Inexact Rounded 384precision: 6 385divx503 divide 1 9.9 -> 0.101010 Inexact Rounded 386precision: 9 387 388divx511 divide 1 2 -> 0.5 389divx512 divide 1.0 2 -> 0.5 390divx513 divide 1.00 2 -> 0.50 391divx514 divide 1.000 2 -> 0.500 392divx515 divide 1.0000 2 -> 0.5000 393divx516 divide 1.00000 2 -> 0.50000 394divx517 divide 1.000000 2 -> 0.500000 395divx518 divide 1.0000000 2 -> 0.5000000 396divx519 divide 1.00 2.00 -> 0.5 397 398divx521 divide 2 1 -> 2 399divx522 divide 2 1.0 -> 2 400divx523 divide 2 1.00 -> 2 401divx524 divide 2 1.000 -> 2 402divx525 divide 2 1.0000 -> 2 403divx526 divide 2 1.00000 -> 2 404divx527 divide 2 1.000000 -> 2 405divx528 divide 2 1.0000000 -> 2 406divx529 divide 2.00 1.00 -> 2 407 408divx530 divide 2.40 2 -> 1.20 409divx531 divide 2.40 4 -> 0.60 410divx532 divide 2.40 10 -> 0.24 411divx533 divide 2.40 2.0 -> 1.2 412divx534 divide 2.40 4.0 -> 0.6 413divx535 divide 2.40 10.0 -> 0.24 414divx536 divide 2.40 2.00 -> 1.2 415divx537 divide 2.40 4.00 -> 0.6 416divx538 divide 2.40 10.00 -> 0.24 417divx539 divide 0.9 0.1 -> 9 418divx540 divide 0.9 0.01 -> 9E+1 419divx541 divide 0.9 0.001 -> 9E+2 420divx542 divide 5 2 -> 2.5 421divx543 divide 5 2.0 -> 2.5 422divx544 divide 5 2.00 -> 2.5 423divx545 divide 5 20 -> 0.25 424divx546 divide 5 20.0 -> 0.25 425divx547 divide 2.400 2 -> 1.200 426divx548 divide 2.400 2.0 -> 1.20 427divx549 divide 2.400 2.400 -> 1 428 429divx550 divide 240 1 -> 240 430divx551 divide 240 10 -> 24 431divx552 divide 240 100 -> 2.4 432divx553 divide 240 1000 -> 0.24 433divx554 divide 2400 1 -> 2400 434divx555 divide 2400 10 -> 240 435divx556 divide 2400 100 -> 24 436divx557 divide 2400 1000 -> 2.4 437 438-- +ve exponent 439precision: 5 440divx570 divide 2.4E+6 2 -> 1.2E+6 441divx571 divide 2.40E+6 2 -> 1.20E+6 442divx572 divide 2.400E+6 2 -> 1.200E+6 443divx573 divide 2.4000E+6 2 -> 1.2000E+6 444divx574 divide 24E+5 2 -> 1.2E+6 445divx575 divide 240E+4 2 -> 1.20E+6 446divx576 divide 2400E+3 2 -> 1.200E+6 447divx577 divide 24000E+2 2 -> 1.2000E+6 448precision: 6 449divx580 divide 2.4E+6 2 -> 1.2E+6 450divx581 divide 2.40E+6 2 -> 1.20E+6 451divx582 divide 2.400E+6 2 -> 1.200E+6 452divx583 divide 2.4000E+6 2 -> 1.2000E+6 453divx584 divide 24E+5 2 -> 1.2E+6 454divx585 divide 240E+4 2 -> 1.20E+6 455divx586 divide 2400E+3 2 -> 1.200E+6 456divx587 divide 24000E+2 2 -> 1.2000E+6 457precision: 7 458divx590 divide 2.4E+6 2 -> 1.2E+6 459divx591 divide 2.40E+6 2 -> 1.20E+6 460divx592 divide 2.400E+6 2 -> 1.200E+6 461divx593 divide 2.4000E+6 2 -> 1.2000E+6 462divx594 divide 24E+5 2 -> 1.2E+6 463divx595 divide 240E+4 2 -> 1.20E+6 464divx596 divide 2400E+3 2 -> 1.200E+6 465divx597 divide 24000E+2 2 -> 1.2000E+6 466precision: 9 467divx600 divide 2.4E+9 2 -> 1.2E+9 468divx601 divide 2.40E+9 2 -> 1.20E+9 469divx602 divide 2.400E+9 2 -> 1.200E+9 470divx603 divide 2.4000E+9 2 -> 1.2000E+9 471divx604 divide 24E+8 2 -> 1.2E+9 472divx605 divide 240E+7 2 -> 1.20E+9 473divx606 divide 2400E+6 2 -> 1.200E+9 474divx607 divide 24000E+5 2 -> 1.2000E+9 475 476-- long operand triangle 477precision: 33 478divx610 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097703792 Inexact Rounded 479precision: 32 480divx611 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770379 Inexact Rounded 481precision: 31 482divx612 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977038 Inexact Rounded 483precision: 30 484divx613 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097704 Inexact Rounded 485precision: 29 486divx614 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770 Inexact Rounded 487precision: 28 488divx615 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977 Inexact Rounded 489precision: 27 490divx616 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131098 Inexact Rounded 491precision: 26 492divx617 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813110 Inexact Rounded 493precision: 25 494divx618 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81311 Inexact Rounded 495precision: 24 496divx619 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131 Inexact Rounded 497precision: 23 498divx620 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813 Inexact Rounded 499precision: 22 500divx621 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81 Inexact Rounded 501precision: 21 502divx622 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8 Inexact Rounded 503precision: 20 504divx623 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817798 Inexact Rounded 505precision: 19 506divx624 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379681780E+19 Inexact Rounded 507precision: 18 508divx625 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968178E+19 Inexact Rounded 509precision: 17 510divx626 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883796818E+19 Inexact Rounded 511precision: 16 512divx627 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379682E+19 Inexact Rounded 513precision: 15 514divx628 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968E+19 Inexact Rounded 515precision: 14 516divx629 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883797E+19 Inexact Rounded 517precision: 13 518divx630 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888380E+19 Inexact Rounded 519precision: 12 520divx631 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088838E+19 Inexact Rounded 521precision: 11 522divx632 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408884E+19 Inexact Rounded 523precision: 10 524divx633 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888E+19 Inexact Rounded 525precision: 9 526divx634 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114089E+19 Inexact Rounded 527precision: 8 528divx635 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011409E+19 Inexact Rounded 529precision: 7 530divx636 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101141E+19 Inexact Rounded 531precision: 6 532divx637 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114E+19 Inexact Rounded 533precision: 5 534divx638 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011E+19 Inexact Rounded 535precision: 4 536divx639 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101E+19 Inexact Rounded 537precision: 3 538divx640 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10E+19 Inexact Rounded 539precision: 2 540divx641 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1E+19 Inexact Rounded 541precision: 1 542divx642 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4E+19 Inexact Rounded 543 544-- more zeros, etc. 545precision: 16 546rounding: half_up 547maxExponent: 384 548minExponent: -383 549 550divx731 divide 5.00 1E-3 -> 5.00E+3 551divx732 divide 00.00 0.000 -> NaN Division_undefined 552divx733 divide 00.00 0E-3 -> NaN Division_undefined 553divx734 divide 0 -0 -> NaN Division_undefined 554divx735 divide -0 0 -> NaN Division_undefined 555divx736 divide -0 -0 -> NaN Division_undefined 556 557divx741 divide 0 -1 -> -0 558divx742 divide -0 -1 -> 0 559divx743 divide 0 1 -> 0 560divx744 divide -0 1 -> -0 561divx745 divide -1 0 -> -Infinity Division_by_zero 562divx746 divide -1 -0 -> Infinity Division_by_zero 563divx747 divide 1 0 -> Infinity Division_by_zero 564divx748 divide 1 -0 -> -Infinity Division_by_zero 565 566divx751 divide 0.0 -1 -> -0.0 567divx752 divide -0.0 -1 -> 0.0 568divx753 divide 0.0 1 -> 0.0 569divx754 divide -0.0 1 -> -0.0 570divx755 divide -1.0 0 -> -Infinity Division_by_zero 571divx756 divide -1.0 -0 -> Infinity Division_by_zero 572divx757 divide 1.0 0 -> Infinity Division_by_zero 573divx758 divide 1.0 -0 -> -Infinity Division_by_zero 574 575divx761 divide 0 -1.0 -> -0E+1 576divx762 divide -0 -1.0 -> 0E+1 577divx763 divide 0 1.0 -> 0E+1 578divx764 divide -0 1.0 -> -0E+1 579divx765 divide -1 0.0 -> -Infinity Division_by_zero 580divx766 divide -1 -0.0 -> Infinity Division_by_zero 581divx767 divide 1 0.0 -> Infinity Division_by_zero 582divx768 divide 1 -0.0 -> -Infinity Division_by_zero 583 584divx771 divide 0.0 -1.0 -> -0 585divx772 divide -0.0 -1.0 -> 0 586divx773 divide 0.0 1.0 -> 0 587divx774 divide -0.0 1.0 -> -0 588divx775 divide -1.0 0.0 -> -Infinity Division_by_zero 589divx776 divide -1.0 -0.0 -> Infinity Division_by_zero 590divx777 divide 1.0 0.0 -> Infinity Division_by_zero 591divx778 divide 1.0 -0.0 -> -Infinity Division_by_zero 592 593-- Specials 594divx780 divide Inf -Inf -> NaN Invalid_operation 595divx781 divide Inf -1000 -> -Infinity 596divx782 divide Inf -1 -> -Infinity 597divx783 divide Inf -0 -> -Infinity 598divx784 divide Inf 0 -> Infinity 599divx785 divide Inf 1 -> Infinity 600divx786 divide Inf 1000 -> Infinity 601divx787 divide Inf Inf -> NaN Invalid_operation 602divx788 divide -1000 Inf -> -0E-398 Clamped 603divx789 divide -Inf Inf -> NaN Invalid_operation 604divx790 divide -1 Inf -> -0E-398 Clamped 605divx791 divide -0 Inf -> -0E-398 Clamped 606divx792 divide 0 Inf -> 0E-398 Clamped 607divx793 divide 1 Inf -> 0E-398 Clamped 608divx794 divide 1000 Inf -> 0E-398 Clamped 609divx795 divide Inf Inf -> NaN Invalid_operation 610 611divx800 divide -Inf -Inf -> NaN Invalid_operation 612divx801 divide -Inf -1000 -> Infinity 613divx802 divide -Inf -1 -> Infinity 614divx803 divide -Inf -0 -> Infinity 615divx804 divide -Inf 0 -> -Infinity 616divx805 divide -Inf 1 -> -Infinity 617divx806 divide -Inf 1000 -> -Infinity 618divx807 divide -Inf Inf -> NaN Invalid_operation 619divx808 divide -1000 Inf -> -0E-398 Clamped 620divx809 divide -Inf -Inf -> NaN Invalid_operation 621divx810 divide -1 -Inf -> 0E-398 Clamped 622divx811 divide -0 -Inf -> 0E-398 Clamped 623divx812 divide 0 -Inf -> -0E-398 Clamped 624divx813 divide 1 -Inf -> -0E-398 Clamped 625divx814 divide 1000 -Inf -> -0E-398 Clamped 626divx815 divide Inf -Inf -> NaN Invalid_operation 627 628divx821 divide NaN -Inf -> NaN 629divx822 divide NaN -1000 -> NaN 630divx823 divide NaN -1 -> NaN 631divx824 divide NaN -0 -> NaN 632divx825 divide NaN 0 -> NaN 633divx826 divide NaN 1 -> NaN 634divx827 divide NaN 1000 -> NaN 635divx828 divide NaN Inf -> NaN 636divx829 divide NaN NaN -> NaN 637divx830 divide -Inf NaN -> NaN 638divx831 divide -1000 NaN -> NaN 639divx832 divide -1 NaN -> NaN 640divx833 divide -0 NaN -> NaN 641divx834 divide 0 NaN -> NaN 642divx835 divide 1 NaN -> NaN 643divx836 divide 1000 NaN -> NaN 644divx837 divide Inf NaN -> NaN 645 646divx841 divide sNaN -Inf -> NaN Invalid_operation 647divx842 divide sNaN -1000 -> NaN Invalid_operation 648divx843 divide sNaN -1 -> NaN Invalid_operation 649divx844 divide sNaN -0 -> NaN Invalid_operation 650divx845 divide sNaN 0 -> NaN Invalid_operation 651divx846 divide sNaN 1 -> NaN Invalid_operation 652divx847 divide sNaN 1000 -> NaN Invalid_operation 653divx848 divide sNaN NaN -> NaN Invalid_operation 654divx849 divide sNaN sNaN -> NaN Invalid_operation 655divx850 divide NaN sNaN -> NaN Invalid_operation 656divx851 divide -Inf sNaN -> NaN Invalid_operation 657divx852 divide -1000 sNaN -> NaN Invalid_operation 658divx853 divide -1 sNaN -> NaN Invalid_operation 659divx854 divide -0 sNaN -> NaN Invalid_operation 660divx855 divide 0 sNaN -> NaN Invalid_operation 661divx856 divide 1 sNaN -> NaN Invalid_operation 662divx857 divide 1000 sNaN -> NaN Invalid_operation 663divx858 divide Inf sNaN -> NaN Invalid_operation 664divx859 divide NaN sNaN -> NaN Invalid_operation 665 666-- propagating NaNs 667divx861 divide NaN9 -Inf -> NaN9 668divx862 divide NaN8 1000 -> NaN8 669divx863 divide NaN7 Inf -> NaN7 670divx864 divide NaN6 NaN5 -> NaN6 671divx865 divide -Inf NaN4 -> NaN4 672divx866 divide -1000 NaN3 -> NaN3 673divx867 divide Inf NaN2 -> NaN2 674 675divx871 divide sNaN99 -Inf -> NaN99 Invalid_operation 676divx872 divide sNaN98 -1 -> NaN98 Invalid_operation 677divx873 divide sNaN97 NaN -> NaN97 Invalid_operation 678divx874 divide sNaN96 sNaN94 -> NaN96 Invalid_operation 679divx875 divide NaN95 sNaN93 -> NaN93 Invalid_operation 680divx876 divide -Inf sNaN92 -> NaN92 Invalid_operation 681divx877 divide 0 sNaN91 -> NaN91 Invalid_operation 682divx878 divide Inf sNaN90 -> NaN90 Invalid_operation 683divx879 divide NaN sNaN89 -> NaN89 Invalid_operation 684 685divx881 divide -NaN9 -Inf -> -NaN9 686divx882 divide -NaN8 1000 -> -NaN8 687divx883 divide -NaN7 Inf -> -NaN7 688divx884 divide -NaN6 -NaN5 -> -NaN6 689divx885 divide -Inf -NaN4 -> -NaN4 690divx886 divide -1000 -NaN3 -> -NaN3 691divx887 divide Inf -NaN2 -> -NaN2 692 693divx891 divide -sNaN99 -Inf -> -NaN99 Invalid_operation 694divx892 divide -sNaN98 -1 -> -NaN98 Invalid_operation 695divx893 divide -sNaN97 NaN -> -NaN97 Invalid_operation 696divx894 divide -sNaN96 -sNaN94 -> -NaN96 Invalid_operation 697divx895 divide -NaN95 -sNaN93 -> -NaN93 Invalid_operation 698divx896 divide -Inf -sNaN92 -> -NaN92 Invalid_operation 699divx897 divide 0 -sNaN91 -> -NaN91 Invalid_operation 700divx898 divide Inf -sNaN90 -> -NaN90 Invalid_operation 701divx899 divide -NaN -sNaN89 -> -NaN89 Invalid_operation 702 703maxexponent: 999999999 704minexponent: -999999999 705 706-- Various flavours of divide by 0 707divx901 divide 0 0 -> NaN Division_undefined 708divx902 divide 0.0E5 0 -> NaN Division_undefined 709divx903 divide 0.000 0 -> NaN Division_undefined 710divx904 divide 0.0001 0 -> Infinity Division_by_zero 711divx905 divide 0.01 0 -> Infinity Division_by_zero 712divx906 divide 0.1 0 -> Infinity Division_by_zero 713divx907 divide 1 0 -> Infinity Division_by_zero 714divx908 divide 1 0.0 -> Infinity Division_by_zero 715divx909 divide 10 0.0 -> Infinity Division_by_zero 716divx910 divide 1E+100 0.0 -> Infinity Division_by_zero 717divx911 divide 1E+1000 0 -> Infinity Division_by_zero 718 719divx921 divide -0.0001 0 -> -Infinity Division_by_zero 720divx922 divide -0.01 0 -> -Infinity Division_by_zero 721divx923 divide -0.1 0 -> -Infinity Division_by_zero 722divx924 divide -1 0 -> -Infinity Division_by_zero 723divx925 divide -1 0.0 -> -Infinity Division_by_zero 724divx926 divide -10 0.0 -> -Infinity Division_by_zero 725divx927 divide -1E+100 0.0 -> -Infinity Division_by_zero 726divx928 divide -1E+1000 0 -> -Infinity Division_by_zero 727 728divx931 divide 0.0001 -0 -> -Infinity Division_by_zero 729divx932 divide 0.01 -0 -> -Infinity Division_by_zero 730divx933 divide 0.1 -0 -> -Infinity Division_by_zero 731divx934 divide 1 -0 -> -Infinity Division_by_zero 732divx935 divide 1 -0.0 -> -Infinity Division_by_zero 733divx936 divide 10 -0.0 -> -Infinity Division_by_zero 734divx937 divide 1E+100 -0.0 -> -Infinity Division_by_zero 735divx938 divide 1E+1000 -0 -> -Infinity Division_by_zero 736 737divx941 divide -0.0001 -0 -> Infinity Division_by_zero 738divx942 divide -0.01 -0 -> Infinity Division_by_zero 739divx943 divide -0.1 -0 -> Infinity Division_by_zero 740divx944 divide -1 -0 -> Infinity Division_by_zero 741divx945 divide -1 -0.0 -> Infinity Division_by_zero 742divx946 divide -10 -0.0 -> Infinity Division_by_zero 743divx947 divide -1E+100 -0.0 -> Infinity Division_by_zero 744divx948 divide -1E+1000 -0 -> Infinity Division_by_zero 745 746-- overflow and underflow tests 747precision: 9 748maxexponent: 999999999 749minexponent: -999999999 750divx951 divide 9E+999999999 +0.23456789012345E-0 -> Infinity Inexact Overflow Rounded 751divx952 divide +0.100 9E+999999999 -> 1.111111E-1000000001 Inexact Rounded Underflow Subnormal 752divx953 divide 9E-999999999 +9.100 -> 9.8901099E-1000000000 Inexact Rounded Underflow Subnormal 753divx954 divide -1.23456789 9E+999999999 -> -1.3717421E-1000000000 Subnormal 754divx955 divide -1.23456789012345E-0 9E+999999999 -> -1.3717421E-1000000000 Underflow Subnormal Rounded Inexact 755divx956 divide -1.23456789012345E-0 7E+999999999 -> -1.7636684E-1000000000 Inexact Rounded Underflow Subnormal 756divx957 divide 9E+999999999 -0.83456789012345E-0 -> -Infinity Inexact Overflow Rounded 757divx958 divide -0.100 9E+999999999 -> -1.111111E-1000000001 Subnormal Inexact Rounded Underflow 758divx959 divide 9E-999999999 -9.100 -> -9.8901099E-1000000000 Inexact Rounded Underflow Subnormal 759 760-- overflow and underflow (additional edge tests in multiply.decTest) 761-- 'subnormal' results now possible (all hard underflow or overflow in 762-- base arithemtic) 763divx960 divide 1e-600000000 1e+400000001 -> 1E-1000000001 Subnormal 764divx961 divide 1e-600000000 1e+400000002 -> 1E-1000000002 Subnormal 765divx962 divide 1e-600000000 1e+400000003 -> 1E-1000000003 Subnormal 766divx963 divide 1e-600000000 1e+400000004 -> 1E-1000000004 Subnormal 767divx964 divide 1e-600000000 1e+400000005 -> 1E-1000000005 Subnormal 768divx965 divide 1e-600000000 1e+400000006 -> 1E-1000000006 Subnormal 769divx966 divide 1e-600000000 1e+400000007 -> 1E-1000000007 Subnormal 770divx967 divide 1e-600000000 1e+400000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 771divx968 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 772divx969 divide 1e-600000000 1e+400000010 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 773-- [no equivalent of 'subnormal' for overflow] 774divx970 divide 1e+600000000 1e-400000001 -> Infinity Overflow Inexact Rounded 775divx971 divide 1e+600000000 1e-400000002 -> Infinity Overflow Inexact Rounded 776divx972 divide 1e+600000000 1e-400000003 -> Infinity Overflow Inexact Rounded 777divx973 divide 1e+600000000 1e-400000004 -> Infinity Overflow Inexact Rounded 778divx974 divide 1e+600000000 1e-400000005 -> Infinity Overflow Inexact Rounded 779divx975 divide 1e+600000000 1e-400000006 -> Infinity Overflow Inexact Rounded 780divx976 divide 1e+600000000 1e-400000007 -> Infinity Overflow Inexact Rounded 781divx977 divide 1e+600000000 1e-400000008 -> Infinity Overflow Inexact Rounded 782divx978 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded 783divx979 divide 1e+600000000 1e-400000010 -> Infinity Overflow Inexact Rounded 784 785-- Sign after overflow and underflow 786divx980 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 787divx981 divide 1e-600000000 -1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 788divx982 divide -1e-600000000 1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 789divx983 divide -1e-600000000 -1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped 790divx984 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded 791divx985 divide 1e+600000000 -1e-400000009 -> -Infinity Overflow Inexact Rounded 792divx986 divide -1e+600000000 1e-400000009 -> -Infinity Overflow Inexact Rounded 793divx987 divide -1e+600000000 -1e-400000009 -> Infinity Overflow Inexact Rounded 794 795-- Long operand overflow may be a different path 796precision: 3 797divx990 divide 1000 9.999E-999999999 -> Infinity Inexact Overflow Rounded 798divx991 divide 1000 -9.999E-999999999 -> -Infinity Inexact Overflow Rounded 799divx992 divide 9.999E+999999999 0.01 -> Infinity Inexact Overflow Rounded 800divx993 divide -9.999E+999999999 0.01 -> -Infinity Inexact Overflow Rounded 801 802-- check for double-rounded subnormals 803precision: 5 804maxexponent: 79 805minexponent: -79 806divx1001 divide 1.52444E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow 807divx1002 divide 1.52445E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow 808divx1003 divide 1.52446E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow 809 810-- a rounding problem in one implementation 811precision: 34 812rounding: half_up 813maxExponent: 6144 814minExponent: -6143 815-- Unbounded answer to 40 digits: 816-- 1.465811965811965811965811965811965811966E+7000 817divx1010 divide 343E6000 234E-1000 -> Infinity Overflow Inexact Rounded 818 819precision: 34 820rounding: half_up 821maxExponent: 6144 822minExponent: -6143 823 824-- Examples from SQL proposal (Krishna Kulkarni) 825precision: 7 826divx1021 divide 1E0 1E0 -> 1 827divx1022 divide 1E0 2E0 -> 0.5 828divx1023 divide 1E0 3E0 -> 0.3333333 Inexact Rounded 829divx1024 divide 100E-2 1000E-3 -> 1 830divx1025 divide 24E-1 2E0 -> 1.2 831divx1026 divide 2400E-3 2E0 -> 1.200 832divx1027 divide 5E0 2E0 -> 2.5 833divx1028 divide 5E0 20E-1 -> 2.5 834divx1029 divide 5E0 2000E-3 -> 2.5 835divx1030 divide 5E0 2E-1 -> 25 836divx1031 divide 5E0 20E-2 -> 25 837divx1032 divide 480E-2 3E0 -> 1.60 838divx1033 divide 47E-1 2E0 -> 2.35 839 840-- ECMAScript bad examples 841rounding: half_down 842precision: 7 843divx1050 divide 5 9 -> 0.5555556 Inexact Rounded 844rounding: half_even 845divx1051 divide 5 11 -> 0.4545455 Inexact Rounded 846 847-- payload decapitate 848precision: 5 849divx1055 divide sNaN987654321 1 -> NaN54321 Invalid_operation 850 851-- Null tests 852divx9998 divide 10 # -> NaN Invalid_operation 853divx9999 divide # 10 -> NaN Invalid_operation 854 855