1 module test; 2 3 import std.stdio; 4 import std.range; 5 import std..string; 6 import std.format; 7 import std.conv; 8 import std.algorithm; 9 import std.traits; 10 import decimal; 11 12 immutable string inputFileName = "..\\src\\test\\readtest.in"; 13 14 struct NumberedRange(R) 15 { 16 private int _no = 1; 17 private R _range; 18 19 this(R range) { this._range = range; } 20 21 @property bool empty() { return _range.empty; } 22 void popFront() { _range.popFront(); ++_no; } 23 @property auto front() { return NumberedRangeElement(_range.front, _no); } 24 25 struct NumberedRangeElement 26 { 27 ElementType!R item; 28 int no; 29 } 30 } 31 32 struct NoEmptyLinesRange(R) 33 { 34 private R _range; 35 36 this(R range) { this._range = range; } 37 void skip() 38 { 39 while (!_range.empty && _range.front.item.strip().empty) 40 _range.popFront(); 41 } 42 43 @property bool empty() { skip(); return _range.empty; } 44 void popFront() { skip(); _range.popFront(); } 45 @property auto front() { skip(); return _range.front; } 46 } 47 48 struct NoCommentsRange(R) 49 { 50 private R _range; 51 52 this(R range) { this._range = range; } 53 void skip() 54 { 55 while (!_range.empty && _range.front.item.startsWith("--")) 56 _range.popFront(); 57 } 58 59 @property bool empty() { skip(); return _range.empty; } 60 void popFront() { skip(); _range.popFront(); } 61 @property auto front() 62 { 63 skip(); 64 return _range.front; 65 } 66 } 67 68 struct TokenizedRange(R) 69 { 70 private R _range; 71 this(R range) { this._range = range; } 72 73 struct TokenizedItem 74 { 75 int lineNo; 76 string func; 77 int rounding; 78 string op1; 79 string op2; 80 string op3; 81 string res; 82 int expected; 83 int longintsize; 84 85 this(T)(int lineNo, T line) 86 { 87 88 this.lineNo = lineNo; 89 string s = to!string(line); 90 auto u = s.indexOf("--"); 91 if (u >= 0) 92 s = s[0 .. u]; 93 u = s.indexOf("ulp="); 94 if (u >= 0) 95 s = s[0 .. u]; 96 u = s.indexOf("underflow_before_only"); 97 if (u >= 0) 98 s = s[0 .. u]; 99 u = s.indexOf("str_prefix="); 100 if (u >= 0) 101 s = s[0 .. u]; 102 u = s.indexOf("longintsize="); 103 if (u >= 0) 104 { 105 longintsize = to!int(s[u + 12 .. u + 14]); 106 s = s[0 .. u]; 107 } 108 109 string t = s; 110 111 if (!(t.formattedRead!"%s %d %s %s %s %s %x"(func, rounding, op1, op2, op3, res, expected) == 7)) 112 { 113 t = s; 114 if (!(t.formattedRead!"%s %d %s %s %s %x"(func, rounding, op1, op2, res, expected) == 6)) 115 { 116 t = s; 117 if (!(t.formattedRead!"%s %d %s %s %x"(func, rounding, op1, res, expected) == 5)) 118 throw new Exception(format("%6d: Error reading tokens: %s", lineNo, line)); 119 } 120 } 121 } 122 123 } 124 125 @property bool empty() { return _range.empty; } 126 void popFront() { _range.popFront(); } 127 @property auto front() { return TokenizedItem(_range.front.no, _range.front.item); } 128 } 129 130 auto numbered(R)(R range) 131 { 132 return NumberedRange!R(range); 133 } 134 135 auto withoutEmptyLines(R)(R range) 136 { 137 return NoEmptyLinesRange!R(range); 138 } 139 140 auto withoutComments(R)(R range) 141 { 142 return NoCommentsRange!R(range); 143 } 144 145 auto tokenize(R)(R range) 146 { 147 return TokenizedRange!R(range); 148 } 149 150 ExceptionFlags translateFlags(int intelFlags) 151 { 152 ExceptionFlags result; 153 if (intelFlags & 1) 154 result |= ExceptionFlags.invalidOperation; 155 if (intelFlags & 4) 156 result |= ExceptionFlags.divisionByZero; 157 if (intelFlags & 8) 158 result |= ExceptionFlags.overflow; 159 if (intelFlags & 16) 160 result |= ExceptionFlags.underflow; 161 if (intelFlags & 32) 162 result |= ExceptionFlags.inexact; 163 return result; 164 } 165 166 RoundingMode translateRounding(int intelRounding) 167 { 168 switch (intelRounding) 169 { 170 case 0: 171 return RoundingMode.tiesToEven; 172 case 1: 173 return RoundingMode.towardNegative; 174 case 2: 175 return RoundingMode.towardPositive; 176 case 3: 177 return RoundingMode.towardZero; 178 case 4: 179 return RoundingMode.tiesToAway; 180 default: 181 assert(0); 182 } 183 } 184 185 DecimalClass translateClass(int intelClass) 186 { 187 switch (intelClass) 188 { 189 case 0: 190 return DecimalClass.signalingNaN; 191 case 1: 192 return DecimalClass.quietNaN; 193 case 2: 194 return DecimalClass.negativeInfinity; 195 case 3: 196 return DecimalClass.negativeNormal; 197 case 4: 198 return DecimalClass.negativeSubnormal; 199 case 5: 200 return DecimalClass.negativeZero; 201 case 6: 202 return DecimalClass.positiveZero; 203 case 7: 204 return DecimalClass.positiveSubnormal; 205 case 8: 206 return DecimalClass.positiveNormal; 207 case 9: 208 return DecimalClass.positiveInfinity; 209 default: 210 assert(0); 211 } 212 } 213 214 string prettyFlags(ExceptionFlags flags) 215 { 216 char[5] result = '_'; 217 218 if (flags & ExceptionFlags.invalidOperation) 219 result[0] = 'i'; 220 if (flags & ExceptionFlags.divisionByZero) 221 result[1] = 'z'; 222 if (flags & ExceptionFlags.overflow) 223 result[2] = 'o'; 224 if (flags & ExceptionFlags.underflow) 225 result[3] = 'u'; 226 if (flags & ExceptionFlags.inexact) 227 result[4] = 'x'; 228 return result.idup; 229 } 230 231 bool equ(T)(const T x, const T y, const bool checkZeroSign) 232 { 233 static if (isDecimal!T) 234 { 235 if (isZero(x) && isZero(y)) 236 { 237 if (checkZeroSign) 238 return signbit(x) == signbit(y); 239 else 240 return true; 241 } 242 243 if (isSignaling(x)) 244 return isSignaling(y); 245 if (isNaN(x)) 246 return isNaN(y); 247 if (signbit(x) != signbit(y)) 248 return false; 249 return approxEqual(x, y); 250 } 251 else static if (isFloatingPoint!T) 252 { 253 static import std.math; 254 if (x == 0 && y == 0) 255 { 256 if (checkZeroSign) 257 return std.math.signbit(x) == std.math.signbit(y); 258 else 259 return true; 260 } 261 262 if (std.math.isNaN(x)) 263 return std.math.isNaN(y); 264 265 if (std.math.signbit(x) != std.math.signbit(y)) 266 return false; 267 if (std.math.isInfinity(x)) 268 return std.math.isInfinity(y) || y == std.math.copysign(T.max, y); 269 if (std.math.isInfinity(y)) 270 return std.math.isInfinity(x) || x == std.math.copysign(T.max, x); 271 return std.math.approxEqual(x, y); 272 } 273 274 else 275 return x == y; 276 } 277 278 bool test0(string func, O, E)(E element, out string errorMessage, const bool checkZeroSign = true) 279 { 280 DecimalControl.rounding = RoundingMode.implicit; 281 auto expected = parseOperand!O(element.res); 282 mixin("auto result = " ~ func ~ ";"); 283 bool t1 = equ(result, expected, checkZeroSign); 284 bool t2 = true; 285 if (!t1) 286 errorMessage = format("%6d (%s): %s() => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 287 element.lineNo, element.func, func, result, expected); 288 else 289 errorMessage = ""; 290 return t1 && t2; 291 } 292 293 bool test1(string func, I, O, E)(E element, out string errorMessage, const bool checkZeroSign = true) 294 { 295 if (element.lineNo == 16501) 296 { 297 bool x = true; 298 } 299 DecimalControl.rounding = RoundingMode.implicit; 300 auto input = parseOperand!I(element.op1); 301 auto expected = parseOperand!O(element.res); 302 DecimalControl.resetFlags(); 303 DecimalControl.rounding = translateRounding(element.rounding); 304 mixin("O result = " ~ func ~ "(input);"); 305 auto flags = DecimalControl.saveFlags(); 306 bool t1 = equ(result, expected, checkZeroSign); 307 308 auto expectedFlags = translateFlags(element.expected); 309 310 static if (isDecimal!O || isFloatingPoint!O) 311 { 312 if (element.func.endsWith("_from_string") && isNaN(expected)) 313 { 314 //intel considers enough to return nan on unparsable strings and does not raise invalidOp 315 flags &= ~(ExceptionFlags.invalidOperation); 316 } 317 318 static if (isDecimal!O) 319 { 320 if (element.func.endsWith("_from_string") && isSubnormal(expected)) 321 { 322 //intel does not set underflow flag when parsing subnormals 323 flags &= ~(ExceptionFlags.underflow); 324 } 325 } 326 327 if (element.func.indexOf("binary") >= 0) 328 { 329 //intel does not set inexact/overflow or set it unexpectedly when converting from binary 330 flags &= ExceptionFlags.invalidOperation; 331 expectedFlags &= ExceptionFlags.invalidOperation; 332 //intel considers float.nan as invalid when converting to decimal 333 if (input != input) 334 { 335 expectedFlags &= ~ExceptionFlags.invalidOperation; 336 } 337 } 338 339 if (element.func.startsWith("sin") >= 0) 340 { 341 //intel sets underflow unexpectedly 342 flags &= ~ExceptionFlags.underflow; 343 expectedFlags &= ~ExceptionFlags.underflow; 344 } 345 } 346 347 348 349 bool t2 = flags == expectedFlags; 350 errorMessage = ""; 351 if (!t1) 352 errorMessage = format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ") => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 353 element.lineNo, element.func, translateRounding(element.rounding), func, input, result, expected); 354 if (!t2) 355 { 356 if (!t1) 357 errorMessage ~= "\r\n"; 358 errorMessage ~= format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ") => " ~ defaultFormat!O ~ ", flags mismatch: result [%s], expected [%s]", 359 element.lineNo, element.func, translateRounding(element.rounding), func, input, result, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 360 } 361 362 return t1 && t2; 363 } 364 365 bool test_rounding(string func, I, O, E)(E element, out string errorMessage, const RoundingMode mode, const bool checkZeroSign = true) 366 { 367 if (element.lineNo == 79662) 368 { 369 bool x = true; 370 } 371 DecimalControl.rounding = RoundingMode.implicit; 372 auto input = parseOperand!I(element.op1); 373 auto expected = parseOperand!O(element.res); 374 DecimalControl.resetFlags(); 375 DecimalControl.rounding = translateRounding(element.rounding); 376 mixin("auto result = " ~ func ~ "(input, mode);"); 377 auto flags = DecimalControl.saveFlags(); 378 bool t1 = equ(result, expected, checkZeroSign); 379 380 //we must use to!int for lround on 32 bit instead of decimal.lround, which sets ovf flag 381 if (element.func.indexOf("lround") >= 0) 382 flags &= ~ExceptionFlags.overflow; 383 384 bool t2 = flags == translateFlags(element.expected); 385 errorMessage = ""; 386 if (!t1) 387 errorMessage = format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ", %s) => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 388 element.lineNo, element.func, translateRounding(element.rounding), func, input, mode, result, expected); 389 if (!t2) 390 { 391 if (!t1) 392 errorMessage ~= "\r\n"; 393 errorMessage ~= format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ", %s) => " ~ defaultFormat!O ~ ", flags mismatch: result [%s], expected [%s]", 394 element.lineNo, element.func, translateRounding(element.rounding), func, input, mode, result, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 395 } 396 397 return t1 && t2; 398 } 399 400 bool testop(string op, I1, I2, O, E)(E element, out string errorMessage, const bool checkZeroSign = true) 401 { 402 if (element.lineNo == 92365) 403 { 404 bool x = true; 405 } 406 407 DecimalControl.rounding = RoundingMode.implicit; 408 auto input1 = parseOperand!I1(element.op1); 409 auto input2 = parseOperand!I2(element.op2); 410 auto expected = parseOperand!O(element.res); 411 DecimalControl.resetFlags(); 412 DecimalControl.rounding = translateRounding(element.rounding); 413 mixin("O result = input1 " ~ op ~ " input2;"); 414 auto flags = DecimalControl.saveFlags(); 415 bool t1 = equ(result, expected, checkZeroSign); 416 417 auto expectedFlags = translateFlags(element.expected); 418 419 static if (op == "*" || op == "/" || op == "+" || op == "-") 420 { 421 //intel does not set underflow on subnormals on mul/div 422 if (!(expectedFlags & ExceptionFlags.underflow) && (flags & ExceptionFlags.underflow)) 423 expectedFlags |= ExceptionFlags.underflow; 424 } 425 426 static if (op == "*" || op == "/") 427 { 428 //intel does not set always inexact on mul/div 429 if (!(expectedFlags & ExceptionFlags.inexact) && (flags & ExceptionFlags.inexact)) 430 expectedFlags |= ExceptionFlags.inexact; 431 } 432 433 bool t2 = flags == expectedFlags; 434 435 errorMessage = ""; 436 if (!t1) 437 errorMessage = format("%6d (%s): [%s] " ~ defaultFormat!I1 ~ " %s " ~ defaultFormat!I2 ~ " => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 438 element.lineNo, element.func, translateRounding(element.rounding), input1, op, input2, result, expected); 439 if (!t2) 440 { 441 if (!t1) 442 errorMessage ~= "\r\n"; 443 errorMessage ~= format("%6d (%s): [%s] " ~ defaultFormat!I1 ~ " %s " ~ defaultFormat!I2 ~ " => " ~ defaultFormat!O ~ ", flags mismatch: result [%s], expected [%s]", 444 element.lineNo, element.func, translateRounding(element.rounding), input1, op, input2, result, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 445 } 446 447 return t1 && t2; 448 } 449 450 bool test2(string func, I1, I2, O, E)(E element, out string errorMessage, const bool checkZeroSign = true) 451 { 452 if (element.lineNo == 125397) 453 { 454 bool x = true; 455 } 456 DecimalControl.rounding = RoundingMode.implicit; 457 auto input1 = parseOperand!I1(element.op1); 458 auto input2 = parseOperand!I2(element.op2); 459 auto expected = parseOperand!O(element.res); 460 DecimalControl.resetFlags(); 461 DecimalControl.rounding = translateRounding(element.rounding); 462 mixin("auto result = " ~ func ~ "(input1, input2);"); 463 auto flags = DecimalControl.saveFlags(); 464 bool t1 = equ(result, expected, checkZeroSign); 465 auto expectedFlags = translateFlags(element.expected); 466 467 static if (func.endsWith("remainder")) 468 { 469 //intel does not set underflow on subnormals remainder 470 flags &= ~ExceptionFlags.inexact; 471 flags &= ~ExceptionFlags.underflow; 472 expectedFlags &= ~ExceptionFlags.inexact; 473 expectedFlags &= ~ExceptionFlags.underflow; 474 } 475 476 bool t2 = flags == expectedFlags; 477 errorMessage = ""; 478 if (!t1) 479 errorMessage = format("%6d (%s): [%s] %s(" ~ defaultFormat!I1 ~ ", " ~ defaultFormat!I2 ~ ") => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 480 element.lineNo, element.func, translateRounding(element.rounding), func, input1, input2, result, expected); 481 if (!t2) 482 { 483 if (!t1) 484 errorMessage ~= "\r\n"; 485 errorMessage ~= format("%6d (%s): [%s] %s(" ~ defaultFormat!I1 ~ ", " ~ defaultFormat!I2 ~ ") => " ~ defaultFormat!O ~ ", flags mismatch: result [%s], expected [%s]", 486 element.lineNo, element.func, translateRounding(element.rounding), func, input1, input2, result, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 487 } 488 489 return t1 && t2; 490 } 491 492 bool test3(string func, I1, I2, I3, O, E)(E element, out string errorMessage, const bool checkZeroSign = true) 493 { 494 if (element.lineNo == 45352) 495 { 496 bool x = true; 497 } 498 DecimalControl.rounding = RoundingMode.implicit; 499 auto input1 = parseOperand!I1(element.op1); 500 auto input2 = parseOperand!I2(element.op2); 501 auto input3 = parseOperand!I3(element.op3); 502 auto expected = parseOperand!O(element.res); 503 DecimalControl.resetFlags(); 504 DecimalControl.rounding = translateRounding(element.rounding); 505 mixin("O result = " ~ func ~ "(input1, input2, input3);"); 506 auto flags = DecimalControl.saveFlags(); 507 bool t1 = equ(result, expected, checkZeroSign); 508 auto expectedFlags = translateFlags(element.expected); 509 510 static if (func.endsWith("fma")) 511 { 512 //intel does not set underflow on subnormals on fma 513 flags &= ~ExceptionFlags.inexact; 514 flags &= ~ExceptionFlags.underflow; 515 expectedFlags &= ~ExceptionFlags.inexact; 516 expectedFlags &= ~ExceptionFlags.underflow; 517 } 518 519 bool t2 = flags == expectedFlags; 520 521 522 523 524 errorMessage = ""; 525 if (!t1) 526 errorMessage = format("%6d (%s): [%s] %s(" ~ defaultFormat!I1 ~ ", " ~ defaultFormat!I2 ~ ", " ~ defaultFormat!I3 ~ ") => " ~ defaultFormat!O ~ ", expected was " ~ defaultFormat!O, 527 element.lineNo, element.func, translateRounding(element.rounding), func, input1, input2, input3, result, expected); 528 if (!t2) 529 { 530 if (!t1) 531 errorMessage ~= "\r\n"; 532 errorMessage ~= format("%6d (%s): [%s] %s(" ~ defaultFormat!I1 ~ ", " ~ defaultFormat!I2 ~ ", " ~ defaultFormat!I3 ~ ") => " ~ defaultFormat!O ~ ", flags mismatch: result [%s], expected [%s]", 533 element.lineNo, element.func, translateRounding(element.rounding), func, input1, input2, input3, result, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 534 } 535 536 return t1 && t2; 537 } 538 539 bool test_ref(string func, I, O1, O2, E)(E element, out string errorMessage, const bool checkZeroSign = true) 540 { 541 if (element.lineNo == 94002) 542 { 543 bool x = true; 544 } 545 DecimalControl.rounding = RoundingMode.implicit; 546 auto input1 = parseOperand!I(element.op1); 547 auto expectedExp = parseOperand!O1(element.op2); 548 auto expected = parseOperand!O2(element.res); 549 DecimalControl.resetFlags(); 550 DecimalControl.rounding = translateRounding(element.rounding); 551 O1 resultExp; 552 mixin ("auto result = " ~ func ~ "(input1, resultExp);"); 553 auto flags = DecimalControl.saveFlags(); 554 bool t1 = equ(result, expected, checkZeroSign); 555 t1 = t1 & equ(resultExp, expectedExp, checkZeroSign); 556 bool t2 = flags == translateFlags(element.expected); 557 errorMessage = ""; 558 if (!t1) 559 errorMessage = format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ") => (" ~ defaultFormat!O2 ~ ", " ~ defaultFormat!O1 ~ "), expected was (" ~ defaultFormat!O2 ~ ", " ~ defaultFormat!O1 ~ ")", 560 element.lineNo, element.func, translateRounding(element.rounding), func, input1, result, resultExp, expected, expectedExp); 561 if (!t2) 562 { 563 if (!t1) 564 errorMessage ~= "\r\n"; 565 errorMessage ~= format("%6d (%s): [%s] %s(" ~ defaultFormat!I ~ ") => (" ~ defaultFormat!O2 ~ ", " ~ defaultFormat!O1 ~ "), flags mismatch: result [%s], expected [%s]", 566 element.lineNo, element.func, translateRounding(element.rounding), func, input1, result, resultExp, prettyFlags(flags), prettyFlags(translateFlags(element.expected))); 567 } 568 569 return t1 && t2; 570 } 571 572 573 bool test_class(I, E)(E element, out string errorMessage) 574 { 575 auto input = parseOperand!I(element.op1); 576 auto expected = parseOperand!int(element.res); 577 auto result = decimalClass(input); 578 bool t1 = equ(result, translateClass(expected), true); 579 580 errorMessage = ""; 581 if (!t1) 582 errorMessage = format("%6d (%s): [%s] decimalClass(" ~ defaultFormat!I ~ ") => %s , expected was %s", 583 element.lineNo, element.func, translateRounding(element.rounding), input, result, translateClass(expected)); 584 return t1; 585 } 586 587 template defaultFormat(T) 588 { 589 static if (is(T == decimal32)) 590 enum defaultFormat = "%+.6e"; 591 else static if (is(T == decimal64)) 592 enum defaultFormat = "%+.15e"; 593 else static if (is(T == decimal128)) 594 enum defaultFormat = "%+.33e"; 595 else static if (is(T == uint) || is(T == int) || is(T == ulong) || is(T == long) || is(T == ushort) || is(T == short) || is(T == byte) || is(T == ubyte)) 596 enum defaultFormat ="%+d"; 597 else static if (is(T == float) || is(T == double) || is(T == real)) 598 enum defaultFormat = "%+a"; 599 else 600 enum defaultFormat = "%s"; 601 } 602 603 T parseOperand(T)(string op) 604 { 605 static if (is(T == decimal32)) 606 { 607 if (op.startsWith("[")) 608 { 609 decimal32 d; 610 string s = op[1 .. $ - 1]; 611 auto bits = parse!uint(s, 16); 612 *cast(uint*)&d = bits; 613 return d; 614 } 615 else 616 return decimal32(op); 617 } 618 else static if (is(T == decimal64)) 619 { 620 if (op.startsWith("[")) 621 { 622 decimal64 d; 623 string s = op[1 .. $ - 1]; 624 auto bits = parse!ulong(s, 16); 625 *cast(ulong*)&d = bits; 626 return d; 627 } 628 else 629 return decimal64(op); 630 } 631 else static if (is(T == decimal128)) 632 { 633 if (op.startsWith("[")) 634 { 635 string s1, s2; 636 auto v = indexOf(op, ","); 637 if (v >= 0) 638 { 639 s1 = op[1 .. v]; 640 s2 = op[v + 1 .. $ - 1]; 641 } 642 else 643 { 644 s1 = op[1 .. 17]; 645 s2 = op[17 .. $ - 1]; 646 } 647 ulong hi = parse!ulong(s1, 16); 648 ulong lo = parse!ulong(s2, 16); 649 decimal128 d; 650 *cast(ulong[2]*)&d = [lo, hi]; 651 return d; 652 } 653 else 654 return decimal128(op); 655 } 656 else static if (is(T == bool)) 657 { 658 return op == "1"; 659 } 660 else static if (is(T == byte) || is(T == short) || is(T == int) || is(T == long)) 661 { 662 if (op == "NULL") 663 return 0; 664 if (op.startsWith("[")) 665 { 666 auto s = op[1 .. $ - 1]; 667 return cast(T)parse!(Unsigned!T)(s, 16); 668 } 669 else 670 return to!T(op); 671 } 672 else static if (is(T == ubyte) || is(T == ushort) || is(T == uint) || is(T == ulong)) 673 { 674 if (op == "NULL") 675 return 0; 676 if (op.startsWith("[")) 677 { 678 auto s = op[1 .. $ - 1]; 679 return parse!T(s, 16); 680 } 681 else if (op.startsWith("-")) 682 return cast(T)to!(Signed!T)(op); 683 else 684 return to!T(op); 685 } 686 else static if (is(T == float)) 687 { 688 if (op.startsWith("[")) 689 { 690 auto s = op[1 .. $ - 1]; 691 auto bits = parse!uint(s, 16); 692 float f; 693 *cast(uint*)&f = bits; 694 return f; 695 } 696 else 697 return to!T(op); 698 } 699 else static if (is(T == double)) 700 { 701 if (op.startsWith("[")) 702 { 703 auto s = op[1 .. $ - 1]; 704 auto bits = parse!ulong(s, 16); 705 double d; 706 *cast(ulong*)&d = bits; 707 return d; 708 } 709 else 710 return to!T(op); 711 } 712 else static if (is(T == double)) 713 { 714 if (op.startsWith("[")) 715 { 716 auto s = op[1 .. $ - 1]; 717 auto bits = parse!ulong(s, 16); 718 double d; 719 *cast(ulong*)&d = bits; 720 return d; 721 } 722 else 723 return to!T(op); 724 } 725 else static if (is(T == real)) 726 { 727 if (op.startsWith("[")) 728 { 729 auto s = op[1 .. $ - 1]; 730 ushort[5] bits; 731 auto t = s[0..4]; 732 bits[4] = parse!ushort(t, 16); 733 t = s[4..8]; 734 bits[3] = parse!ushort(t, 16); 735 t = s[8..12]; 736 bits[2] = parse!ushort(t, 16); 737 t = s[12..16]; 738 bits[1] = parse!ushort(t, 16); 739 t = s[16..20]; 740 bits[0] = parse!ushort(t, 16); 741 real r; 742 *cast(ushort[5]*)&r = bits; 743 return r; 744 } 745 else 746 return to!T(op); 747 } 748 else static if (is(T: string)) 749 { 750 if (op == "EMPTY") 751 return ""; 752 else 753 return op; 754 } 755 else 756 static assert(0); 757 } 758 759 struct Stat 760 { 761 int total; 762 int skipped; 763 int failed; 764 int notApplicable; 765 int passed; 766 } 767 768 int main(string[] argv) 769 { 770 771 772 auto file = File(inputFileName); 773 774 auto range = file.byLine() 775 .numbered() 776 .withoutEmptyLines() 777 .withoutComments() 778 .tokenize(); 779 780 Stat[string] tests; 781 782 foreach(element; range) 783 { 784 if (auto p = element.func in tests) 785 ++((*p).total); 786 else 787 tests[element.func]= Stat(1, 0, 0, 0, 0); 788 789 string msg; 790 bool na = false; 791 bool skip = false; 792 bool outcome = false; 793 switch(element.func) 794 { 795 case "bid32_abs": 796 outcome = test1!("fabs", decimal32, decimal32)(element, msg); 797 break; 798 case "bid64_abs": 799 outcome = test1!("fabs", decimal64, decimal64)(element, msg); 800 break; 801 case "bid128_abs": 802 outcome = test1!("fabs", decimal128, decimal128)(element, msg); 803 break; 804 case "bid32_isInf": 805 outcome = test1!("isInfinity", decimal32, bool)(element, msg); 806 break; 807 case "bid64_isInf": 808 outcome = test1!("isInfinity", decimal64, bool)(element, msg); 809 break; 810 case "bid128_isInf": 811 outcome = test1!("isInfinity", decimal128, bool)(element, msg); 812 break; 813 case "bid32_isNaN": 814 outcome = test1!("isNaN", decimal32, bool)(element, msg); 815 break; 816 case "bid64_isNaN": 817 outcome = test1!("isNaN", decimal64, bool)(element, msg); 818 break; 819 case "bid128_isNaN": 820 outcome = test1!("isNaN", decimal128, bool)(element, msg); 821 break; 822 case "bid32_isFinite": 823 outcome = test1!("isFinite", decimal32, bool)(element, msg); 824 break; 825 case "bid64_isFinite": 826 outcome = test1!("isFinite", decimal64, bool)(element, msg); 827 break; 828 case "bid128_isFinite": 829 outcome = test1!("isFinite", decimal128, bool)(element, msg); 830 break; 831 case "bid32_isZero": 832 outcome = test1!("isZero", decimal32, bool)(element, msg); 833 break; 834 case "bid64_isZero": 835 outcome = test1!("isZero", decimal64, bool)(element, msg); 836 break; 837 case "bid128_isZero": 838 outcome = test1!("isZero", decimal128, bool)(element, msg); 839 break; 840 case "bid32_isSubnormal": 841 outcome = test1!("isSubnormal", decimal32, bool)(element, msg); 842 break; 843 case "bid64_isSubnormal": 844 outcome = test1!("isSubnormal", decimal64, bool)(element, msg); 845 break; 846 case "bid128_isSubnormal": 847 outcome = test1!("isSubnormal", decimal128, bool)(element, msg); 848 break; 849 case "bid32_isSignaling": 850 outcome = test1!("isSignaling", decimal32, bool)(element, msg); 851 break; 852 case "bid64_isSignaling": 853 outcome = test1!("isSignaling", decimal64, bool)(element, msg); 854 break; 855 case "bid128_isSignaling": 856 outcome = test1!("isSignaling", decimal128, bool)(element, msg); 857 break; 858 case "bid32_isNormal": 859 outcome = test1!("isNormal", decimal32, bool)(element, msg); 860 break; 861 case "bid64_isNormal": 862 outcome = test1!("isNormal", decimal64, bool)(element, msg); 863 break; 864 case "bid128_isNormal": 865 outcome = test1!("isNormal", decimal128, bool)(element, msg); 866 break; 867 case "bid32_isCanonical": 868 outcome = test1!("isCanonical", decimal32, bool)(element, msg); 869 break; 870 case "bid64_isCanonical": 871 outcome = test1!("isCanonical", decimal64, bool)(element, msg); 872 break; 873 case "bid128_isCanonical": 874 outcome = test1!("isCanonical", decimal128, bool)(element, msg); 875 break; 876 case "bid32_isSigned": 877 outcome = test1!("signbit", decimal32, int)(element, msg); 878 break; 879 case "bid64_isSigned": 880 outcome = test1!("signbit", decimal64, int)(element, msg); 881 break; 882 case "bid128_isSigned": 883 outcome = test1!("signbit", decimal128, int)(element, msg); 884 break; 885 case "bid32_copy": 886 outcome = test1!("decimal32", decimal32, decimal32)(element, msg); 887 break; 888 case "bid64_copy": 889 outcome = test1!("decimal64", decimal64, decimal64)(element, msg); 890 break; 891 case "bid128_copy": 892 outcome = test1!("decimal128", decimal128, decimal128)(element, msg); 893 break; 894 case "bid32_negate": 895 outcome = test1!("-", decimal32, decimal32)(element, msg); 896 break; 897 case "bid64_negate": 898 outcome = test1!("-", decimal64, decimal64)(element, msg); 899 break; 900 case "bid128_negate": 901 outcome = test1!("-", decimal128, decimal128)(element, msg); 902 break; 903 case "bid32_inf": 904 outcome = test0!("decimal32.infinity", decimal32)(element, msg); 905 break; 906 case "bid64_inf": 907 outcome = test0!("decimal64.infinity", decimal64)(element, msg); 908 break; 909 case "bid128_inf": 910 outcome = test0!("decimal128.infinity", decimal128)(element, msg); 911 break; 912 case "bid32_nan": 913 outcome = test1!("NaN!decimal32", uint, decimal32)(element, msg); 914 break; 915 case "bid64_nan": 916 outcome = test1!("NaN!decimal64", ulong, decimal64)(element, msg); 917 break; 918 case "bid128_nan": 919 outcome = test1!("NaN!decimal128", ulong, decimal128)(element, msg); 920 break; 921 case "bid32_copySign": 922 outcome = test2!("copysign", decimal32, decimal32, decimal32)(element, msg); 923 break; 924 case "bid64_copySign": 925 outcome = test2!("copysign", decimal64, decimal64, decimal64)(element, msg); 926 break; 927 case "bid128_copySign": 928 outcome = test2!("copysign", decimal128, decimal128, decimal128)(element, msg); 929 break; 930 case "bid32_from_int32": 931 outcome = test1!("decimal32", int, decimal32)(element, msg); 932 break; 933 case "bid64_from_int32": 934 outcome = test1!("decimal64", int, decimal64)(element, msg); 935 break; 936 case "bid128_from_int32": 937 outcome = test1!("decimal128", int, decimal128)(element, msg); 938 break; 939 case "bid32_from_int64": 940 outcome = test1!("decimal32", long, decimal32)(element, msg); 941 break; 942 case "bid64_from_int64": 943 outcome = test1!("decimal64", long, decimal64)(element, msg); 944 break; 945 case "bid128_from_int64": 946 outcome = test1!("decimal128", long, decimal128)(element, msg); 947 break; 948 case "bid32_from_uint32": 949 outcome = test1!("decimal32", uint, decimal32)(element, msg); 950 break; 951 case "bid64_from_uint32": 952 outcome = test1!("decimal64", uint, decimal64)(element, msg); 953 break; 954 case "bid128_from_uint32": 955 outcome = test1!("decimal128", uint, decimal128)(element, msg); 956 break; 957 case "bid32_from_uint64": 958 outcome = test1!("decimal32", ulong, decimal32)(element, msg); 959 break; 960 case "bid64_from_uint64": 961 outcome = test1!("decimal64", ulong, decimal64)(element, msg); 962 break; 963 case "bid128_from_uint64": 964 outcome = test1!("decimal128", ulong, decimal128)(element, msg); 965 break; 966 case "binary32_to_bid32": 967 outcome = test1!("decimal32", float, decimal32)(element, msg); 968 break; 969 case "binary64_to_bid32": 970 outcome = test1!("decimal32", double, decimal32)(element, msg); 971 break; 972 case "binary80_to_bid32": 973 outcome = test1!("decimal32", real, decimal32)(element, msg); 974 break; 975 case "binary32_to_bid64": 976 outcome = test1!("decimal64", float, decimal64)(element, msg); 977 break; 978 case "binary64_to_bid64": 979 outcome = test1!("decimal64", double, decimal64)(element, msg); 980 break; 981 case "binary80_to_bid64": 982 outcome = test1!("decimal64", real, decimal64)(element, msg); 983 break; 984 case "binary32_to_bid128": 985 outcome = test1!("decimal128", float, decimal128)(element, msg); 986 break; 987 case "binary64_to_bid128": 988 outcome = test1!("decimal128", double, decimal128)(element, msg); 989 break; 990 case "binary80_to_bid128": 991 outcome = test1!("decimal128", real, decimal128)(element, msg); 992 break; 993 case "bid32_to_binary32": 994 outcome = test1!("cast(float)", decimal32, float)(element, msg); 995 break; 996 case "bid32_to_binary64": 997 outcome = test1!("cast(double)", decimal32, double)(element, msg); 998 break; 999 case "bid32_to_binary80": 1000 outcome = test1!("cast(real)", decimal32, real)(element, msg); 1001 break; 1002 case "bid64_to_binary32": 1003 outcome = test1!("cast(float)", decimal64, float)(element, msg); 1004 break; 1005 case "bid64_to_binary64": 1006 outcome = test1!("cast(double)", decimal64, double)(element, msg); 1007 break; 1008 case "bid64_to_binary80": 1009 outcome = test1!("cast(real)", decimal64, real)(element, msg); 1010 break; 1011 case "bid128_to_binary32": 1012 outcome = test1!("cast(float)", decimal128, float)(element, msg); 1013 break; 1014 case "bid128_to_binary64": 1015 outcome = test1!("cast(double)", decimal128, double)(element, msg); 1016 break; 1017 case "bid128_to_binary80": 1018 outcome = test1!("cast(real)", decimal128, real)(element, msg); 1019 break; 1020 case "bid32_ilogb": 1021 outcome = test1!("ilogb", decimal32, int)(element, msg); 1022 break; 1023 case "bid64_ilogb": 1024 outcome = test1!("ilogb", decimal64, int)(element, msg); 1025 break; 1026 case "bid128_ilogb": 1027 outcome = test1!("ilogb", decimal128, int)(element, msg); 1028 break; 1029 case "bid32_maxnum": 1030 outcome = test2!("fmax", decimal32, decimal32, decimal32)(element, msg, false); 1031 break; 1032 case "bid64_maxnum": 1033 outcome = test2!("fmax", decimal64, decimal64, decimal64)(element, msg, false); 1034 break; 1035 case "bid128_maxnum": 1036 outcome = test2!("fmax", decimal128, decimal128, decimal128)(element, msg, false); 1037 break; 1038 case "bid32_maxnum_mag": 1039 outcome = test2!("fmaxAbs", decimal32, decimal32, decimal32)(element, msg, false); 1040 break; 1041 case "bid64_maxnum_mag": 1042 outcome = test2!("fmaxAbs", decimal64, decimal64, decimal64)(element, msg, false); 1043 break; 1044 case "bid128_maxnum_mag": 1045 outcome = test2!("fmaxAbs", decimal128, decimal128, decimal128)(element, msg, false); 1046 break; 1047 case "bid32_minnum": 1048 outcome = test2!("fmin", decimal32, decimal32, decimal32)(element, msg, false); 1049 break; 1050 case "bid64_minnum": 1051 outcome = test2!("fmin", decimal64, decimal64, decimal64)(element, msg, false); 1052 break; 1053 case "bid128_minnum": 1054 outcome = test2!("fmin", decimal128, decimal128, decimal128)(element, msg, false); 1055 break; 1056 case "bid32_minnum_mag": 1057 outcome = test2!("fminAbs", decimal32, decimal32, decimal32)(element, msg, false); 1058 break; 1059 case "bid64_minnum_mag": 1060 outcome = test2!("fminAbs", decimal64, decimal64, decimal64)(element, msg, false); 1061 break; 1062 case "bid128_minnum_mag": 1063 outcome = test2!("fminAbs", decimal128, decimal128, decimal128)(element, msg, false); 1064 break; 1065 case "bid32_quiet_equal": 1066 outcome = testop!("==", decimal32, decimal32, bool)(element, msg); 1067 break; 1068 case "bid64_quiet_equal": 1069 outcome = testop!("==", decimal64, decimal64, bool)(element, msg); 1070 break; 1071 case "bid128_quiet_equal": 1072 outcome = testop!("==", decimal128, decimal128, bool)(element, msg); 1073 break; 1074 case "bid32_quiet_not_equal": 1075 outcome = testop!("!=", decimal32, decimal32, bool)(element, msg); 1076 break; 1077 case "bid64_quiet_not_equal": 1078 outcome = testop!("!=", decimal64, decimal64, bool)(element, msg); 1079 break; 1080 case "bid128_quiet_not_equal": 1081 outcome = testop!("!=", decimal128, decimal128, bool)(element, msg); 1082 break; 1083 case "bid32_quiet_greater": 1084 outcome = test2!("isGreater", decimal32, decimal32, bool)(element, msg); 1085 break; 1086 case "bid64_quiet_greater": 1087 outcome = test2!("isGreater", decimal64, decimal64, bool)(element, msg); 1088 break; 1089 case "bid128_quiet_greater": 1090 outcome = test2!("isGreater", decimal128, decimal128, bool)(element, msg); 1091 break; 1092 case "bid32_signaling_greater": 1093 outcome = testop!(">", decimal32, decimal32, bool)(element, msg); 1094 break; 1095 case "bid64_signaling_greater": 1096 outcome = testop!(">", decimal64, decimal64, bool)(element, msg); 1097 break; 1098 case "bid128_signaling_greater": 1099 outcome = testop!(">", decimal128, decimal128, bool)(element, msg); 1100 break; 1101 case "bid32_quiet_greater_equal": 1102 outcome = test2!("isGreaterOrEqual", decimal32, decimal32, bool)(element, msg); 1103 break; 1104 case "bid64_quiet_greater_equal": 1105 outcome = test2!("isGreaterOrEqual", decimal64, decimal64, bool)(element, msg); 1106 break; 1107 case "bid128_quiet_greater_equal": 1108 outcome = test2!("isGreaterOrEqual", decimal128, decimal128, bool)(element, msg); 1109 break; 1110 case "bid32_signaling_greater_equal": 1111 outcome = testop!(">=", decimal32, decimal32, bool)(element, msg); 1112 break; 1113 case "bid64_signaling_greater_equal": 1114 outcome = testop!(">=", decimal64, decimal64, bool)(element, msg); 1115 break; 1116 case "bid128_signaling_greater_equal": 1117 outcome = testop!(">=", decimal128, decimal128, bool)(element, msg); 1118 break; 1119 case "bid32_quiet_greater_unordered": 1120 outcome = test2!("isGreaterOrUnordered", decimal32, decimal32, bool)(element, msg); 1121 break; 1122 case "bid64_quiet_greater_unordered": 1123 outcome = test2!("isGreaterOrUnordered", decimal64, decimal64, bool)(element, msg); 1124 break; 1125 case "bid128_quiet_greater_unordered": 1126 outcome = test2!("isGreaterOrUnordered", decimal128, decimal128, bool)(element, msg); 1127 break; 1128 case "bid32_quiet_less": 1129 outcome = test2!("isLess", decimal32, decimal32, bool)(element, msg); 1130 break; 1131 case "bid64_quiet_less": 1132 outcome = test2!("isLess", decimal64, decimal64, bool)(element, msg); 1133 break; 1134 case "bid128_quiet_less": 1135 outcome = test2!("isLess", decimal128, decimal128, bool)(element, msg); 1136 break; 1137 case "bid32_signaling_less": 1138 outcome = testop!("<", decimal32, decimal32, bool)(element, msg); 1139 break; 1140 case "bid64_signaling_less": 1141 outcome = testop!("<", decimal64, decimal64, bool)(element, msg); 1142 break; 1143 case "bid128_signaling_less": 1144 outcome = testop!("<", decimal128, decimal128, bool)(element, msg); 1145 break; 1146 case "bid32_quiet_less_equal": 1147 outcome = test2!("isLessOrEqual", decimal32, decimal32, bool)(element, msg); 1148 break; 1149 case "bid64_quiet_less_equal": 1150 outcome = test2!("isLessOrEqual", decimal64, decimal64, bool)(element, msg); 1151 break; 1152 case "bid128_quiet_less_equal": 1153 outcome = test2!("isLessOrEqual", decimal128, decimal128, bool)(element, msg); 1154 break; 1155 case "bid32_signaling_less_equal": 1156 outcome = testop!("<=", decimal32, decimal32, bool)(element, msg); 1157 break; 1158 case "bid64_signaling_less_equal": 1159 outcome = testop!("<=", decimal64, decimal64, bool)(element, msg); 1160 break; 1161 case "bid128_signaling_less_equal": 1162 outcome = testop!("<=", decimal128, decimal128, bool)(element, msg); 1163 break; 1164 case "bid32_quiet_less_unordered": 1165 outcome = test2!("isLessOrUnordered", decimal32, decimal32, bool)(element, msg); 1166 break; 1167 case "bid64_quiet_less_unordered": 1168 outcome = test2!("isLessOrUnordered", decimal64, decimal64, bool)(element, msg); 1169 break; 1170 case "bid128_quiet_less_unordered": 1171 outcome = test2!("isLessOrUnordered", decimal128, decimal128, bool)(element, msg); 1172 break; 1173 case "bid32_quiet_not_greater": 1174 outcome = test2!("!isGreater", decimal32, decimal32, bool)(element, msg); 1175 break; 1176 case "bid64_quiet_not_greater": 1177 outcome = test2!("!isGreater", decimal64, decimal64, bool)(element, msg); 1178 break; 1179 case "bid128_quiet_not_greater": 1180 outcome = test2!("!isGreater", decimal128, decimal128, bool)(element, msg); 1181 break; 1182 case "bid32_quiet_not_less": 1183 outcome = test2!("!isLess", decimal32, decimal32, bool)(element, msg); 1184 break; 1185 case "bid64_quiet_not_less": 1186 outcome = test2!("!isLess", decimal64, decimal64, bool)(element, msg); 1187 break; 1188 case "bid128_quiet_not_less": 1189 outcome = test2!("!isLess", decimal128, decimal128, bool)(element, msg); 1190 break; 1191 case "bid32_quiet_ordered": 1192 outcome = test2!("!isUnordered", decimal32, decimal32, bool)(element, msg); 1193 break; 1194 case "bid64_quiet_ordered": 1195 outcome = test2!("!isUnordered", decimal64, decimal64, bool)(element, msg); 1196 break; 1197 case "bid128_quiet_ordered": 1198 outcome = test2!("!isUnordered", decimal128, decimal128, bool)(element, msg); 1199 break; 1200 case "bid32_quiet_unordered": 1201 outcome = test2!("isUnordered", decimal32, decimal32, bool)(element, msg); 1202 break; 1203 case "bid64_quiet_unordered": 1204 outcome = test2!("isUnordered", decimal64, decimal64, bool)(element, msg); 1205 break; 1206 case "bid128_quiet_unordered": 1207 outcome = test2!("isUnordered", decimal128, decimal128, bool)(element, msg); 1208 break; 1209 case "bid32_to_bid64": 1210 outcome = test1!("decimal64", decimal32, decimal64)(element, msg); 1211 break; 1212 case "bid32_to_bid128": 1213 outcome = test1!("decimal128", decimal32, decimal128)(element, msg); 1214 break; 1215 case "bid64_to_bid128": 1216 outcome = test1!("decimal128", decimal64, decimal128)(element, msg); 1217 break; 1218 case "bid64_to_bid32": 1219 outcome = test1!("decimal32", decimal64, decimal32)(element, msg); 1220 break; 1221 case "bid128_to_bid32": 1222 outcome = test1!("decimal32", decimal128, decimal32)(element, msg); 1223 break; 1224 case "bid128_to_bid64": 1225 outcome = test1!("decimal64", decimal128, decimal64)(element, msg); 1226 break; 1227 case "bid32_nextdown": 1228 outcome = test1!("nextDown", decimal32, decimal32)(element, msg); 1229 break; 1230 case "bid64_nextdown": 1231 outcome = test1!("nextDown", decimal64, decimal64)(element, msg); 1232 break; 1233 case "bid128_nextdown": 1234 outcome = test1!("nextDown", decimal128, decimal128)(element, msg); 1235 break; 1236 case "bid32_nextup": 1237 outcome = test1!("nextUp", decimal32, decimal32)(element, msg); 1238 break; 1239 case "bid64_nextup": 1240 outcome = test1!("nextUp", decimal64, decimal64)(element, msg); 1241 break; 1242 case "bid128_nextup": 1243 outcome = test1!("nextUp", decimal128, decimal128)(element, msg); 1244 break; 1245 case "bid32_class": 1246 outcome = test_class!decimal32(element, msg); 1247 break; 1248 case "bid64_class": 1249 outcome = test_class!decimal64(element, msg); 1250 break; 1251 case "bid128_class": 1252 outcome = test_class!decimal128(element, msg); 1253 break; 1254 case "bid32_from_string": 1255 outcome = test1!("decimal32", string, decimal32)(element, msg); 1256 break; 1257 case "bid64_from_string": 1258 outcome = test1!("decimal64", string, decimal64)(element, msg); 1259 break; 1260 case "bid128_from_string": 1261 outcome = test1!("decimal128", string, decimal128)(element, msg); 1262 break; 1263 case "bid32_add": 1264 outcome = testop!("+", decimal32, decimal32, decimal32)(element, msg); 1265 break; 1266 case "bid64_add": 1267 outcome = testop!("+", decimal64, decimal64, decimal64)(element, msg); 1268 break; 1269 case "bid64dq_add": 1270 outcome = testop!("+", decimal64, decimal128, decimal64)(element, msg); 1271 break; 1272 case "bid64qd_add": 1273 outcome = testop!("+", decimal128, decimal64, decimal64)(element, msg); 1274 break; 1275 case "bid64qq_add": 1276 outcome = testop!("+", decimal128, decimal128, decimal64)(element, msg); 1277 break; 1278 case "bid128_add": 1279 outcome = testop!("+", decimal128, decimal128, decimal128)(element, msg); 1280 break; 1281 case "bid32_sub": 1282 outcome = testop!("-", decimal32, decimal32, decimal32)(element, msg); 1283 break; 1284 case "bid64_sub": 1285 outcome = testop!("-", decimal64, decimal64, decimal64)(element, msg); 1286 break; 1287 case "bid64dq_sub": 1288 outcome = testop!("-", decimal64, decimal128, decimal64)(element, msg); 1289 break; 1290 case "bid64qd_sub": 1291 outcome = testop!("-", decimal128, decimal64, decimal64)(element, msg); 1292 break; 1293 case "bid64qq_sub": 1294 outcome = testop!("-", decimal128, decimal128, decimal64)(element, msg, false); 1295 break; 1296 case "bid128_sub": 1297 outcome = testop!("-", decimal128, decimal128, decimal128)(element, msg); 1298 break; 1299 case "bid32_mul": 1300 outcome = testop!("*", decimal32, decimal32, decimal32)(element, msg); 1301 break; 1302 case "bid64_mul": 1303 outcome = testop!("*", decimal64, decimal64, decimal64)(element, msg); 1304 break; 1305 case "bid64dq_mul": 1306 outcome = testop!("*", decimal64, decimal128, decimal64)(element, msg); 1307 break; 1308 case "bid64qd_mul": 1309 outcome = testop!("*", decimal128, decimal64, decimal64)(element, msg); 1310 break; 1311 case "bid64qq_mul": 1312 outcome = testop!("*", decimal128, decimal128, decimal64)(element, msg); 1313 break; 1314 case "bid128_mul": 1315 outcome = testop!("*", decimal128, decimal128, decimal128)(element, msg); 1316 break; 1317 case "bid32_div": 1318 outcome = testop!("/", decimal32, decimal32, decimal32)(element, msg); 1319 break; 1320 case "bid64_div": 1321 outcome = testop!("/", decimal64, decimal64, decimal64)(element, msg); 1322 break; 1323 case "bid64dq_div": 1324 outcome = testop!("/", decimal64, decimal128, decimal64)(element, msg); 1325 break; 1326 case "bid64qd_div": 1327 outcome = testop!("/", decimal128, decimal64, decimal64)(element, msg); 1328 break; 1329 case "bid64qq_div": 1330 outcome = testop!("/", decimal128, decimal128, decimal64)(element, msg); 1331 break; 1332 case "bid128_div": 1333 outcome = testop!("/", decimal128, decimal128, decimal128)(element, msg); 1334 break; 1335 case "bid32_rem": 1336 outcome = test2!("remainder", decimal32, decimal32, decimal32)(element, msg); 1337 break; 1338 case "bid64_rem": 1339 outcome = test2!("remainder", decimal64, decimal64, decimal64)(element, msg); 1340 break; 1341 case "bid128_rem": 1342 outcome = test2!("remainder", decimal128, decimal128, decimal128)(element, msg); 1343 break; 1344 case "bid32_hypot": 1345 outcome = test2!("hypot", decimal32, decimal32, decimal32)(element, msg); 1346 break; 1347 case "bid64_hypot": 1348 outcome = test2!("hypot", decimal64, decimal64, decimal64)(element, msg); 1349 break; 1350 case "bid128_hypot": 1351 outcome = test2!("hypot", decimal128, decimal128, decimal128)(element, msg); 1352 break; 1353 case "bid32_totalOrder": 1354 outcome = test2!("totalOrder", decimal32, decimal32, bool)(element, msg); 1355 break; 1356 case "bid64_totalOrder": 1357 outcome = test2!("totalOrder", decimal64, decimal64, bool)(element, msg); 1358 break; 1359 case "bid128_totalOrder": 1360 outcome = test2!("totalOrder", decimal128, decimal128, bool)(element, msg); 1361 break; 1362 case "bid32_totalOrderMag": 1363 outcome = test2!("totalOrderAbs", decimal32, decimal32, bool)(element, msg); 1364 break; 1365 case "bid64_totalOrderMag": 1366 outcome = test2!("totalOrderAbs", decimal64, decimal64, bool)(element, msg); 1367 break; 1368 case "bid128_totalOrderMag": 1369 outcome = test2!("totalOrderAbs", decimal128, decimal128, bool)(element, msg); 1370 break; 1371 case "bid32_sameQuantum": 1372 outcome = test2!("sameQuantum", decimal32, decimal32, bool)(element, msg); 1373 break; 1374 case "bid64_sameQuantum": 1375 outcome = test2!("sameQuantum", decimal64, decimal64, bool)(element, msg); 1376 break; 1377 case "bid128_sameQuantum": 1378 outcome = test2!("sameQuantum", decimal128, decimal128, bool)(element, msg); 1379 break; 1380 case "bid32_fmod": 1381 outcome = test2!("fmod", decimal32, decimal32, decimal32)(element, msg); 1382 break; 1383 case "bid64_fmod": 1384 outcome = test2!("fmod", decimal64, decimal64, decimal64)(element, msg); 1385 break; 1386 case "bid128_fmod": 1387 outcome = test2!("fmod", decimal128, decimal128, decimal128)(element, msg); 1388 break; 1389 case "bid32_quantize": 1390 outcome = test2!("quantize", decimal32, decimal32, decimal32)(element, msg); 1391 break; 1392 case "bid64_quantize": 1393 outcome = test2!("quantize", decimal64, decimal64, decimal64)(element, msg); 1394 break; 1395 case "bid128_quantize": 1396 outcome = test2!("quantize", decimal128, decimal128, decimal128)(element, msg); 1397 break; 1398 case "bid32_fdim": 1399 outcome = test2!("fdim", decimal32, decimal32, decimal32)(element, msg); 1400 break; 1401 case "bid64_fdim": 1402 outcome = test2!("fdim", decimal64, decimal64, decimal64)(element, msg); 1403 break; 1404 case "bid128_fdim": 1405 outcome = test2!("fdim", decimal128, decimal128, decimal128)(element, msg); 1406 break; 1407 case "bid32_nextafter": 1408 outcome = test2!("nextAfter", decimal32, decimal32, decimal32)(element, msg); 1409 break; 1410 case "bid64_nextafter": 1411 outcome = test2!("nextAfter", decimal64, decimal64, decimal64)(element, msg); 1412 break; 1413 case "bid128_nextafter": 1414 outcome = test2!("nextAfter", decimal128, decimal128, decimal128)(element, msg); 1415 break; 1416 case "bid32_nexttoward": 1417 outcome = test2!("nextToward", decimal32, decimal128, decimal32)(element, msg); 1418 break; 1419 case "bid64_nexttoward": 1420 outcome = test2!("nextToward", decimal64, decimal128, decimal64)(element, msg); 1421 break; 1422 case "bid32_fma": 1423 outcome = test3!("fma", decimal32, decimal32, decimal32, decimal32)(element, msg, false); 1424 break; 1425 case "bid64_fma": 1426 outcome = test3!("fma", decimal64, decimal64, decimal64, decimal64)(element, msg, false); 1427 break; 1428 case "bid128_fma": 1429 outcome = test3!("fma", decimal128, decimal128, decimal128, decimal128)(element, msg, false); 1430 break; 1431 case "bid64ddq_fma": 1432 outcome = test3!("fma", decimal64, decimal64, decimal128, decimal64)(element, msg, false); 1433 break; 1434 case "bid64dqd_fma": 1435 outcome = test3!("fma", decimal64, decimal128, decimal64, decimal64)(element, msg, false); 1436 break; 1437 case "bid64dqq_fma": 1438 outcome = test3!("fma", decimal64, decimal128, decimal128, decimal64)(element, msg, false); 1439 break; 1440 case "bid64qdd_fma": 1441 outcome = test3!("fma", decimal128, decimal64, decimal64, decimal64)(element, msg, false); 1442 break; 1443 case "bid64qdq_fma": 1444 outcome = test3!("fma", decimal128, decimal64, decimal128, decimal64)(element, msg, false); 1445 break; 1446 case "bid64qqq_fma": 1447 outcome = test3!("fma", decimal128, decimal128, decimal128, decimal64)(element, msg, false); 1448 break; 1449 case "bid64qqd_fma": 1450 outcome = test3!("fma", decimal128, decimal128, decimal64, decimal64)(element, msg, false); 1451 break; 1452 case "bid128_nexttoward": 1453 outcome = test2!("nextToward", decimal128, decimal128, decimal128)(element, msg); 1454 break; 1455 //case "bid32_rem": 1456 // outcome = test2!("remainder", decimal32, decimal32, decimal32)(element, msg); 1457 // break; 1458 case "bid32_lround": 1459 if (element.longintsize == 64) 1460 outcome = test1!("lround", decimal32, long)(element, msg); 1461 else 1462 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.tiesToAway); 1463 break; 1464 case "bid64_lround": 1465 if (element.longintsize == 64) 1466 outcome = test1!("lround", decimal64, long)(element, msg); 1467 else 1468 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.tiesToAway); 1469 break; 1470 case "bid128_lround": 1471 if (element.longintsize == 64) 1472 outcome = test1!("lround", decimal128, long)(element, msg); 1473 else 1474 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.tiesToAway); 1475 break; 1476 case "bid32_llrint": 1477 outcome = test1!("lrint", decimal32, long)(element, msg); 1478 break; 1479 case "bid64_llrint": 1480 outcome = test1!("lrint", decimal64, long)(element, msg); 1481 break; 1482 case "bid128_llrint": 1483 outcome = test1!("lrint", decimal128, long)(element, msg); 1484 break; 1485 case "bid32_lrint": 1486 if (element.longintsize == 64) 1487 outcome = test1!("lrint", decimal32, long)(element, msg); 1488 else 1489 outcome = test_rounding!("toExact!int", decimal32, int)(element, msg, translateRounding(element.rounding)); 1490 break; 1491 case "bid64_lrint": 1492 if (element.longintsize == 64) 1493 outcome = test1!("lrint", decimal64, long)(element, msg); 1494 else 1495 outcome = test_rounding!("toExact!int", decimal64, int)(element, msg, translateRounding(element.rounding)); 1496 break; 1497 case "bid128_lrint": 1498 if (element.longintsize == 64) 1499 outcome = test1!("lrint", decimal128, long)(element, msg); 1500 else 1501 outcome = test_rounding!("toExact!int", decimal128, int)(element, msg, translateRounding(element.rounding)); 1502 break; 1503 case "bid32_round_integral_nearest_away": 1504 outcome = test_rounding!("nearbyint", decimal32, decimal32)(element, msg, RoundingMode.tiesToAway); 1505 break; 1506 case "bid32_round_integral_nearest_even": 1507 outcome = test_rounding!("nearbyint", decimal32, decimal32)(element, msg, RoundingMode.tiesToEven); 1508 break; 1509 case "bid32_round_integral_negative": 1510 outcome = test_rounding!("nearbyint", decimal32, decimal32)(element, msg, RoundingMode.towardNegative); 1511 break; 1512 case "bid32_round_integral_positive": 1513 outcome = test_rounding!("nearbyint", decimal32, decimal32)(element, msg, RoundingMode.towardPositive); 1514 break; 1515 case "bid32_round_integral_zero": 1516 outcome = test_rounding!("nearbyint", decimal32, decimal32)(element, msg, RoundingMode.towardZero); 1517 break; 1518 case "bid32_round_integral_exact": 1519 outcome = test1!("rint", decimal32, decimal32)(element, msg); 1520 break; 1521 case "bid64_round_integral_nearest_away": 1522 outcome = test_rounding!("nearbyint", decimal64, decimal64)(element, msg, RoundingMode.tiesToAway); 1523 break; 1524 case "bid64_round_integral_nearest_even": 1525 outcome = test_rounding!("nearbyint", decimal64, decimal64)(element, msg, RoundingMode.tiesToEven); 1526 break; 1527 case "bid64_round_integral_negative": 1528 outcome = test_rounding!("nearbyint", decimal64, decimal64)(element, msg, RoundingMode.towardNegative); 1529 break; 1530 case "bid64_round_integral_positive": 1531 outcome = test_rounding!("nearbyint", decimal64, decimal64)(element, msg, RoundingMode.towardPositive); 1532 break; 1533 case "bid64_round_integral_zero": 1534 outcome = test_rounding!("nearbyint", decimal64, decimal64)(element, msg, RoundingMode.towardZero); 1535 break; 1536 case "bid64_round_integral_exact": 1537 outcome = test1!("rint", decimal64, decimal64)(element, msg); 1538 break; 1539 case "bid128_round_integral_nearest_away": 1540 outcome = test_rounding!("nearbyint", decimal128, decimal128)(element, msg, RoundingMode.tiesToAway); 1541 break; 1542 case "bid128_round_integral_nearest_even": 1543 outcome = test_rounding!("nearbyint", decimal128, decimal128)(element, msg, RoundingMode.tiesToEven); 1544 break; 1545 case "bid128_round_integral_negative": 1546 outcome = test_rounding!("nearbyint", decimal128, decimal128)(element, msg, RoundingMode.towardNegative); 1547 break; 1548 case "bid128_round_integral_positive": 1549 outcome = test_rounding!("nearbyint", decimal128, decimal128)(element, msg, RoundingMode.towardPositive); 1550 break; 1551 case "bid128_round_integral_zero": 1552 outcome = test_rounding!("nearbyint", decimal128, decimal128)(element, msg, RoundingMode.towardZero); 1553 break; 1554 case "bid32_nearbyint": 1555 outcome = test1!("nearbyint", decimal32, decimal32)(element, msg); 1556 break; 1557 case "bid64_nearbyint": 1558 outcome = test1!("nearbyint", decimal64, decimal64)(element, msg); 1559 break; 1560 case "bid128_nearbyint": 1561 outcome = test1!("nearbyint", decimal128, decimal128)(element, msg); 1562 break; 1563 case "bid128_round_integral_exact": 1564 outcome = test1!("rint", decimal128, decimal128)(element, msg); 1565 break; 1566 case "bid32_to_int8_ceil": 1567 outcome = test_rounding!("decimal.to!byte", decimal32, byte)(element, msg, RoundingMode.towardPositive); 1568 break; 1569 case "bid32_to_int8_floor": 1570 outcome = test_rounding!("decimal.to!byte", decimal32, byte)(element, msg, RoundingMode.towardNegative); 1571 break; 1572 case "bid32_to_int8_rninta": 1573 outcome = test_rounding!("decimal.to!byte", decimal32, byte)(element, msg, RoundingMode.tiesToAway); 1574 break; 1575 case "bid32_to_int8_int": 1576 outcome = test_rounding!("decimal.to!byte", decimal32, byte)(element, msg, RoundingMode.towardZero); 1577 break; 1578 case "bid32_to_int8_rnint": 1579 outcome = test_rounding!("decimal.to!byte", decimal32, byte)(element, msg, RoundingMode.tiesToEven); 1580 break; 1581 case "bid32_to_int8_xceil": 1582 outcome = test_rounding!("decimal.toExact!byte", decimal32, byte)(element, msg, RoundingMode.towardPositive); 1583 break; 1584 case "bid32_to_int8_xfloor": 1585 outcome = test_rounding!("decimal.toExact!byte", decimal32, byte)(element, msg, RoundingMode.towardNegative); 1586 break; 1587 case "bid32_to_int8_xrninta": 1588 outcome = test_rounding!("decimal.toExact!byte", decimal32, byte)(element, msg, RoundingMode.tiesToAway); 1589 break; 1590 case "bid32_to_int8_xint": 1591 outcome = test_rounding!("decimal.toExact!byte", decimal32, byte)(element, msg, RoundingMode.towardZero); 1592 break; 1593 case "bid32_to_int8_xrnint": 1594 outcome = test_rounding!("decimal.toExact!byte", decimal32, byte)(element, msg, RoundingMode.tiesToEven); 1595 break; 1596 case "bid32_to_uint8_ceil": 1597 outcome = test_rounding!("decimal.to!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardPositive); 1598 break; 1599 case "bid32_to_uint8_floor": 1600 outcome = test_rounding!("decimal.to!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardNegative); 1601 break; 1602 case "bid32_to_uint8_rninta": 1603 outcome = test_rounding!("decimal.to!ubyte", decimal32, ubyte)(element, msg, RoundingMode.tiesToAway); 1604 break; 1605 case "bid32_to_uint8_int": 1606 outcome = test_rounding!("decimal.to!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardZero); 1607 break; 1608 case "bid32_to_uint8_rnint": 1609 outcome = test_rounding!("decimal.to!ubyte", decimal32, ubyte)(element, msg, RoundingMode.tiesToEven); 1610 break; 1611 case "bid32_to_uint8_xceil": 1612 outcome = test_rounding!("decimal.toExact!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardPositive); 1613 break; 1614 case "bid32_to_uint8_xfloor": 1615 outcome = test_rounding!("decimal.toExact!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardNegative); 1616 break; 1617 case "bid32_to_uint8_xrninta": 1618 outcome = test_rounding!("decimal.toExact!ubyte", decimal32, ubyte)(element, msg, RoundingMode.tiesToAway); 1619 break; 1620 case "bid32_to_uint8_xint": 1621 outcome = test_rounding!("decimal.toExact!ubyte", decimal32, ubyte)(element, msg, RoundingMode.towardZero); 1622 break; 1623 case "bid32_to_uint8_xrnint": 1624 outcome = test_rounding!("decimal.toExact!ubyte", decimal32, ubyte)(element, msg, RoundingMode.tiesToEven); 1625 break; 1626 case "bid32_to_int16_ceil": 1627 outcome = test_rounding!("decimal.to!short", decimal32, short)(element, msg, RoundingMode.towardPositive); 1628 break; 1629 case "bid32_to_int16_floor": 1630 outcome = test_rounding!("decimal.to!short", decimal32, short)(element, msg, RoundingMode.towardNegative); 1631 break; 1632 case "bid32_to_int16_rninta": 1633 outcome = test_rounding!("decimal.to!short", decimal32, short)(element, msg, RoundingMode.tiesToAway); 1634 break; 1635 case "bid32_to_int16_int": 1636 outcome = test_rounding!("decimal.to!short", decimal32, short)(element, msg, RoundingMode.towardZero); 1637 break; 1638 case "bid32_to_int16_rnint": 1639 outcome = test_rounding!("decimal.to!short", decimal32, short)(element, msg, RoundingMode.tiesToEven); 1640 break; 1641 case "bid32_to_int16_xceil": 1642 outcome = test_rounding!("decimal.toExact!short", decimal32, short)(element, msg, RoundingMode.towardPositive); 1643 break; 1644 case "bid32_to_int16_xfloor": 1645 outcome = test_rounding!("decimal.toExact!short", decimal32, short)(element, msg, RoundingMode.towardNegative); 1646 break; 1647 case "bid32_to_int16_xrninta": 1648 outcome = test_rounding!("decimal.toExact!short", decimal32, short)(element, msg, RoundingMode.tiesToAway); 1649 break; 1650 case "bid32_to_int16_xint": 1651 outcome = test_rounding!("decimal.toExact!short", decimal32, short)(element, msg, RoundingMode.towardZero); 1652 break; 1653 case "bid32_to_int16_xrnint": 1654 outcome = test_rounding!("decimal.toExact!short", decimal32, short)(element, msg, RoundingMode.tiesToEven); 1655 break; 1656 case "bid32_to_uint16_ceil": 1657 outcome = test_rounding!("decimal.to!ushort", decimal32, ushort)(element, msg, RoundingMode.towardPositive); 1658 break; 1659 case "bid32_to_uint16_floor": 1660 outcome = test_rounding!("decimal.to!ushort", decimal32, ushort)(element, msg, RoundingMode.towardNegative); 1661 break; 1662 case "bid32_to_uint16_rninta": 1663 outcome = test_rounding!("decimal.to!ushort", decimal32, ushort)(element, msg, RoundingMode.tiesToAway); 1664 break; 1665 case "bid32_to_uint16_int": 1666 outcome = test_rounding!("decimal.to!ushort", decimal32, ushort)(element, msg, RoundingMode.towardZero); 1667 break; 1668 case "bid32_to_uint16_rnint": 1669 outcome = test_rounding!("decimal.to!ushort", decimal32, ushort)(element, msg, RoundingMode.tiesToEven); 1670 break; 1671 case "bid32_to_uint16_xceil": 1672 outcome = test_rounding!("decimal.toExact!ushort", decimal32, ushort)(element, msg, RoundingMode.towardPositive); 1673 break; 1674 case "bid32_to_uint16_xfloor": 1675 outcome = test_rounding!("decimal.toExact!ushort", decimal32, ushort)(element, msg, RoundingMode.towardNegative); 1676 break; 1677 case "bid32_to_uint16_xrninta": 1678 outcome = test_rounding!("decimal.toExact!ushort", decimal32, ushort)(element, msg, RoundingMode.tiesToAway); 1679 break; 1680 case "bid32_to_uint16_xint": 1681 outcome = test_rounding!("decimal.toExact!ushort", decimal32, ushort)(element, msg, RoundingMode.towardZero); 1682 break; 1683 case "bid32_to_uint16_xrnint": 1684 outcome = test_rounding!("decimal.toExact!ushort", decimal32, ushort)(element, msg, RoundingMode.tiesToEven); 1685 break; 1686 case "bid32_to_int32_ceil": 1687 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.towardPositive); 1688 break; 1689 case "bid32_to_int32_floor": 1690 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.towardNegative); 1691 break; 1692 case "bid32_to_int32_rninta": 1693 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.tiesToAway); 1694 break; 1695 case "bid32_to_int32_int": 1696 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.towardZero); 1697 break; 1698 case "bid32_to_int32_rnint": 1699 outcome = test_rounding!("decimal.to!int", decimal32, int)(element, msg, RoundingMode.tiesToEven); 1700 break; 1701 case "bid32_to_int32_xceil": 1702 outcome = test_rounding!("decimal.toExact!int", decimal32, int)(element, msg, RoundingMode.towardPositive); 1703 break; 1704 case "bid32_to_int32_xfloor": 1705 outcome = test_rounding!("decimal.toExact!int", decimal32, int)(element, msg, RoundingMode.towardNegative); 1706 break; 1707 case "bid32_to_int32_xrninta": 1708 outcome = test_rounding!("decimal.toExact!int", decimal32, int)(element, msg, RoundingMode.tiesToAway); 1709 break; 1710 case "bid32_to_int32_xint": 1711 outcome = test_rounding!("decimal.toExact!int", decimal32, int)(element, msg, RoundingMode.towardZero); 1712 break; 1713 case "bid32_to_int32_xrnint": 1714 outcome = test_rounding!("decimal.toExact!int", decimal32, int)(element, msg, RoundingMode.tiesToEven); 1715 break; 1716 case "bid32_to_uint32_ceil": 1717 outcome = test_rounding!("decimal.to!uint", decimal32, uint)(element, msg, RoundingMode.towardPositive); 1718 break; 1719 case "bid32_to_uint32_floor": 1720 outcome = test_rounding!("decimal.to!uint", decimal32, uint)(element, msg, RoundingMode.towardNegative); 1721 break; 1722 case "bid32_to_uint32_rninta": 1723 outcome = test_rounding!("decimal.to!uint", decimal32, uint)(element, msg, RoundingMode.tiesToAway); 1724 break; 1725 case "bid32_to_uint32_int": 1726 outcome = test_rounding!("decimal.to!uint", decimal32, uint)(element, msg, RoundingMode.towardZero); 1727 break; 1728 case "bid32_to_uint32_rnint": 1729 outcome = test_rounding!("decimal.to!uint", decimal32, uint)(element, msg, RoundingMode.tiesToEven); 1730 break; 1731 case "bid32_to_uint32_xceil": 1732 outcome = test_rounding!("decimal.toExact!uint", decimal32, uint)(element, msg, RoundingMode.towardPositive); 1733 break; 1734 case "bid32_to_uint32_xfloor": 1735 outcome = test_rounding!("decimal.toExact!uint", decimal32, uint)(element, msg, RoundingMode.towardNegative); 1736 break; 1737 case "bid32_to_uint32_xrninta": 1738 outcome = test_rounding!("decimal.toExact!uint", decimal32, uint)(element, msg, RoundingMode.tiesToAway); 1739 break; 1740 case "bid32_to_uint32_xint": 1741 outcome = test_rounding!("decimal.toExact!uint", decimal32, uint)(element, msg, RoundingMode.towardZero); 1742 break; 1743 case "bid32_to_uint32_xrnint": 1744 outcome = test_rounding!("decimal.toExact!uint", decimal32, uint)(element, msg, RoundingMode.tiesToEven); 1745 break; 1746 case "bid32_to_int64_ceil": 1747 outcome = test_rounding!("decimal.to!long", decimal32, long)(element, msg, RoundingMode.towardPositive); 1748 break; 1749 case "bid32_to_int64_floor": 1750 outcome = test_rounding!("decimal.to!long", decimal32, long)(element, msg, RoundingMode.towardNegative); 1751 break; 1752 case "bid32_to_int64_rninta": 1753 outcome = test_rounding!("decimal.to!long", decimal32, long)(element, msg, RoundingMode.tiesToAway); 1754 break; 1755 case "bid32_to_int64_int": 1756 outcome = test_rounding!("decimal.to!long", decimal32, long)(element, msg, RoundingMode.towardZero); 1757 break; 1758 case "bid32_to_int64_rnint": 1759 outcome = test_rounding!("decimal.to!long", decimal32, long)(element, msg, RoundingMode.tiesToEven); 1760 break; 1761 case "bid32_to_int64_xceil": 1762 outcome = test_rounding!("decimal.toExact!long", decimal32, long)(element, msg, RoundingMode.towardPositive); 1763 break; 1764 case "bid32_to_int64_xfloor": 1765 outcome = test_rounding!("decimal.toExact!long", decimal32, long)(element, msg, RoundingMode.towardNegative); 1766 break; 1767 case "bid32_to_int64_xrninta": 1768 outcome = test_rounding!("decimal.toExact!long", decimal32, long)(element, msg, RoundingMode.tiesToAway); 1769 break; 1770 case "bid32_to_int64_xint": 1771 outcome = test_rounding!("decimal.toExact!long", decimal32, long)(element, msg, RoundingMode.towardZero); 1772 break; 1773 case "bid32_to_int64_xrnint": 1774 outcome = test_rounding!("decimal.toExact!long", decimal32, long)(element, msg, RoundingMode.tiesToEven); 1775 break; 1776 case "bid32_to_uint64_ceil": 1777 outcome = test_rounding!("decimal.to!ulong", decimal32, ulong)(element, msg, RoundingMode.towardPositive); 1778 break; 1779 case "bid32_to_uint64_floor": 1780 outcome = test_rounding!("decimal.to!ulong", decimal32, ulong)(element, msg, RoundingMode.towardNegative); 1781 break; 1782 case "bid32_to_uint64_rninta": 1783 outcome = test_rounding!("decimal.to!ulong", decimal32, ulong)(element, msg, RoundingMode.tiesToAway); 1784 break; 1785 case "bid32_to_uint64_int": 1786 outcome = test_rounding!("decimal.to!ulong", decimal32, ulong)(element, msg, RoundingMode.towardZero); 1787 break; 1788 case "bid32_to_uint64_rnint": 1789 outcome = test_rounding!("decimal.to!ulong", decimal32, ulong)(element, msg, RoundingMode.tiesToEven); 1790 break; 1791 case "bid32_to_uint64_xceil": 1792 outcome = test_rounding!("decimal.toExact!ulong", decimal32, ulong)(element, msg, RoundingMode.towardPositive); 1793 break; 1794 case "bid32_to_uint64_xfloor": 1795 outcome = test_rounding!("decimal.toExact!ulong", decimal32, ulong)(element, msg, RoundingMode.towardNegative); 1796 break; 1797 case "bid32_to_uint64_xrninta": 1798 outcome = test_rounding!("decimal.toExact!ulong", decimal32, ulong)(element, msg, RoundingMode.tiesToAway); 1799 break; 1800 case "bid32_to_uint64_xint": 1801 outcome = test_rounding!("decimal.toExact!ulong", decimal32, ulong)(element, msg, RoundingMode.towardZero); 1802 break; 1803 case "bid32_to_uint64_xrnint": 1804 outcome = test_rounding!("decimal.toExact!ulong", decimal32, ulong)(element, msg, RoundingMode.tiesToEven); 1805 break; 1806 case "bid64_to_int8_ceil": 1807 outcome = test_rounding!("decimal.to!byte", decimal64, byte)(element, msg, RoundingMode.towardPositive); 1808 break; 1809 case "bid64_to_int8_floor": 1810 outcome = test_rounding!("decimal.to!byte", decimal64, byte)(element, msg, RoundingMode.towardNegative); 1811 break; 1812 case "bid64_to_int8_rninta": 1813 outcome = test_rounding!("decimal.to!byte", decimal64, byte)(element, msg, RoundingMode.tiesToAway); 1814 break; 1815 case "bid64_to_int8_int": 1816 outcome = test_rounding!("decimal.to!byte", decimal64, byte)(element, msg, RoundingMode.towardZero); 1817 break; 1818 case "bid64_to_int8_rnint": 1819 outcome = test_rounding!("decimal.to!byte", decimal64, byte)(element, msg, RoundingMode.tiesToEven); 1820 break; 1821 case "bid64_to_int8_xceil": 1822 outcome = test_rounding!("decimal.toExact!byte", decimal64, byte)(element, msg, RoundingMode.towardPositive); 1823 break; 1824 case "bid64_to_int8_xfloor": 1825 outcome = test_rounding!("decimal.toExact!byte", decimal64, byte)(element, msg, RoundingMode.towardNegative); 1826 break; 1827 case "bid64_to_int8_xrninta": 1828 outcome = test_rounding!("decimal.toExact!byte", decimal64, byte)(element, msg, RoundingMode.tiesToAway); 1829 break; 1830 case "bid64_to_int8_xint": 1831 outcome = test_rounding!("decimal.toExact!byte", decimal64, byte)(element, msg, RoundingMode.towardZero); 1832 break; 1833 case "bid64_to_int8_xrnint": 1834 outcome = test_rounding!("decimal.toExact!byte", decimal64, byte)(element, msg, RoundingMode.tiesToEven); 1835 break; 1836 case "bid64_to_uint8_ceil": 1837 outcome = test_rounding!("decimal.to!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardPositive); 1838 break; 1839 case "bid64_to_uint8_floor": 1840 outcome = test_rounding!("decimal.to!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardNegative); 1841 break; 1842 case "bid64_to_uint8_rninta": 1843 outcome = test_rounding!("decimal.to!ubyte", decimal64, ubyte)(element, msg, RoundingMode.tiesToAway); 1844 break; 1845 case "bid64_to_uint8_int": 1846 outcome = test_rounding!("decimal.to!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardZero); 1847 break; 1848 case "bid64_to_uint8_rnint": 1849 outcome = test_rounding!("decimal.to!ubyte", decimal64, ubyte)(element, msg, RoundingMode.tiesToEven); 1850 break; 1851 case "bid64_to_uint8_xceil": 1852 outcome = test_rounding!("decimal.toExact!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardPositive); 1853 break; 1854 case "bid64_to_uint8_xfloor": 1855 outcome = test_rounding!("decimal.toExact!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardNegative); 1856 break; 1857 case "bid64_to_uint8_xrninta": 1858 outcome = test_rounding!("decimal.toExact!ubyte", decimal64, ubyte)(element, msg, RoundingMode.tiesToAway); 1859 break; 1860 case "bid64_to_uint8_xint": 1861 outcome = test_rounding!("decimal.toExact!ubyte", decimal64, ubyte)(element, msg, RoundingMode.towardZero); 1862 break; 1863 case "bid64_to_uint8_xrnint": 1864 outcome = test_rounding!("decimal.toExact!ubyte", decimal64, ubyte)(element, msg, RoundingMode.tiesToEven); 1865 break; 1866 case "bid64_to_int16_ceil": 1867 outcome = test_rounding!("decimal.to!short", decimal64, short)(element, msg, RoundingMode.towardPositive); 1868 break; 1869 case "bid64_to_int16_floor": 1870 outcome = test_rounding!("decimal.to!short", decimal64, short)(element, msg, RoundingMode.towardNegative); 1871 break; 1872 case "bid64_to_int16_rninta": 1873 outcome = test_rounding!("decimal.to!short", decimal64, short)(element, msg, RoundingMode.tiesToAway); 1874 break; 1875 case "bid64_to_int16_int": 1876 outcome = test_rounding!("decimal.to!short", decimal64, short)(element, msg, RoundingMode.towardZero); 1877 break; 1878 case "bid64_to_int16_rnint": 1879 outcome = test_rounding!("decimal.to!short", decimal64, short)(element, msg, RoundingMode.tiesToEven); 1880 break; 1881 case "bid64_to_int16_xceil": 1882 outcome = test_rounding!("decimal.toExact!short", decimal64, short)(element, msg, RoundingMode.towardPositive); 1883 break; 1884 case "bid64_to_int16_xfloor": 1885 outcome = test_rounding!("decimal.toExact!short", decimal64, short)(element, msg, RoundingMode.towardNegative); 1886 break; 1887 case "bid64_to_int16_xrninta": 1888 outcome = test_rounding!("decimal.toExact!short", decimal64, short)(element, msg, RoundingMode.tiesToAway); 1889 break; 1890 case "bid64_to_int16_xint": 1891 outcome = test_rounding!("decimal.toExact!short", decimal64, short)(element, msg, RoundingMode.towardZero); 1892 break; 1893 case "bid64_to_int16_xrnint": 1894 outcome = test_rounding!("decimal.toExact!short", decimal64, short)(element, msg, RoundingMode.tiesToEven); 1895 break; 1896 case "bid64_to_uint16_ceil": 1897 outcome = test_rounding!("decimal.to!ushort", decimal64, ushort)(element, msg, RoundingMode.towardPositive); 1898 break; 1899 case "bid64_to_uint16_floor": 1900 outcome = test_rounding!("decimal.to!ushort", decimal64, ushort)(element, msg, RoundingMode.towardNegative); 1901 break; 1902 case "bid64_to_uint16_rninta": 1903 outcome = test_rounding!("decimal.to!ushort", decimal64, ushort)(element, msg, RoundingMode.tiesToAway); 1904 break; 1905 case "bid64_to_uint16_int": 1906 outcome = test_rounding!("decimal.to!ushort", decimal64, ushort)(element, msg, RoundingMode.towardZero); 1907 break; 1908 case "bid64_to_uint16_rnint": 1909 outcome = test_rounding!("decimal.to!ushort", decimal64, ushort)(element, msg, RoundingMode.tiesToEven); 1910 break; 1911 case "bid64_to_uint16_xceil": 1912 outcome = test_rounding!("decimal.toExact!ushort", decimal64, ushort)(element, msg, RoundingMode.towardPositive); 1913 break; 1914 case "bid64_to_uint16_xfloor": 1915 outcome = test_rounding!("decimal.toExact!ushort", decimal64, ushort)(element, msg, RoundingMode.towardNegative); 1916 break; 1917 case "bid64_to_uint16_xrninta": 1918 outcome = test_rounding!("decimal.toExact!ushort", decimal64, ushort)(element, msg, RoundingMode.tiesToAway); 1919 break; 1920 case "bid64_to_uint16_xint": 1921 outcome = test_rounding!("decimal.toExact!ushort", decimal64, ushort)(element, msg, RoundingMode.towardZero); 1922 break; 1923 case "bid64_to_uint16_xrnint": 1924 outcome = test_rounding!("decimal.toExact!ushort", decimal64, ushort)(element, msg, RoundingMode.tiesToEven); 1925 break; 1926 case "bid64_to_int32_ceil": 1927 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.towardPositive); 1928 break; 1929 case "bid64_to_int32_floor": 1930 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.towardNegative); 1931 break; 1932 case "bid64_to_int32_rninta": 1933 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.tiesToAway); 1934 break; 1935 case "bid64_to_int32_int": 1936 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.towardZero); 1937 break; 1938 case "bid64_to_int32_rnint": 1939 outcome = test_rounding!("decimal.to!int", decimal64, int)(element, msg, RoundingMode.tiesToEven); 1940 break; 1941 case "bid64_to_int32_xceil": 1942 outcome = test_rounding!("decimal.toExact!int", decimal64, int)(element, msg, RoundingMode.towardPositive); 1943 break; 1944 case "bid64_to_int32_xfloor": 1945 outcome = test_rounding!("decimal.toExact!int", decimal64, int)(element, msg, RoundingMode.towardNegative); 1946 break; 1947 case "bid64_to_int32_xrninta": 1948 outcome = test_rounding!("decimal.toExact!int", decimal64, int)(element, msg, RoundingMode.tiesToAway); 1949 break; 1950 case "bid64_to_int32_xint": 1951 outcome = test_rounding!("decimal.toExact!int", decimal64, int)(element, msg, RoundingMode.towardZero); 1952 break; 1953 case "bid64_to_int32_xrnint": 1954 outcome = test_rounding!("decimal.toExact!int", decimal64, int)(element, msg, RoundingMode.tiesToEven); 1955 break; 1956 case "bid64_to_uint32_ceil": 1957 outcome = test_rounding!("decimal.to!uint", decimal64, uint)(element, msg, RoundingMode.towardPositive); 1958 break; 1959 case "bid64_to_uint32_floor": 1960 outcome = test_rounding!("decimal.to!uint", decimal64, uint)(element, msg, RoundingMode.towardNegative); 1961 break; 1962 case "bid64_to_uint32_rninta": 1963 outcome = test_rounding!("decimal.to!uint", decimal64, uint)(element, msg, RoundingMode.tiesToAway); 1964 break; 1965 case "bid64_to_uint32_int": 1966 outcome = test_rounding!("decimal.to!uint", decimal64, uint)(element, msg, RoundingMode.towardZero); 1967 break; 1968 case "bid64_to_uint32_rnint": 1969 outcome = test_rounding!("decimal.to!uint", decimal64, uint)(element, msg, RoundingMode.tiesToEven); 1970 break; 1971 case "bid64_to_uint32_xceil": 1972 outcome = test_rounding!("decimal.toExact!uint", decimal64, uint)(element, msg, RoundingMode.towardPositive); 1973 break; 1974 case "bid64_to_uint32_xfloor": 1975 outcome = test_rounding!("decimal.toExact!uint", decimal64, uint)(element, msg, RoundingMode.towardNegative); 1976 break; 1977 case "bid64_to_uint32_xrninta": 1978 outcome = test_rounding!("decimal.toExact!uint", decimal64, uint)(element, msg, RoundingMode.tiesToAway); 1979 break; 1980 case "bid64_to_uint32_xint": 1981 outcome = test_rounding!("decimal.toExact!uint", decimal64, uint)(element, msg, RoundingMode.towardZero); 1982 break; 1983 case "bid64_to_uint32_xrnint": 1984 outcome = test_rounding!("decimal.toExact!uint", decimal64, uint)(element, msg, RoundingMode.tiesToEven); 1985 break; 1986 case "bid64_to_int64_ceil": 1987 outcome = test_rounding!("decimal.to!long", decimal64, long)(element, msg, RoundingMode.towardPositive); 1988 break; 1989 case "bid64_to_int64_floor": 1990 outcome = test_rounding!("decimal.to!long", decimal64, long)(element, msg, RoundingMode.towardNegative); 1991 break; 1992 case "bid64_to_int64_rninta": 1993 outcome = test_rounding!("decimal.to!long", decimal64, long)(element, msg, RoundingMode.tiesToAway); 1994 break; 1995 case "bid64_to_int64_int": 1996 outcome = test_rounding!("decimal.to!long", decimal64, long)(element, msg, RoundingMode.towardZero); 1997 break; 1998 case "bid64_to_int64_rnint": 1999 outcome = test_rounding!("decimal.to!long", decimal64, long)(element, msg, RoundingMode.tiesToEven); 2000 break; 2001 case "bid64_to_int64_xceil": 2002 outcome = test_rounding!("decimal.toExact!long", decimal64, long)(element, msg, RoundingMode.towardPositive); 2003 break; 2004 case "bid64_to_int64_xfloor": 2005 outcome = test_rounding!("decimal.toExact!long", decimal64, long)(element, msg, RoundingMode.towardNegative); 2006 break; 2007 case "bid64_to_int64_xrninta": 2008 outcome = test_rounding!("decimal.toExact!long", decimal64, long)(element, msg, RoundingMode.tiesToAway); 2009 break; 2010 case "bid64_to_int64_xint": 2011 outcome = test_rounding!("decimal.toExact!long", decimal64, long)(element, msg, RoundingMode.towardZero); 2012 break; 2013 case "bid64_to_int64_xrnint": 2014 outcome = test_rounding!("decimal.toExact!long", decimal64, long)(element, msg, RoundingMode.tiesToEven); 2015 break; 2016 case "bid64_to_uint64_ceil": 2017 outcome = test_rounding!("decimal.to!ulong", decimal64, ulong)(element, msg, RoundingMode.towardPositive); 2018 break; 2019 case "bid64_to_uint64_floor": 2020 outcome = test_rounding!("decimal.to!ulong", decimal64, ulong)(element, msg, RoundingMode.towardNegative); 2021 break; 2022 case "bid64_to_uint64_rninta": 2023 outcome = test_rounding!("decimal.to!ulong", decimal64, ulong)(element, msg, RoundingMode.tiesToAway); 2024 break; 2025 case "bid64_to_uint64_int": 2026 outcome = test_rounding!("decimal.to!ulong", decimal64, ulong)(element, msg, RoundingMode.towardZero); 2027 break; 2028 case "bid64_to_uint64_rnint": 2029 outcome = test_rounding!("decimal.to!ulong", decimal64, ulong)(element, msg, RoundingMode.tiesToEven); 2030 break; 2031 case "bid64_to_uint64_xceil": 2032 outcome = test_rounding!("decimal.toExact!ulong", decimal64, ulong)(element, msg, RoundingMode.towardPositive); 2033 break; 2034 case "bid64_to_uint64_xfloor": 2035 outcome = test_rounding!("decimal.toExact!ulong", decimal64, ulong)(element, msg, RoundingMode.towardNegative); 2036 break; 2037 case "bid64_to_uint64_xrninta": 2038 outcome = test_rounding!("decimal.toExact!ulong", decimal64, ulong)(element, msg, RoundingMode.tiesToAway); 2039 break; 2040 case "bid64_to_uint64_xint": 2041 outcome = test_rounding!("decimal.toExact!ulong", decimal64, ulong)(element, msg, RoundingMode.towardZero); 2042 break; 2043 case "bid64_to_uint64_xrnint": 2044 outcome = test_rounding!("decimal.toExact!ulong", decimal64, ulong)(element, msg, RoundingMode.tiesToEven); 2045 break; 2046 case "bid128_to_int8_ceil": 2047 outcome = test_rounding!("decimal.to!byte", decimal128, byte)(element, msg, RoundingMode.towardPositive); 2048 break; 2049 case "bid128_to_int8_floor": 2050 outcome = test_rounding!("decimal.to!byte", decimal128, byte)(element, msg, RoundingMode.towardNegative); 2051 break; 2052 case "bid128_to_int8_rninta": 2053 outcome = test_rounding!("decimal.to!byte", decimal128, byte)(element, msg, RoundingMode.tiesToAway); 2054 break; 2055 case "bid128_to_int8_int": 2056 outcome = test_rounding!("decimal.to!byte", decimal128, byte)(element, msg, RoundingMode.towardZero); 2057 break; 2058 case "bid128_to_int8_rnint": 2059 outcome = test_rounding!("decimal.to!byte", decimal128, byte)(element, msg, RoundingMode.tiesToEven); 2060 break; 2061 case "bid128_to_int8_xceil": 2062 outcome = test_rounding!("decimal.toExact!byte", decimal128, byte)(element, msg, RoundingMode.towardPositive); 2063 break; 2064 case "bid128_to_int8_xfloor": 2065 outcome = test_rounding!("decimal.toExact!byte", decimal128, byte)(element, msg, RoundingMode.towardNegative); 2066 break; 2067 case "bid128_to_int8_xrninta": 2068 outcome = test_rounding!("decimal.toExact!byte", decimal128, byte)(element, msg, RoundingMode.tiesToAway); 2069 break; 2070 case "bid128_to_int8_xint": 2071 outcome = test_rounding!("decimal.toExact!byte", decimal128, byte)(element, msg, RoundingMode.towardZero); 2072 break; 2073 case "bid128_to_int8_xrnint": 2074 outcome = test_rounding!("decimal.toExact!byte", decimal128, byte)(element, msg, RoundingMode.tiesToEven); 2075 break; 2076 case "bid128_to_uint8_ceil": 2077 outcome = test_rounding!("decimal.to!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardPositive); 2078 break; 2079 case "bid128_to_uint8_floor": 2080 outcome = test_rounding!("decimal.to!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardNegative); 2081 break; 2082 case "bid128_to_uint8_rninta": 2083 outcome = test_rounding!("decimal.to!ubyte", decimal128, ubyte)(element, msg, RoundingMode.tiesToAway); 2084 break; 2085 case "bid128_to_uint8_int": 2086 outcome = test_rounding!("decimal.to!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardZero); 2087 break; 2088 case "bid128_to_uint8_rnint": 2089 outcome = test_rounding!("decimal.to!ubyte", decimal128, ubyte)(element, msg, RoundingMode.tiesToEven); 2090 break; 2091 case "bid128_to_uint8_xceil": 2092 outcome = test_rounding!("decimal.toExact!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardPositive); 2093 break; 2094 case "bid128_to_uint8_xfloor": 2095 outcome = test_rounding!("decimal.toExact!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardNegative); 2096 break; 2097 case "bid128_to_uint8_xrninta": 2098 outcome = test_rounding!("decimal.toExact!ubyte", decimal128, ubyte)(element, msg, RoundingMode.tiesToAway); 2099 break; 2100 case "bid128_to_uint8_xint": 2101 outcome = test_rounding!("decimal.toExact!ubyte", decimal128, ubyte)(element, msg, RoundingMode.towardZero); 2102 break; 2103 case "bid128_to_uint8_xrnint": 2104 outcome = test_rounding!("decimal.toExact!ubyte", decimal128, ubyte)(element, msg, RoundingMode.tiesToEven); 2105 break; 2106 case "bid128_to_int16_ceil": 2107 outcome = test_rounding!("decimal.to!short", decimal128, short)(element, msg, RoundingMode.towardPositive); 2108 break; 2109 case "bid128_to_int16_floor": 2110 outcome = test_rounding!("decimal.to!short", decimal128, short)(element, msg, RoundingMode.towardNegative); 2111 break; 2112 case "bid128_to_int16_rninta": 2113 outcome = test_rounding!("decimal.to!short", decimal128, short)(element, msg, RoundingMode.tiesToAway); 2114 break; 2115 case "bid128_to_int16_int": 2116 outcome = test_rounding!("decimal.to!short", decimal128, short)(element, msg, RoundingMode.towardZero); 2117 break; 2118 case "bid128_to_int16_rnint": 2119 outcome = test_rounding!("decimal.to!short", decimal128, short)(element, msg, RoundingMode.tiesToEven); 2120 break; 2121 case "bid128_to_int16_xceil": 2122 outcome = test_rounding!("decimal.toExact!short", decimal128, short)(element, msg, RoundingMode.towardPositive); 2123 break; 2124 case "bid128_to_int16_xfloor": 2125 outcome = test_rounding!("decimal.toExact!short", decimal128, short)(element, msg, RoundingMode.towardNegative); 2126 break; 2127 case "bid128_to_int16_xrninta": 2128 outcome = test_rounding!("decimal.toExact!short", decimal128, short)(element, msg, RoundingMode.tiesToAway); 2129 break; 2130 case "bid128_to_int16_xint": 2131 outcome = test_rounding!("decimal.toExact!short", decimal128, short)(element, msg, RoundingMode.towardZero); 2132 break; 2133 case "bid128_to_int16_xrnint": 2134 outcome = test_rounding!("decimal.toExact!short", decimal128, short)(element, msg, RoundingMode.tiesToEven); 2135 break; 2136 case "bid128_to_uint16_ceil": 2137 outcome = test_rounding!("decimal.to!ushort", decimal128, ushort)(element, msg, RoundingMode.towardPositive); 2138 break; 2139 case "bid128_to_uint16_floor": 2140 outcome = test_rounding!("decimal.to!ushort", decimal128, ushort)(element, msg, RoundingMode.towardNegative); 2141 break; 2142 case "bid128_to_uint16_rninta": 2143 outcome = test_rounding!("decimal.to!ushort", decimal128, ushort)(element, msg, RoundingMode.tiesToAway); 2144 break; 2145 case "bid128_to_uint16_int": 2146 outcome = test_rounding!("decimal.to!ushort", decimal128, ushort)(element, msg, RoundingMode.towardZero); 2147 break; 2148 case "bid128_to_uint16_rnint": 2149 outcome = test_rounding!("decimal.to!ushort", decimal128, ushort)(element, msg, RoundingMode.tiesToEven); 2150 break; 2151 case "bid128_to_uint16_xceil": 2152 outcome = test_rounding!("decimal.toExact!ushort", decimal128, ushort)(element, msg, RoundingMode.towardPositive); 2153 break; 2154 case "bid128_to_uint16_xfloor": 2155 outcome = test_rounding!("decimal.toExact!ushort", decimal128, ushort)(element, msg, RoundingMode.towardNegative); 2156 break; 2157 case "bid128_to_uint16_xrninta": 2158 outcome = test_rounding!("decimal.toExact!ushort", decimal128, ushort)(element, msg, RoundingMode.tiesToAway); 2159 break; 2160 case "bid128_to_uint16_xint": 2161 outcome = test_rounding!("decimal.toExact!ushort", decimal128, ushort)(element, msg, RoundingMode.towardZero); 2162 break; 2163 case "bid128_to_uint16_xrnint": 2164 outcome = test_rounding!("decimal.toExact!ushort", decimal128, ushort)(element, msg, RoundingMode.tiesToEven); 2165 break; 2166 case "bid128_to_int32_ceil": 2167 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.towardPositive); 2168 break; 2169 case "bid128_to_int32_floor": 2170 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.towardNegative); 2171 break; 2172 case "bid128_to_int32_rninta": 2173 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.tiesToAway); 2174 break; 2175 case "bid128_to_int32_int": 2176 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.towardZero); 2177 break; 2178 case "bid128_to_int32_rnint": 2179 outcome = test_rounding!("decimal.to!int", decimal128, int)(element, msg, RoundingMode.tiesToEven); 2180 break; 2181 case "bid128_to_int32_xceil": 2182 outcome = test_rounding!("decimal.toExact!int", decimal128, int)(element, msg, RoundingMode.towardPositive); 2183 break; 2184 case "bid128_to_int32_xfloor": 2185 outcome = test_rounding!("decimal.toExact!int", decimal128, int)(element, msg, RoundingMode.towardNegative); 2186 break; 2187 case "bid128_to_int32_xrninta": 2188 outcome = test_rounding!("decimal.toExact!int", decimal128, int)(element, msg, RoundingMode.tiesToAway); 2189 break; 2190 case "bid128_to_int32_xint": 2191 outcome = test_rounding!("decimal.toExact!int", decimal128, int)(element, msg, RoundingMode.towardZero); 2192 break; 2193 case "bid128_to_int32_xrnint": 2194 outcome = test_rounding!("decimal.toExact!int", decimal128, int)(element, msg, RoundingMode.tiesToEven); 2195 break; 2196 case "bid128_to_uint32_ceil": 2197 outcome = test_rounding!("decimal.to!uint", decimal128, uint)(element, msg, RoundingMode.towardPositive); 2198 break; 2199 case "bid128_to_uint32_floor": 2200 outcome = test_rounding!("decimal.to!uint", decimal128, uint)(element, msg, RoundingMode.towardNegative); 2201 break; 2202 case "bid128_to_uint32_rninta": 2203 outcome = test_rounding!("decimal.to!uint", decimal128, uint)(element, msg, RoundingMode.tiesToAway); 2204 break; 2205 case "bid128_to_uint32_int": 2206 outcome = test_rounding!("decimal.to!uint", decimal128, uint)(element, msg, RoundingMode.towardZero); 2207 break; 2208 case "bid128_to_uint32_rnint": 2209 outcome = test_rounding!("decimal.to!uint", decimal128, uint)(element, msg, RoundingMode.tiesToEven); 2210 break; 2211 case "bid128_to_uint32_xceil": 2212 outcome = test_rounding!("decimal.toExact!uint", decimal128, uint)(element, msg, RoundingMode.towardPositive); 2213 break; 2214 case "bid128_to_uint32_xfloor": 2215 outcome = test_rounding!("decimal.toExact!uint", decimal128, uint)(element, msg, RoundingMode.towardNegative); 2216 break; 2217 case "bid128_to_uint32_xrninta": 2218 outcome = test_rounding!("decimal.toExact!uint", decimal128, uint)(element, msg, RoundingMode.tiesToAway); 2219 break; 2220 case "bid128_to_uint32_xint": 2221 outcome = test_rounding!("decimal.toExact!uint", decimal128, uint)(element, msg, RoundingMode.towardZero); 2222 break; 2223 case "bid128_to_uint32_xrnint": 2224 outcome = test_rounding!("decimal.toExact!uint", decimal128, uint)(element, msg, RoundingMode.tiesToEven); 2225 break; 2226 case "bid128_to_int64_ceil": 2227 outcome = test_rounding!("decimal.to!long", decimal128, long)(element, msg, RoundingMode.towardPositive); 2228 break; 2229 case "bid128_to_int64_floor": 2230 outcome = test_rounding!("decimal.to!long", decimal128, long)(element, msg, RoundingMode.towardNegative); 2231 break; 2232 case "bid128_to_int64_rninta": 2233 outcome = test_rounding!("decimal.to!long", decimal128, long)(element, msg, RoundingMode.tiesToAway); 2234 break; 2235 case "bid128_to_int64_int": 2236 outcome = test_rounding!("decimal.to!long", decimal128, long)(element, msg, RoundingMode.towardZero); 2237 break; 2238 case "bid128_to_int64_rnint": 2239 outcome = test_rounding!("decimal.to!long", decimal128, long)(element, msg, RoundingMode.tiesToEven); 2240 break; 2241 case "bid128_to_int64_xceil": 2242 outcome = test_rounding!("decimal.toExact!long", decimal128, long)(element, msg, RoundingMode.towardPositive); 2243 break; 2244 case "bid128_to_int64_xfloor": 2245 outcome = test_rounding!("decimal.toExact!long", decimal128, long)(element, msg, RoundingMode.towardNegative); 2246 break; 2247 case "bid128_to_int64_xrninta": 2248 outcome = test_rounding!("decimal.toExact!long", decimal128, long)(element, msg, RoundingMode.tiesToAway); 2249 break; 2250 case "bid128_to_int64_xint": 2251 outcome = test_rounding!("decimal.toExact!long", decimal128, long)(element, msg, RoundingMode.towardZero); 2252 break; 2253 case "bid128_to_int64_xrnint": 2254 outcome = test_rounding!("decimal.toExact!long", decimal128, long)(element, msg, RoundingMode.tiesToEven); 2255 break; 2256 case "bid128_to_uint64_ceil": 2257 outcome = test_rounding!("decimal.to!ulong", decimal128, ulong)(element, msg, RoundingMode.towardPositive); 2258 break; 2259 case "bid128_to_uint64_floor": 2260 outcome = test_rounding!("decimal.to!ulong", decimal128, ulong)(element, msg, RoundingMode.towardNegative); 2261 break; 2262 case "bid128_to_uint64_rninta": 2263 outcome = test_rounding!("decimal.to!ulong", decimal128, ulong)(element, msg, RoundingMode.tiesToAway); 2264 break; 2265 case "bid128_to_uint64_int": 2266 outcome = test_rounding!("decimal.to!ulong", decimal128, ulong)(element, msg, RoundingMode.towardZero); 2267 break; 2268 case "bid128_to_uint64_rnint": 2269 outcome = test_rounding!("decimal.to!ulong", decimal128, ulong)(element, msg, RoundingMode.tiesToEven); 2270 break; 2271 case "bid128_to_uint64_xceil": 2272 outcome = test_rounding!("decimal.toExact!ulong", decimal128, ulong)(element, msg, RoundingMode.towardPositive); 2273 break; 2274 case "bid128_to_uint64_xfloor": 2275 outcome = test_rounding!("decimal.toExact!ulong", decimal128, ulong)(element, msg, RoundingMode.towardNegative); 2276 break; 2277 case "bid128_to_uint64_xrninta": 2278 outcome = test_rounding!("decimal.toExact!ulong", decimal128, ulong)(element, msg, RoundingMode.tiesToAway); 2279 break; 2280 case "bid128_to_uint64_xint": 2281 outcome = test_rounding!("decimal.toExact!ulong", decimal128, ulong)(element, msg, RoundingMode.towardZero); 2282 break; 2283 case "bid128_to_uint64_xrnint": 2284 outcome = test_rounding!("decimal.toExact!ulong", decimal128, ulong)(element, msg, RoundingMode.tiesToEven); 2285 break; 2286 case "bid32_frexp": 2287 outcome = test_ref!("frexp", decimal32, int, decimal32)(element, msg); 2288 break; 2289 case "bid64_frexp": 2290 outcome = test_ref!("frexp", decimal64, int, decimal64)(element, msg); 2291 break; 2292 case "bid128_frexp": 2293 outcome = test_ref!("frexp", decimal128, int, decimal128)(element, msg); 2294 break; 2295 case "bid32_modf": 2296 outcome = test_ref!("modf", decimal32, decimal32, decimal32)(element, msg); 2297 break; 2298 case "bid64_modf": 2299 outcome = test_ref!("modf", decimal64, decimal64, decimal64)(element, msg); 2300 break; 2301 case "bid128_modf": 2302 outcome = test_ref!("modf", decimal128, decimal128, decimal128)(element, msg); 2303 break; 2304 case "bid32_sqrt": 2305 outcome = test1!("sqrt", decimal32, decimal32)(element, msg); 2306 break; 2307 case "bid64_sqrt": 2308 outcome = test1!("sqrt", decimal64, decimal64)(element, msg); 2309 break; 2310 case "bid64q_sqrt": 2311 outcome = test1!("sqrt", decimal128, decimal64)(element, msg); 2312 break; 2313 case "bid128_sqrt": 2314 outcome = test1!("sqrt", decimal128, decimal128)(element, msg); 2315 break; 2316 case "bid32_cbrt": 2317 outcome = test1!("cbrt", decimal32, decimal32)(element, msg); 2318 break; 2319 case "bid64_cbrt": 2320 outcome = test1!("cbrt", decimal64, decimal64)(element, msg); 2321 break; 2322 case "bid128_cbrt": 2323 outcome = test1!("cbrt", decimal128, decimal128)(element, msg); 2324 break; 2325 case "bid32_quantexp": 2326 outcome = test1!("quantexp", decimal32, int)(element, msg); 2327 break; 2328 case "bid64_quantexp": 2329 outcome = test1!("quantexp", decimal64, int)(element, msg); 2330 break; 2331 case "bid128_quantexp": 2332 outcome = test1!("quantexp", decimal128, int)(element, msg); 2333 break; 2334 //case "bid32_scalbn": 2335 // outcome = test2!("scalbn", decimal32, int, decimal32)(element, msg); 2336 // break; 2337 case "bid32_ldexp": 2338 outcome = test2!("scalbn", decimal32, int, decimal32)(element, msg); 2339 break; 2340 case "bid64_ldexp": 2341 outcome = test2!("scalbn", decimal64, int, decimal64)(element, msg); 2342 break; 2343 case "bid128_ldexp": 2344 outcome = test2!("scalbn", decimal128, int, decimal128)(element, msg); 2345 break; 2346 case "bid32_sin": 2347 outcome = test1!("sin", decimal32, decimal32)(element, msg); 2348 break; 2349 case "bid64_sin": 2350 outcome = test1!("sin", decimal64, decimal64)(element, msg); 2351 break; 2352 case "bid128_sin": 2353 outcome = test1!("sin", decimal128, decimal128)(element, msg); 2354 break; 2355 case "bid_is754": 2356 case "bid_is754R": 2357 case "bid_getDecimalRoundingDirection": 2358 case "bid_lowerFlags": 2359 //always 10 2360 case "bid32_radix": 2361 case "bid64_radix": 2362 case "bid128_radix": 2363 //flags management, we have our own 2364 case "bid_restoreFlags": 2365 case "bid_saveFlags": 2366 case "bid_setDecimalRoundingDirection": 2367 case "bid_signalException": 2368 case "bid_testFlags": 2369 case "str64": 2370 case "bid_testSavedFlags": 2371 case "bid_fetestexcept": 2372 case "bid_fesetexceptflag": 2373 case "bid_fegetexceptflag": 2374 case "bid_feraiseexcept": 2375 case "bid_feclearexcept": 2376 //no equivalent operators in D 2377 case "bid32_signaling_greater_unordered": 2378 case "bid64_signaling_greater_unordered": 2379 case "bid128_signaling_greater_unordered": 2380 case "bid32_signaling_less_unordered": 2381 case "bid64_signaling_less_unordered": 2382 case "bid128_signaling_less_unordered": 2383 case "bid32_signaling_not_greater": 2384 case "bid64_signaling_not_greater": 2385 case "bid128_signaling_not_greater": 2386 case "bid32_signaling_not_less": 2387 case "bid64_signaling_not_less": 2388 case "bid128_signaling_not_less": 2389 case "bid32_signaling_ordered": 2390 case "bid64_signaling_ordered": 2391 case "bid128_signaling_ordered": 2392 case "bid32_signaling_unordered": 2393 case "bid64_signaling_unordered": 2394 case "bid128_signaling_unordered": 2395 //better formatting engine than simple strings 2396 case "bid32_to_string": 2397 case "bid64_to_string": 2398 case "bid128_to_string": 2399 case "bid_strtod32": 2400 case "bid_strtod64": 2401 case "bid_strtod128": 2402 case "bid_wcstod32": 2403 case "bid_wcstod64": 2404 case "bid_wcstod128": 2405 //128 bit real not supported 2406 case "binary128_to_bid32": 2407 case "binary128_to_bid64": 2408 case "binary128_to_bid128": 2409 case "bid32_to_binary128": 2410 case "bid64_to_binary128": 2411 case "bid128_to_binary128": 2412 //bad formatted data in readtest.in file, anyway ldexp does the same thing for Intel (which is not correct) 2413 case "bid32_scalbn": 2414 case "bid64_scalbn": 2415 case "bid128_scalbn": 2416 case "bid32_scalbln": 2417 case "bid64_scalbln": 2418 case "bid128_scalbln": 2419 if (auto p = element.func in tests) 2420 ++((*p).notApplicable); 2421 else 2422 tests[element.func].notApplicable = 1; 2423 na = true; 2424 break; 2425 default: 2426 if (auto p = element.func in tests) 2427 ++((*p).skipped); 2428 else 2429 tests[element.func].notApplicable = 1; 2430 skip = true; 2431 break; 2432 } 2433 2434 if (!na && !skip) 2435 { 2436 auto p = element.func in tests; 2437 if (outcome) 2438 ++((*p).passed); 2439 else 2440 { 2441 ++((*p).failed); 2442 writeln(msg); 2443 } 2444 } 2445 } 2446 2447 writeln("Press Enter to continue..."); 2448 getchar(); 2449 2450 auto keys = sort(tests.keys); 2451 Stat stats; 2452 foreach(key; keys) 2453 { 2454 auto p = tests[key]; 2455 stats.total += p.total; 2456 stats.passed += p.passed; 2457 stats.failed += p.failed; 2458 stats.skipped += p.skipped; 2459 stats.notApplicable += p.notApplicable; 2460 2461 writefln("%-35s -> Total: %6d, Passed: %6d, Failed: %6d, Skipped: %6d, N/A: %6d, Completion: %7.2f%%", 2462 key, p.total, p.passed, p.failed, p.skipped, p.notApplicable, (p.notApplicable + p.passed) * 100.0 / p.total); 2463 } 2464 2465 writeln("=========================================================================================================="); 2466 writefln("%-35s -> Total: %6d, Passed: %6d, Failed: %6d, Skipped: %6d, N/A: %6d, Completion: %7.2f%%", 2467 "TOTAL", stats.total, stats.passed, stats.failed, stats.skipped, stats.notApplicable, (stats.notApplicable + stats.passed) * 100.0 / stats.total); 2468 2469 2470 2471 2472 2473 writeln(); 2474 2475 2476 writeln("Press Enter to continue..."); 2477 getchar(); 2478 return 0; 2479 }