00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#include "flpt.h"
00026
00027
VOID
00028 main(
00029
int argc,
00030
char *argv[]
00031 )
00032
00033 {
00034
00035
00036
00037
00038 printf(
"\nStart of floating point test\n");
00039
Test1();
00040
Test2();
00041
Test3();
00042
Test4();
00043
Test5();
00044
Test6();
00045
Test7();
00046
Test8();
00047
Test9();
00048
Test10();
00049
Test11();
00050
Test12();
00051
Test13();
00052
Test14();
00053
Test15();
00054
Test16();
00055
Test17();
00056
Test18();
00057
Test19();
00058
Test20();
00059
Test21();
00060
Test22();
00061
Test23();
00062
Test24();
00063
Test25();
00064
Test26();
00065
00066
00067
00068
00069
00070 printf(
"End of floating point test\n");
00071
return;
00072 }
00073
00074
VOID
00075 Test1 (
00076 VOID
00077 )
00078
00079 {
00080
00081 ULONG
Count;
00082
FLOATING_STATUS Fsr;
00083 ULONG SingleResult;
00084 ULONG Subtest;
00085
00086
00087
00088
00089
00090 Subtest = 0;
00091 printf(
" Test 1 - add/subtract single denormalized ...");
00092 Subtest += 1;
00093 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00094 0x3ff,
00095 0x1,
00096 &SingleResult);
00097
00098
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00099 (SingleResult != 0x400)) {
00100
goto TestFailed;
00101 }
00102
00103 Subtest += 1;
00104 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00105 0x1,
00106 0x7fff,
00107 &SingleResult);
00108
00109
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00110 (SingleResult != 0x8000)) {
00111
goto TestFailed;
00112 }
00113
00114 Subtest += 1;
00115 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00116 0x400000,
00117
SIGN | 0x440000,
00118 &SingleResult);
00119
00120
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00121 (SingleResult != (
SIGN | 0x40000))) {
00122
goto TestFailed;
00123 }
00124
00125 Subtest += 1;
00126 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00127
SIGN | 0x400000,
00128 0x440000,
00129 &SingleResult);
00130
00131
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00132 (SingleResult != 0x40000)) {
00133
goto TestFailed;
00134 }
00135
00136 Subtest += 1;
00137 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00138 0x400000,
00139
SIGN | 0x400000,
00140 &SingleResult);
00141
00142
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00143 (SingleResult != 0x0)) {
00144
goto TestFailed;
00145 }
00146
00147 Subtest += 1;
00148 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00149
SIGN | 0x400000,
00150 0x400000,
00151 &SingleResult);
00152
00153
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00154 (SingleResult != (
SIGN | 0x0))) {
00155
goto TestFailed;
00156 }
00157
00158 Subtest += 1;
00159 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00160 0x400000,
00161 0x400000,
00162 &SingleResult);
00163
00164
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00165 (SingleResult != 0x800000)) {
00166
goto TestFailed;
00167 }
00168
00169 Subtest += 1;
00170 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00171 0x800000,
00172 0x7fffff,
00173 &SingleResult);
00174
00175
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00176 (SingleResult != 0xffffff)) {
00177
goto TestFailed;
00178 }
00179
00180 Subtest += 1;
00181
Count = 0;
00182
try {
00183 Fsr.
Data =
AddSingle(
EI | ROUND_TO_NEAREST,
00184 0x800000,
00185 0x3f800000,
00186 &SingleResult);
00187
00188 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00189
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00190
Count += 1;
00191 }
00192
00193
if (
Count == 0) {
00194
goto TestFailed;
00195 }
00196
00197 Subtest += 1;
00198
Count = 0;
00199
try {
00200 Fsr.
Data =
AddSingle(
EO | ROUND_TO_NEAREST,
00201 0x7f000000,
00202 0x7f000000,
00203 &SingleResult);
00204
00205 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
00206
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00207
Count += 1;
00208 }
00209
00210
if (
Count == 0) {
00211
goto TestFailed;
00212 }
00213
00214 Subtest += 1;
00215
Count = 0;
00216
try {
00217 Fsr.
Data =
AddSingle(
EI | ROUND_TO_NEAREST,
00218 0x7f000000,
00219 0x7f000000,
00220 &SingleResult);
00221
00222 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00223
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00224
Count += 1;
00225 }
00226
00227
if (
Count == 0) {
00228
goto TestFailed;
00229 }
00230
00231 Subtest += 1;
00232
Count = 0;
00233
try {
00234 Fsr.
Data =
AddSingle(
EI |
EO | ROUND_TO_NEAREST,
00235 0x7f000000,
00236 0x7f000000,
00237 &SingleResult);
00238
00239 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
00240
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00241
Count += 1;
00242 }
00243
00244
if (
Count == 0) {
00245
goto TestFailed;
00246 }
00247
00248 Subtest += 1;
00249 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00250 0x3ff,
00251
SIGN | 0x1,
00252 &SingleResult);
00253
00254
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00255 (SingleResult != 0x400)) {
00256
goto TestFailed;
00257 }
00258
00259 Subtest += 1;
00260 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00261 0x1,
00262
SIGN | 0x7fff,
00263 &SingleResult);
00264
00265
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00266 (SingleResult != 0x8000)) {
00267
goto TestFailed;
00268 }
00269
00270 Subtest += 1;
00271 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00272 0x400000,
00273 0x440000,
00274 &SingleResult);
00275
00276
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00277 (SingleResult != (
SIGN | 0x40000))) {
00278
goto TestFailed;
00279 }
00280
00281 Subtest += 1;
00282 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00283
SIGN | 0x400000,
00284
SIGN | 0x440000,
00285 &SingleResult);
00286
00287
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00288 (SingleResult != 0x40000)) {
00289
goto TestFailed;
00290 }
00291
00292 Subtest += 1;
00293 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00294 0x400000,
00295 0x400000,
00296 &SingleResult);
00297
00298
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00299 (SingleResult != 0x0)) {
00300
goto TestFailed;
00301 }
00302
00303 Subtest += 1;
00304 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00305
SIGN | 0x400000,
00306
SIGN | 0x400000,
00307 &SingleResult);
00308
00309
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00310 (SingleResult != (
SIGN | 0x0))) {
00311
goto TestFailed;
00312 }
00313
00314 Subtest += 1;
00315 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00316 0x400000,
00317
SIGN | 0x400000,
00318 &SingleResult);
00319
00320
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00321 (SingleResult != 0x800000)) {
00322
goto TestFailed;
00323 }
00324
00325 Subtest += 1;
00326 Fsr.
Data =
SubtractSingle(ROUND_TO_NEAREST,
00327 0x800000,
00328
SIGN | 0x7fffff,
00329 &SingleResult);
00330
00331
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00332 (SingleResult != 0xffffff)) {
00333
goto TestFailed;
00334 }
00335
00336 Subtest += 1;
00337
Count = 0;
00338
try {
00339 Fsr.
Data =
SubtractSingle(
EI | ROUND_TO_NEAREST,
00340 0x800000,
00341
SIGN | 0x3f800000,
00342 &SingleResult);
00343
00344 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00345
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00346
Count += 1;
00347 }
00348
00349
if (
Count == 0) {
00350
goto TestFailed;
00351 }
00352
00353 Subtest += 1;
00354
Count = 0;
00355
try {
00356 Fsr.
Data =
SubtractSingle(
EO | ROUND_TO_NEAREST,
00357 0x7f000000,
00358
SIGN | 0x7f000000,
00359 &SingleResult);
00360
00361 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
00362
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00363
Count += 1;
00364 }
00365
00366
if (
Count == 0) {
00367
goto TestFailed;
00368 }
00369
00370 Subtest += 1;
00371
Count = 0;
00372
try {
00373 Fsr.
Data =
SubtractSingle(
EI | ROUND_TO_NEAREST,
00374 0x7f000000,
00375
SIGN | 0x7f000000,
00376 &SingleResult);
00377
00378 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00379
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00380
Count += 1;
00381 }
00382
00383
if (
Count == 0) {
00384
goto TestFailed;
00385 }
00386
00387 Subtest += 1;
00388
Count = 0;
00389
try {
00390 Fsr.
Data =
SubtractSingle(
EI |
EO | ROUND_TO_NEAREST,
00391 0x7f000000,
00392
SIGN | 0x7f000000,
00393 &SingleResult);
00394
00395 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
00396
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00397
Count += 1;
00398 }
00399
00400
if (
Count == 0) {
00401
goto TestFailed;
00402 }
00403
00404
00405
00406
00407
00408 printf(
"succeeded\n");
00409
return;
00410
00411
00412
00413
00414
00415 TestFailed:
00416 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
00417 Subtest,
00418 Fsr.
Data,
00419 SingleResult);
00420
00421
return;
00422 }
00423
00424
VOID
00425 Test2 (
00426 VOID
00427 )
00428
00429 {
00430
00431 ULONG
Count;
00432
FLOATING_STATUS Fsr;
00433 ULONG SingleResult;
00434 ULONG Subtest;
00435
00436
00437
00438
00439
00440 Subtest = 0;
00441 printf(
" Test 2 - add single round to nearest ...");
00442 Subtest += 1;
00443 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00444 0x1800000,
00445 0x7ffff8,
00446 &SingleResult);
00447
00448
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00449 (SingleResult != 0x19ffffe)) {
00450
goto TestFailed;
00451 }
00452
00453 Subtest += 1;
00454 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00455 0x1800000,
00456 0x7ffff9,
00457 &SingleResult);
00458
00459
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00460 (SingleResult != 0x19ffffe)) {
00461
goto TestFailed;
00462 }
00463
00464 Subtest += 1;
00465 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00466 0x1800000,
00467 0x7ffffa,
00468 &SingleResult);
00469
00470
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00471 (SingleResult != 0x19ffffe)) {
00472
goto TestFailed;
00473 }
00474
00475 Subtest += 1;
00476 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00477 0x1800000,
00478 0x7ffffb,
00479 &SingleResult);
00480
00481
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00482 (SingleResult != 0x19fffff)) {
00483
goto TestFailed;
00484 }
00485
00486 Subtest += 1;
00487 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00488 0x1800000,
00489 0x7ffffc,
00490 &SingleResult);
00491
00492
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
00493 (SingleResult != 0x19fffff)) {
00494
goto TestFailed;
00495 }
00496
00497 Subtest += 1;
00498 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00499 0x1800000,
00500 0x7ffffd,
00501 &SingleResult);
00502
00503
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00504 (SingleResult != 0x19fffff)) {
00505
goto TestFailed;
00506 }
00507
00508 Subtest += 1;
00509 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00510 0x1800000,
00511 0x7ffffe,
00512 &SingleResult);
00513
00514
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00515 (SingleResult != 0x1a00000)) {
00516
goto TestFailed;
00517 }
00518
00519 Subtest += 1;
00520 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
00521 0x1800000,
00522 0x7fffff,
00523 &SingleResult);
00524
00525
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
00526 (SingleResult != 0x1a00000)) {
00527
goto TestFailed;
00528 }
00529
00530
Count = 0;
00531
try {
00532 Subtest += 1;
00533 Fsr.
Data =
AddSingle(
EI | ROUND_TO_NEAREST,
00534 0x1800000,
00535 0x7fffff,
00536 &SingleResult);
00537
00538 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00539
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00540
Count += 1;
00541 }
00542
00543
if (
Count == 0) {
00544
goto TestFailed;
00545 }
00546
00547
00548
00549
00550
00551 printf(
"succeeded\n");
00552
return;
00553
00554
00555
00556
00557
00558 TestFailed:
00559 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
00560 Subtest,
00561 Fsr.
Data,
00562 SingleResult);
00563
00564
return;
00565 }
00566
00567
VOID
00568 Test3 (
00569 VOID
00570 )
00571
00572 {
00573
00574 ULONG
Count;
00575
FLOATING_STATUS Fsr;
00576 ULONG SingleResult;
00577 ULONG Subtest;
00578
00579
00580
00581
00582
00583 Subtest = 0;
00584 printf(
" Test 3 - add single round to zero ...");
00585 Subtest += 1;
00586 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00587 0x1800000,
00588 0x7ffff8,
00589 &SingleResult);
00590
00591
if ((Fsr.
Data != ROUND_TO_ZERO) ||
00592 (SingleResult != 0x19ffffe)) {
00593
goto TestFailed;
00594 }
00595
00596 Subtest += 1;
00597 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00598 0x1800000,
00599 0x7ffff9,
00600 &SingleResult);
00601
00602
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00603 (SingleResult != 0x19ffffe)) {
00604
goto TestFailed;
00605 }
00606
00607 Subtest += 1;
00608 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00609 0x1800000,
00610 0x7ffffa,
00611 &SingleResult);
00612
00613
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00614 (SingleResult != 0x19ffffe)) {
00615
goto TestFailed;
00616 }
00617
00618 Subtest += 1;
00619 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00620 0x1800000,
00621 0x7ffffb,
00622 &SingleResult);
00623
00624
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00625 (SingleResult != 0x19ffffe)) {
00626
goto TestFailed;
00627 }
00628
00629 Subtest += 1;
00630 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00631 0x1800000,
00632 0x7ffffc,
00633 &SingleResult);
00634
00635
if ((Fsr.
Data != ROUND_TO_ZERO) ||
00636 (SingleResult != 0x19fffff)) {
00637
goto TestFailed;
00638 }
00639
00640 Subtest += 1;
00641 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00642 0x1800000,
00643 0x7ffffd,
00644 &SingleResult);
00645
00646
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00647 (SingleResult != 0x19fffff)) {
00648
goto TestFailed;
00649 }
00650
00651 Subtest += 1;
00652 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00653 0x1800000,
00654 0x7ffffe,
00655 &SingleResult);
00656
00657
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00658 (SingleResult != 0x19fffff)) {
00659
goto TestFailed;
00660 }
00661
00662 Subtest += 1;
00663 Fsr.
Data =
AddSingle(ROUND_TO_ZERO,
00664 0x1800000,
00665 0x7fffff,
00666 &SingleResult);
00667
00668
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
00669 (SingleResult != 0x19fffff)) {
00670
goto TestFailed;
00671 }
00672
00673
Count = 0;
00674
try {
00675 Subtest += 1;
00676 Fsr.
Data =
AddSingle(
EI | ROUND_TO_ZERO,
00677 0x1800000,
00678 0x7fffff,
00679 &SingleResult);
00680
00681 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00682
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00683
Count += 1;
00684 }
00685
00686
if (
Count == 0) {
00687
goto TestFailed;
00688 }
00689
00690
00691
00692
00693
00694 printf(
"succeeded\n");
00695
return;
00696
00697
00698
00699
00700
00701 TestFailed:
00702 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
00703 Subtest,
00704 Fsr.
Data,
00705 SingleResult);
00706
00707
return;
00708 }
00709
00710
VOID
00711 Test4 (
00712 VOID
00713 )
00714
00715 {
00716
00717 ULONG
Count;
00718
FLOATING_STATUS Fsr;
00719 ULONG SingleResult;
00720 ULONG Subtest;
00721
00722
00723
00724
00725
00726 Subtest = 0;
00727 printf(
" Test 4 - add single round to positive infinity ...");
00728 Subtest += 1;
00729 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00730 0x1800000,
00731 0x7ffff8,
00732 &SingleResult);
00733
00734
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
00735 (SingleResult != 0x19ffffe)) {
00736
goto TestFailed;
00737 }
00738
00739 Subtest += 1;
00740 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00741 0x1800000,
00742 0x7ffff9,
00743 &SingleResult);
00744
00745
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00746 (SingleResult != 0x19fffff)) {
00747
goto TestFailed;
00748 }
00749
00750 Subtest += 1;
00751 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00752 0x1800000,
00753 0x7ffffa,
00754 &SingleResult);
00755
00756
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00757 (SingleResult != 0x19fffff)) {
00758
goto TestFailed;
00759 }
00760
00761 Subtest += 1;
00762 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00763 0x1800000,
00764 0x7ffffb,
00765 &SingleResult);
00766
00767
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00768 (SingleResult != 0x19fffff)) {
00769
goto TestFailed;
00770 }
00771
00772 Subtest += 1;
00773 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00774 0x1800000,
00775 0x7ffffc,
00776 &SingleResult);
00777
00778
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
00779 (SingleResult != 0x19fffff)) {
00780
goto TestFailed;
00781 }
00782
00783 Subtest += 1;
00784 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00785 0x1800000,
00786 0x7ffffd,
00787 &SingleResult);
00788
00789
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00790 (SingleResult != 0x1a00000)) {
00791
goto TestFailed;
00792 }
00793
00794 Subtest += 1;
00795 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00796 0x1800000,
00797 0x7ffffe,
00798 &SingleResult);
00799
00800
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00801 (SingleResult != 0x1a00000)) {
00802
goto TestFailed;
00803 }
00804
00805 Subtest += 1;
00806 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00807 0x1800000,
00808 0x7fffff,
00809 &SingleResult);
00810
00811
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00812 (SingleResult != 0x1a00000)) {
00813
goto TestFailed;
00814 }
00815
00816
Count = 0;
00817
try {
00818 Subtest += 1;
00819 Fsr.
Data =
AddSingle(
EI | ROUND_TO_PLUS_INFINITY,
00820 0x1800000,
00821 0x7fffff,
00822 &SingleResult);
00823
00824 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
00825
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
00826
Count += 1;
00827 }
00828
00829
if (
Count == 0) {
00830
goto TestFailed;
00831 }
00832
00833 Subtest += 1;
00834 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00835
SIGN | 0x1800000,
00836
SIGN | 0x7ffff8,
00837 &SingleResult);
00838
00839
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
00840 (SingleResult != (
SIGN | 0x19ffffe))) {
00841
goto TestFailed;
00842 }
00843
00844 Subtest += 1;
00845 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00846
SIGN | 0x1800000,
00847
SIGN | 0x7ffff9,
00848 &SingleResult);
00849
00850
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00851 (SingleResult != (
SIGN | 0x19ffffe))) {
00852
goto TestFailed;
00853 }
00854
00855 Subtest += 1;
00856 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00857
SIGN | 0x1800000,
00858
SIGN | 0x7ffffa,
00859 &SingleResult);
00860
00861
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00862 (SingleResult != (
SIGN | 0x19ffffe))) {
00863
goto TestFailed;
00864 }
00865
00866 Subtest += 1;
00867 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00868
SIGN | 0x1800000,
00869
SIGN | 0x7ffffb,
00870 &SingleResult);
00871
00872
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00873 (SingleResult != (
SIGN | 0x19ffffe))) {
00874
goto TestFailed;
00875 }
00876
00877 Subtest += 1;
00878 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00879
SIGN | 0x1800000,
00880
SIGN | 0x7ffffc,
00881 &SingleResult);
00882
00883
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
00884 (SingleResult != (
SIGN | 0x19fffff))) {
00885
goto TestFailed;
00886 }
00887
00888 Subtest += 1;
00889 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00890
SIGN | 0x1800000,
00891
SIGN | 0x7ffffd,
00892 &SingleResult);
00893
00894
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00895 (SingleResult != (
SIGN | 0x19fffff))) {
00896
goto TestFailed;
00897 }
00898
00899 Subtest += 1;
00900 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00901
SIGN | 0x1800000,
00902
SIGN | 0x7ffffe,
00903 &SingleResult);
00904
00905
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00906 (SingleResult != (
SIGN | 0x19fffff))) {
00907
goto TestFailed;
00908 }
00909
00910 Subtest += 1;
00911 Fsr.
Data =
AddSingle(ROUND_TO_PLUS_INFINITY,
00912
SIGN | 0x1800000,
00913
SIGN | 0x7fffff,
00914 &SingleResult);
00915
00916
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
00917 (SingleResult != (
SIGN | 0x19fffff))) {
00918
goto TestFailed;
00919 }
00920
00921
00922
00923
00924
00925 printf(
"succeeded\n");
00926
return;
00927
00928
00929
00930
00931
00932 TestFailed:
00933 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
00934 Subtest,
00935 Fsr.
Data,
00936 SingleResult);
00937
00938
return;
00939 }
00940
00941
VOID
00942 Test5 (
00943 VOID
00944 )
00945
00946 {
00947
00948 ULONG
Count;
00949
FLOATING_STATUS Fsr;
00950 ULONG SingleResult;
00951 ULONG Subtest;
00952
00953
00954
00955
00956
00957 Subtest = 0;
00958 printf(
" Test 5 - add single round to negative infinity ...");
00959 Subtest += 1;
00960 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
00961
SIGN | 0x1800000,
00962
SIGN | 0x7ffff8,
00963 &SingleResult);
00964
00965
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
00966 (SingleResult != (
SIGN | 0x19ffffe))) {
00967
goto TestFailed;
00968 }
00969
00970 Subtest += 1;
00971 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
00972
SIGN | 0x1800000,
00973
SIGN | 0x7ffff9,
00974 &SingleResult);
00975
00976
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
00977 (SingleResult != (
SIGN | 0x19fffff))) {
00978
goto TestFailed;
00979 }
00980
00981 Subtest += 1;
00982 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
00983
SIGN | 0x1800000,
00984
SIGN | 0x7ffffa,
00985 &SingleResult);
00986
00987
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
00988 (SingleResult != (
SIGN | 0x19fffff))) {
00989
goto TestFailed;
00990 }
00991
00992 Subtest += 1;
00993 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
00994
SIGN | 0x1800000,
00995
SIGN | 0x7ffffb,
00996 &SingleResult);
00997
00998
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
00999 (SingleResult != (
SIGN | 0x19fffff))) {
01000
goto TestFailed;
01001 }
01002
01003 Subtest += 1;
01004 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01005
SIGN | 0x1800000,
01006
SIGN | 0x7ffffc,
01007 &SingleResult);
01008
01009
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
01010 (SingleResult != (
SIGN | 0x19fffff))) {
01011
goto TestFailed;
01012 }
01013
01014 Subtest += 1;
01015 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01016
SIGN | 0x1800000,
01017
SIGN | 0x7ffffd,
01018 &SingleResult);
01019
01020
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01021 (SingleResult != (
SIGN | 0x1a00000))) {
01022
goto TestFailed;
01023 }
01024
01025 Subtest += 1;
01026 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01027
SIGN | 0x1800000,
01028
SIGN | 0x7ffffe,
01029 &SingleResult);
01030
01031
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01032 (SingleResult != (
SIGN | 0x1a00000))) {
01033
goto TestFailed;
01034 }
01035
01036 Subtest += 1;
01037 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01038
SIGN | 0x1800000,
01039
SIGN | 0x7fffff,
01040 &SingleResult);
01041
01042
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01043 (SingleResult != (
SIGN | 0x1a00000))) {
01044
goto TestFailed;
01045 }
01046
01047
Count = 0;
01048
try {
01049 Subtest += 1;
01050 Fsr.
Data =
AddSingle(
EI | ROUND_TO_MINUS_INFINITY,
01051 0x1800000,
01052 0x7fffff,
01053 &SingleResult);
01054
01055 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
01056
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01057
Count += 1;
01058 }
01059
01060
if (
Count == 0) {
01061
goto TestFailed;
01062 }
01063
01064 Subtest += 1;
01065 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01066 0x1800000,
01067 0x7ffff8,
01068 &SingleResult);
01069
01070
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
01071 (SingleResult != 0x19ffffe)) {
01072
goto TestFailed;
01073 }
01074
01075 Subtest += 1;
01076 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01077 0x1800000,
01078 0x7ffff9,
01079 &SingleResult);
01080
01081
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01082 (SingleResult != 0x19ffffe)) {
01083
goto TestFailed;
01084 }
01085
01086 Subtest += 1;
01087 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01088 0x1800000,
01089 0x7ffffa,
01090 &SingleResult);
01091
01092
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01093 (SingleResult != 0x19ffffe)) {
01094
goto TestFailed;
01095 }
01096
01097 Subtest += 1;
01098 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01099 0x1800000,
01100 0x7ffffb,
01101 &SingleResult);
01102
01103
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01104 (SingleResult != 0x19ffffe)) {
01105
goto TestFailed;
01106 }
01107
01108 Subtest += 1;
01109 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01110 0x1800000,
01111 0x7ffffc,
01112 &SingleResult);
01113
01114
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
01115 (SingleResult != 0x19fffff)) {
01116
goto TestFailed;
01117 }
01118
01119 Subtest += 1;
01120 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01121 0x1800000,
01122 0x7ffffd,
01123 &SingleResult);
01124
01125
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01126 (SingleResult != 0x19fffff)) {
01127
goto TestFailed;
01128 }
01129
01130 Subtest += 1;
01131 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01132 0x1800000,
01133 0x7ffffe,
01134 &SingleResult);
01135
01136
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01137 (SingleResult != 0x19fffff)) {
01138
goto TestFailed;
01139 }
01140
01141 Subtest += 1;
01142 Fsr.
Data =
AddSingle(ROUND_TO_MINUS_INFINITY,
01143 0x1800000,
01144 0x7fffff,
01145 &SingleResult);
01146
01147
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
01148 (SingleResult != 0x19fffff)) {
01149
goto TestFailed;
01150 }
01151
01152
01153
01154
01155
01156 printf(
"succeeded\n");
01157
return;
01158
01159
01160
01161
01162
01163 TestFailed:
01164 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
01165 Subtest,
01166 Fsr.
Data,
01167 SingleResult);
01168
01169
return;
01170 }
01171
01172
VOID
01173 Test6 (
01174 VOID
01175 )
01176
01177 {
01178
01179 ULONG
Count;
01180
FLOATING_STATUS Fsr;
01181 ULONG SingleResult;
01182 ULONG Subtest;
01183
01184
01185
01186
01187
01188 Subtest = 0;
01189 printf(
" Test 6 - add single infinity and NaN ...");
01190
01191 Subtest += 1;
01192 Fsr.
Data =
AddSingle(
FS | ROUND_TO_NEAREST,
01193 0x200000,
01194 0x200000,
01195 &SingleResult);
01196
01197
if ((Fsr.
Data != (
FS | ROUND_TO_NEAREST)) ||
01198 (SingleResult != 0x0)) {
01199
goto TestFailed;
01200 }
01201
01202 Subtest += 1;
01203 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01204 0x400000,
01205
SINGLE_SIGNAL_NAN_PREFIX,
01206 &SingleResult);
01207
01208
if ((Fsr.
Data != (
SV | ROUND_TO_NEAREST)) ||
01209 (SingleResult != SINGLE_QUIET_NAN)) {
01210
goto TestFailed;
01211 }
01212
01213 Subtest += 1;
01214 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01215
SINGLE_SIGNAL_NAN_PREFIX,
01216 0x400000,
01217 &SingleResult);
01218
01219
if ((Fsr.
Data != (
SV | ROUND_TO_NEAREST)) ||
01220 (SingleResult != SINGLE_QUIET_NAN)) {
01221
goto TestFailed;
01222 }
01223
01224 Subtest += 1;
01225 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01226 0x400000,
01227 SINGLE_INFINITY_VALUE,
01228 &SingleResult);
01229
01230
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01231 (SingleResult != SINGLE_INFINITY_VALUE)) {
01232
goto TestFailed;
01233 }
01234
01235 Subtest += 1;
01236 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01237
SIGN | 0x400000,
01238 SINGLE_INFINITY_VALUE,
01239 &SingleResult);
01240
01241
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01242 (SingleResult != SINGLE_INFINITY_VALUE)) {
01243
goto TestFailed;
01244 }
01245
01246 Subtest += 1;
01247 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01248 0x400000,
01249
MINUS_SINGLE_INFINITY_VALUE,
01250 &SingleResult);
01251
01252
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01253 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01254
goto TestFailed;
01255 }
01256
01257 Subtest += 1;
01258 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01259
SIGN | 0x400000,
01260
MINUS_SINGLE_INFINITY_VALUE,
01261 &SingleResult);
01262
01263
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01264 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01265
goto TestFailed;
01266 }
01267
01268 Subtest += 1;
01269 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01270 SINGLE_INFINITY_VALUE,
01271 SINGLE_INFINITY_VALUE,
01272 &SingleResult);
01273
01274
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01275 (SingleResult != SINGLE_INFINITY_VALUE)) {
01276
goto TestFailed;
01277 }
01278
01279 Subtest += 1;
01280 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01281 SINGLE_INFINITY_VALUE,
01282 0x3f800000,
01283 &SingleResult);
01284
01285
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01286 (SingleResult != SINGLE_INFINITY_VALUE)) {
01287
goto TestFailed;
01288 }
01289
01290 Subtest += 1;
01291 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01292 0x3f800000,
01293 SINGLE_INFINITY_VALUE,
01294 &SingleResult);
01295
01296
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01297 (SingleResult != SINGLE_INFINITY_VALUE)) {
01298
goto TestFailed;
01299 }
01300
01301 Subtest += 1;
01302 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01303
MINUS_SINGLE_INFINITY_VALUE,
01304
MINUS_SINGLE_INFINITY_VALUE,
01305 &SingleResult);
01306
01307
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01308 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01309
goto TestFailed;
01310 }
01311
01312 Subtest += 1;
01313 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01314
MINUS_SINGLE_INFINITY_VALUE,
01315 0x3f800000,
01316 &SingleResult);
01317
01318
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01319 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01320
goto TestFailed;
01321 }
01322
01323 Subtest += 1;
01324 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01325 0x3f800000,
01326
MINUS_SINGLE_INFINITY_VALUE,
01327 &SingleResult);
01328
01329
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01330 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01331
goto TestFailed;
01332 }
01333
01334 Subtest += 1;
01335 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01336 SINGLE_INFINITY_VALUE,
01337
MINUS_SINGLE_INFINITY_VALUE,
01338 &SingleResult);
01339
01340
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01341 (SingleResult != SINGLE_QUIET_NAN)) {
01342
goto TestFailed;
01343 }
01344
01345 Subtest += 1;
01346 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01347
MINUS_SINGLE_INFINITY_VALUE,
01348 SINGLE_INFINITY_VALUE,
01349 &SingleResult);
01350
01351
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01352 (SingleResult != SINGLE_QUIET_NAN)) {
01353
goto TestFailed;
01354 }
01355
01356 Subtest += 1;
01357 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01358 SINGLE_QUIET_NAN,
01359 SINGLE_QUIET_NAN,
01360 &SingleResult);
01361
01362
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01363 (SingleResult != SINGLE_QUIET_NAN)) {
01364
goto TestFailed;
01365 }
01366
01367 Subtest += 1;
01368 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01369 SINGLE_QUIET_NAN,
01370 0x3f800000,
01371 &SingleResult);
01372
01373
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01374 (SingleResult != SINGLE_QUIET_NAN)) {
01375
goto TestFailed;
01376 }
01377
01378 Subtest += 1;
01379 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01380 0x3f800000,
01381 SINGLE_QUIET_NAN,
01382 &SingleResult);
01383
01384
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01385 (SingleResult != SINGLE_QUIET_NAN)) {
01386
goto TestFailed;
01387 }
01388
01389 Subtest += 1;
01390 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01391 SINGLE_SIGNAL_NAN,
01392 SINGLE_SIGNAL_NAN,
01393 &SingleResult);
01394
01395
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01396 (SingleResult != SINGLE_QUIET_NAN)) {
01397
goto TestFailed;
01398 }
01399
01400 Subtest += 1;
01401 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01402 SINGLE_SIGNAL_NAN,
01403 0x3f800000,
01404 &SingleResult);
01405
01406
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01407 (SingleResult != SINGLE_QUIET_NAN)) {
01408
goto TestFailed;
01409 }
01410
01411 Subtest += 1;
01412 Fsr.
Data =
AddSingle(ROUND_TO_NEAREST,
01413 0x3f800000,
01414 SINGLE_SIGNAL_NAN,
01415 &SingleResult);
01416
01417
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01418 (SingleResult != SINGLE_QUIET_NAN)) {
01419
goto TestFailed;
01420 }
01421
01422 Subtest += 1;
01423
try {
01424 Fsr.
Data =
AddSingle(
EV | ROUND_TO_NEAREST,
01425 SINGLE_QUIET_NAN,
01426 SINGLE_QUIET_NAN,
01427 &SingleResult);
01428
01429 } except (
EXCEPTION_EXECUTE_HANDLER) {
01430
goto TestFailed;
01431 }
01432
01433
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
01434 (SingleResult != SINGLE_QUIET_NAN)) {
01435
goto TestFailed;
01436 }
01437
01438 Subtest += 1;
01439
Count = 0;
01440
try {
01441 Fsr.
Data =
AddSingle(
EV | ROUND_TO_NEAREST,
01442 SINGLE_QUIET_NAN,
01443 SINGLE_SIGNAL_NAN,
01444 &SingleResult);
01445
01446 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01447
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01448
Count += 1;
01449 }
01450
01451
if (
Count != 1) {
01452
goto TestFailed;
01453 }
01454
01455 Subtest += 1;
01456
Count = 0;
01457
try {
01458 Fsr.
Data =
AddSingle(
EV | ROUND_TO_NEAREST,
01459 SINGLE_SIGNAL_NAN,
01460 SINGLE_QUIET_NAN,
01461 &SingleResult);
01462
01463 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01464
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01465
Count += 1;
01466 }
01467
01468
if (
Count != 1) {
01469
goto TestFailed;
01470 }
01471
01472 Subtest += 1;
01473
Count = 0;
01474
try {
01475 Fsr.
Data =
AddSingle(
EV | ROUND_TO_NEAREST,
01476 SINGLE_INFINITY_VALUE,
01477
MINUS_SINGLE_INFINITY_VALUE,
01478 &SingleResult);
01479
01480 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01481
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01482
Count += 1;
01483 }
01484
01485
if (
Count != 1) {
01486
goto TestFailed;
01487 }
01488
01489
01490
01491
01492
01493 printf(
"succeeded\n");
01494
return;
01495
01496
01497
01498
01499
01500 TestFailed:
01501 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
01502 Subtest,
01503 Fsr.
Data,
01504 SingleResult);
01505
01506
return;
01507 }
01508
01509
VOID
01510 Test7 (
01511 VOID
01512 )
01513
01514 {
01515
01516 ULONG
Count;
01517
FLOATING_STATUS Fsr;
01518 ULONG SingleResult;
01519 ULONG Subtest;
01520
01521
01522
01523
01524
01525 Subtest = 0;
01526 printf(
" Test 7 - multiply single ...");
01527 Subtest += 1;
01528 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01529 SINGLE_INFINITY_VALUE,
01530 SINGLE_INFINITY_VALUE,
01531 &SingleResult);
01532
01533
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01534 (SingleResult != SINGLE_INFINITY_VALUE)) {
01535
goto TestFailed;
01536 }
01537
01538 Subtest += 1;
01539 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01540 SINGLE_INFINITY_VALUE,
01541
MINUS_SINGLE_INFINITY_VALUE,
01542 &SingleResult);
01543
01544
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01545 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01546
goto TestFailed;
01547 }
01548
01549 Subtest += 1;
01550 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01551
MINUS_SINGLE_INFINITY_VALUE,
01552
MINUS_SINGLE_INFINITY_VALUE,
01553 &SingleResult);
01554
01555
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01556 (SingleResult != SINGLE_INFINITY_VALUE)) {
01557
goto TestFailed;
01558 }
01559
01560 Subtest += 1;
01561 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01562
MINUS_SINGLE_INFINITY_VALUE,
01563 SINGLE_INFINITY_VALUE,
01564 &SingleResult);
01565
01566
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01567 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
01568
goto TestFailed;
01569 }
01570
01571 Subtest += 1;
01572 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01573 SINGLE_INFINITY_VALUE,
01574 0x0,
01575 &SingleResult);
01576
01577
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01578 (SingleResult != SINGLE_QUIET_NAN)) {
01579
goto TestFailed;
01580 }
01581
01582 Subtest += 1;
01583 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01584 0x0,
01585 SINGLE_INFINITY_VALUE,
01586 &SingleResult);
01587
01588
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01589 (SingleResult != SINGLE_QUIET_NAN)) {
01590
goto TestFailed;
01591 }
01592
01593 Subtest += 1;
01594 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01595
MINUS_SINGLE_INFINITY_VALUE,
01596 0x0,
01597 &SingleResult);
01598
01599
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01600 (SingleResult != SINGLE_QUIET_NAN)) {
01601
goto TestFailed;
01602 }
01603
01604 Subtest += 1;
01605 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01606 0x0,
01607
MINUS_SINGLE_INFINITY_VALUE,
01608 &SingleResult);
01609
01610
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01611 (SingleResult != SINGLE_QUIET_NAN)) {
01612
goto TestFailed;
01613 }
01614
01615 Subtest += 1;
01616
Count = 0;
01617
try {
01618 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01619 SINGLE_INFINITY_VALUE,
01620 0x0,
01621 &SingleResult);
01622
01623 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01624
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01625
Count += 1;
01626 }
01627
01628
if (
Count == 0) {
01629
goto TestFailed;
01630 }
01631
01632 Subtest += 1;
01633
Count = 0;
01634
try {
01635 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01636 0x0,
01637 SINGLE_INFINITY_VALUE,
01638 &SingleResult);
01639
01640 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01641
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01642
Count += 1;
01643 }
01644
01645
if (
Count == 0) {
01646
goto TestFailed;
01647 }
01648
01649 Subtest += 1;
01650
Count = 0;
01651
try {
01652 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01653
MINUS_SINGLE_INFINITY_VALUE,
01654 0x0,
01655 &SingleResult);
01656
01657 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01658
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01659
Count += 1;
01660 }
01661
01662
if (
Count == 0) {
01663
goto TestFailed;
01664 }
01665
01666 Subtest += 1;
01667
Count = 0;
01668
try {
01669 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01670 0x0,
01671
MINUS_SINGLE_INFINITY_VALUE,
01672 &SingleResult);
01673
01674 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01675
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01676
Count += 1;
01677 }
01678
01679
if (
Count == 0) {
01680
goto TestFailed;
01681 }
01682
01683 Subtest += 1;
01684 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01685 SINGLE_QUIET_NAN,
01686 SINGLE_QUIET_NAN,
01687 &SingleResult);
01688
01689
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01690 (SingleResult != SINGLE_QUIET_NAN)) {
01691
goto TestFailed;
01692 }
01693
01694 Subtest += 1;
01695 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01696 SINGLE_QUIET_NAN,
01697 0x3f800000,
01698 &SingleResult);
01699
01700
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01701 (SingleResult != SINGLE_QUIET_NAN)) {
01702
goto TestFailed;
01703 }
01704
01705 Subtest += 1;
01706 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01707 0x3f800000,
01708 SINGLE_QUIET_NAN,
01709 &SingleResult);
01710
01711
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
01712 (SingleResult != SINGLE_QUIET_NAN)) {
01713
goto TestFailed;
01714 }
01715
01716 Subtest += 1;
01717 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01718 SINGLE_SIGNAL_NAN,
01719 SINGLE_SIGNAL_NAN,
01720 &SingleResult);
01721
01722
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01723 (SingleResult != SINGLE_QUIET_NAN)) {
01724
goto TestFailed;
01725 }
01726
01727 Subtest += 1;
01728 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01729 SINGLE_SIGNAL_NAN,
01730 0x3f800000,
01731 &SingleResult);
01732
01733
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01734 (SingleResult != SINGLE_QUIET_NAN)) {
01735
goto TestFailed;
01736 }
01737
01738 Subtest += 1;
01739 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01740 0x3f800000,
01741 SINGLE_SIGNAL_NAN,
01742 &SingleResult);
01743
01744
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
01745 (SingleResult != SINGLE_QUIET_NAN)) {
01746
goto TestFailed;
01747 }
01748
01749 Subtest += 1;
01750
try {
01751 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01752 SINGLE_QUIET_NAN,
01753 SINGLE_QUIET_NAN,
01754 &SingleResult);
01755
01756 } except (
EXCEPTION_EXECUTE_HANDLER) {
01757
goto TestFailed;
01758 }
01759
01760
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
01761 (SingleResult != SINGLE_QUIET_NAN)) {
01762
goto TestFailed;
01763 }
01764
01765 Subtest += 1;
01766
Count = 0;
01767
try {
01768 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01769 SINGLE_QUIET_NAN,
01770 SINGLE_SIGNAL_NAN,
01771 &SingleResult);
01772
01773 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01774
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01775
Count += 1;
01776 }
01777
01778
if (
Count != 1) {
01779
goto TestFailed;
01780 }
01781
01782 Subtest += 1;
01783
Count = 0;
01784
try {
01785 Fsr.
Data =
MultiplySingle(
EV | ROUND_TO_NEAREST,
01786 SINGLE_SIGNAL_NAN,
01787 SINGLE_QUIET_NAN,
01788 &SingleResult);
01789
01790 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
01791
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01792
Count += 1;
01793 }
01794
01795
if (
Count != 1) {
01796
goto TestFailed;
01797 }
01798
01799 Subtest += 1;
01800 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01801 0x7f000000,
01802 0x400000,
01803 &SingleResult);
01804
01805
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01806 (SingleResult != 0x3f800000)) {
01807
goto TestFailed;
01808 }
01809
01810 Subtest += 1;
01811 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01812 0x400000,
01813 0x7f000000,
01814 &SingleResult);
01815
01816
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01817 (SingleResult != 0x3f800000)) {
01818
goto TestFailed;
01819 }
01820
01821 Subtest += 1;
01822 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01823 0x7f000000,
01824
SIGN | 0x400000,
01825 &SingleResult);
01826
01827
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01828 (SingleResult != (
SIGN | 0x3f800000))) {
01829
goto TestFailed;
01830 }
01831
01832 Subtest += 1;
01833 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01834 0x400000,
01835
SIGN | 0x7f000000,
01836 &SingleResult);
01837
01838
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
01839 (SingleResult != (
SIGN | 0x3f800000))) {
01840
goto TestFailed;
01841 }
01842
01843 Subtest += 1;
01844 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01845 0x400004,
01846 0x7f000001,
01847 &SingleResult);
01848
01849
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
01850 (SingleResult != 0x3f800009)) {
01851
goto TestFailed;
01852 }
01853
01854 Subtest += 1;
01855 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01856 0x400004,
01857
SIGN | 0x7f000001,
01858 &SingleResult);
01859
01860
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
01861 (SingleResult != (
SIGN | 0x3f800009))) {
01862
goto TestFailed;
01863 }
01864
01865 Subtest += 1;
01866
Count = 0;
01867
try {
01868 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
01869 0x400004,
01870 0x7f000001,
01871 &SingleResult);
01872
01873 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
01874
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01875
Count += 1;
01876 }
01877
01878
if (
Count != 1) {
01879
goto TestFailed;
01880 }
01881
01882 Subtest += 1;
01883
Count = 0;
01884
try {
01885 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
01886 0x400004,
01887
SIGN | 0x7f000001,
01888 &SingleResult);
01889
01890 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
01891
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01892
Count += 1;
01893 }
01894
01895
if (
Count != 1) {
01896
goto TestFailed;
01897 }
01898
01899 Subtest += 1;
01900 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01901 0x400000,
01902 0x400000,
01903 &SingleResult);
01904
01905
if ((Fsr.
Data != (
SU |
SI | ROUND_TO_NEAREST)) ||
01906 (SingleResult != 0x0)) {
01907
goto TestFailed;
01908 }
01909
01910 Subtest += 1;
01911 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
01912 0x400000,
01913
SIGN | 0x400000,
01914 &SingleResult);
01915
01916
if ((Fsr.
Data != (
SU |
SI | ROUND_TO_NEAREST)) ||
01917 (SingleResult != (
SIGN | 0x0))) {
01918
goto TestFailed;
01919 }
01920
01921 Subtest += 1;
01922
Count = 0;
01923
try {
01924 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
01925 0x400000,
01926 0x400000,
01927 &SingleResult);
01928
01929 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
01930
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01931
Count += 1;
01932 }
01933
01934
if (
Count != 1) {
01935
goto TestFailed;
01936 }
01937
01938 Subtest += 1;
01939
Count = 0;
01940
try {
01941 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
01942 0x400000,
01943
SIGN | 0x400000,
01944 &SingleResult);
01945
01946 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
01947
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01948
Count += 1;
01949 }
01950
01951
if (
Count != 1) {
01952
goto TestFailed;
01953 }
01954
01955 Subtest += 1;
01956
Count = 0;
01957
try {
01958 Fsr.
Data =
MultiplySingle(
EU | ROUND_TO_NEAREST,
01959 0x400000,
01960 0x400000,
01961 &SingleResult);
01962
01963 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
01964
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01965
Count += 1;
01966 }
01967
01968
if (
Count != 1) {
01969
goto TestFailed;
01970 }
01971
01972 Subtest += 1;
01973
Count = 0;
01974
try {
01975 Fsr.
Data =
MultiplySingle(
EU | ROUND_TO_NEAREST,
01976 0x400000,
01977
SIGN | 0x400000,
01978 &SingleResult);
01979
01980 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
01981
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01982
Count += 1;
01983 }
01984
01985
if (
Count != 1) {
01986
goto TestFailed;
01987 }
01988
01989 Subtest += 1;
01990
Count = 0;
01991
try {
01992 Fsr.
Data =
MultiplySingle(
EU |
EI | ROUND_TO_NEAREST,
01993 0x400000,
01994 0x400000,
01995 &SingleResult);
01996
01997 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
01998
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
01999
Count += 1;
02000 }
02001
02002
if (
Count != 1) {
02003
goto TestFailed;
02004 }
02005
02006 Subtest += 1;
02007
Count = 0;
02008
try {
02009 Fsr.
Data =
MultiplySingle(
EU |
EI | ROUND_TO_NEAREST,
02010 0x400000,
02011
SIGN | 0x400000,
02012 &SingleResult);
02013
02014 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
02015
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02016
Count += 1;
02017 }
02018
02019
if (
Count != 1) {
02020
goto TestFailed;
02021 }
02022
02023 Subtest += 1;
02024 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
02025 SINGLE_MAXIMUM_VALUE,
02026 SINGLE_MAXIMUM_VALUE,
02027 &SingleResult);
02028
02029
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
02030 (SingleResult != SINGLE_INFINITY_VALUE)) {
02031
goto TestFailed;
02032 }
02033
02034 Subtest += 1;
02035 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
02036
SIGN | SINGLE_MAXIMUM_VALUE,
02037 SINGLE_MAXIMUM_VALUE,
02038 &SingleResult);
02039
02040
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
02041 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02042
goto TestFailed;
02043 }
02044
02045 Subtest += 1;
02046 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
02047 SINGLE_MAXIMUM_VALUE,
02048
SIGN | SINGLE_MAXIMUM_VALUE,
02049 &SingleResult);
02050
02051
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
02052 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02053
goto TestFailed;
02054 }
02055
02056 Subtest += 1;
02057 Fsr.
Data =
MultiplySingle(ROUND_TO_NEAREST,
02058
SIGN | SINGLE_MAXIMUM_VALUE,
02059
SIGN | SINGLE_MAXIMUM_VALUE,
02060 &SingleResult);
02061
02062
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
02063 (SingleResult != SINGLE_INFINITY_VALUE)) {
02064
goto TestFailed;
02065 }
02066
02067 Subtest += 1;
02068 Fsr.
Data =
MultiplySingle(ROUND_TO_ZERO,
02069 SINGLE_MAXIMUM_VALUE,
02070 SINGLE_MAXIMUM_VALUE,
02071 &SingleResult);
02072
02073
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
02074 (SingleResult != SINGLE_MAXIMUM_VALUE)) {
02075
goto TestFailed;
02076 }
02077
02078 Subtest += 1;
02079 Fsr.
Data =
MultiplySingle(ROUND_TO_ZERO,
02080
SIGN | SINGLE_MAXIMUM_VALUE,
02081 SINGLE_MAXIMUM_VALUE,
02082 &SingleResult);
02083
02084
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
02085 (SingleResult != (
SIGN | SINGLE_MAXIMUM_VALUE))) {
02086
goto TestFailed;
02087 }
02088
02089 Subtest += 1;
02090 Fsr.
Data =
MultiplySingle(ROUND_TO_ZERO,
02091 SINGLE_MAXIMUM_VALUE,
02092
SIGN | SINGLE_MAXIMUM_VALUE,
02093 &SingleResult);
02094
02095
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
02096 (SingleResult != (
SIGN | SINGLE_MAXIMUM_VALUE))) {
02097
goto TestFailed;
02098 }
02099
02100 Subtest += 1;
02101 Fsr.
Data =
MultiplySingle(ROUND_TO_ZERO,
02102
SIGN | SINGLE_MAXIMUM_VALUE,
02103
SIGN | SINGLE_MAXIMUM_VALUE,
02104 &SingleResult);
02105
02106
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
02107 (SingleResult != SINGLE_MAXIMUM_VALUE)) {
02108
goto TestFailed;
02109 }
02110
02111 Subtest += 1;
02112 Fsr.
Data =
MultiplySingle(ROUND_TO_PLUS_INFINITY,
02113 SINGLE_MAXIMUM_VALUE,
02114 SINGLE_MAXIMUM_VALUE,
02115 &SingleResult);
02116
02117
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
02118 (SingleResult != SINGLE_INFINITY_VALUE)) {
02119
goto TestFailed;
02120 }
02121
02122 Subtest += 1;
02123 Fsr.
Data =
MultiplySingle(ROUND_TO_PLUS_INFINITY,
02124
SIGN | SINGLE_MAXIMUM_VALUE,
02125 SINGLE_MAXIMUM_VALUE,
02126 &SingleResult);
02127
02128
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
02129 (SingleResult != (
SIGN | SINGLE_MAXIMUM_VALUE))) {
02130
goto TestFailed;
02131 }
02132
02133 Subtest += 1;
02134 Fsr.
Data =
MultiplySingle(ROUND_TO_PLUS_INFINITY,
02135 SINGLE_MAXIMUM_VALUE,
02136
SIGN | SINGLE_MAXIMUM_VALUE,
02137 &SingleResult);
02138
02139
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
02140 (SingleResult != (
SIGN | SINGLE_MAXIMUM_VALUE))) {
02141
goto TestFailed;
02142 }
02143
02144 Subtest += 1;
02145 Fsr.
Data =
MultiplySingle(ROUND_TO_PLUS_INFINITY,
02146
SIGN | SINGLE_MAXIMUM_VALUE,
02147
SIGN | SINGLE_MAXIMUM_VALUE,
02148 &SingleResult);
02149
02150
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
02151 (SingleResult != SINGLE_INFINITY_VALUE)) {
02152
goto TestFailed;
02153 }
02154
02155 Subtest += 1;
02156 Fsr.
Data =
MultiplySingle(ROUND_TO_MINUS_INFINITY,
02157 SINGLE_MAXIMUM_VALUE,
02158 SINGLE_MAXIMUM_VALUE,
02159 &SingleResult);
02160
02161
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
02162 (SingleResult != SINGLE_MAXIMUM_VALUE)) {
02163
goto TestFailed;
02164 }
02165
02166 Subtest += 1;
02167 Fsr.
Data =
MultiplySingle(ROUND_TO_MINUS_INFINITY,
02168
SIGN | SINGLE_MAXIMUM_VALUE,
02169 SINGLE_MAXIMUM_VALUE,
02170 &SingleResult);
02171
02172
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
02173 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02174
goto TestFailed;
02175 }
02176
02177 Subtest += 1;
02178 Fsr.
Data =
MultiplySingle(ROUND_TO_MINUS_INFINITY,
02179 SINGLE_MAXIMUM_VALUE,
02180
SIGN | SINGLE_MAXIMUM_VALUE,
02181 &SingleResult);
02182
02183
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
02184 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02185
goto TestFailed;
02186 }
02187
02188 Subtest += 1;
02189 Fsr.
Data =
MultiplySingle(ROUND_TO_MINUS_INFINITY,
02190
SIGN | SINGLE_MAXIMUM_VALUE,
02191
SIGN | SINGLE_MAXIMUM_VALUE,
02192 &SingleResult);
02193
02194
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
02195 (SingleResult != SINGLE_MAXIMUM_VALUE)) {
02196
goto TestFailed;
02197 }
02198
02199 Subtest += 1;
02200
Count = 0;
02201
try {
02202 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
02203 SINGLE_MAXIMUM_VALUE,
02204 SINGLE_MAXIMUM_VALUE,
02205 &SingleResult);
02206
02207 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
02208
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02209
Count += 1;
02210 }
02211
02212
if (
Count != 1) {
02213
goto TestFailed;
02214 }
02215
02216 Subtest += 1;
02217
Count = 0;
02218
try {
02219 Fsr.
Data =
MultiplySingle(
EI | ROUND_TO_NEAREST,
02220 SINGLE_MAXIMUM_VALUE,
02221
SIGN | SINGLE_MAXIMUM_VALUE,
02222 &SingleResult);
02223
02224 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
02225
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02226
Count += 1;
02227 }
02228
02229
if (
Count != 1) {
02230
goto TestFailed;
02231 }
02232
02233 Subtest += 1;
02234
Count = 0;
02235
try {
02236 Fsr.
Data =
MultiplySingle(
EO | ROUND_TO_NEAREST,
02237 SINGLE_MAXIMUM_VALUE,
02238 SINGLE_MAXIMUM_VALUE,
02239 &SingleResult);
02240
02241 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
02242
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02243
Count += 1;
02244 }
02245
02246
if (
Count != 1) {
02247
goto TestFailed;
02248 }
02249
02250 Subtest += 1;
02251
Count = 0;
02252
try {
02253 Fsr.
Data =
MultiplySingle(
EO | ROUND_TO_NEAREST,
02254 SINGLE_MAXIMUM_VALUE,
02255
SIGN | SINGLE_MAXIMUM_VALUE,
02256 &SingleResult);
02257
02258 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
02259
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02260
Count += 1;
02261 }
02262
02263
if (
Count != 1) {
02264
goto TestFailed;
02265 }
02266
02267 Subtest += 1;
02268
Count = 0;
02269
try {
02270 Fsr.
Data =
MultiplySingle(
EO |
EI | ROUND_TO_NEAREST,
02271 SINGLE_MAXIMUM_VALUE,
02272 SINGLE_MAXIMUM_VALUE,
02273 &SingleResult);
02274
02275 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
02276
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02277
Count += 1;
02278 }
02279
02280
if (
Count != 1) {
02281
goto TestFailed;
02282 }
02283
02284 Subtest += 1;
02285
Count = 0;
02286
try {
02287 Fsr.
Data =
MultiplySingle(
EO |
EI | ROUND_TO_NEAREST,
02288 SINGLE_MAXIMUM_VALUE,
02289
SIGN | SINGLE_MAXIMUM_VALUE,
02290 &SingleResult);
02291
02292 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
02293
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02294
Count += 1;
02295 }
02296
02297
if (
Count != 1) {
02298
goto TestFailed;
02299 }
02300
02301
02302
02303
02304
02305 printf(
"succeeded\n");
02306
return;
02307
02308
02309
02310
02311
02312 TestFailed:
02313 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
02314 Subtest,
02315 Fsr.
Data,
02316 SingleResult);
02317
02318
return;
02319 }
02320
02321
VOID
02322 Test8 (
02323 VOID
02324 )
02325
02326 {
02327
02328 ULONG
Count;
02329
FLOATING_STATUS Fsr;
02330 ULONG SingleResult;
02331 ULONG Subtest;
02332
02333
02334
02335
02336
02337 Subtest = 0;
02338 printf(
" Test 8 - divide single ...");
02339 Subtest += 1;
02340 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02341 SINGLE_INFINITY_VALUE,
02342 SINGLE_INFINITY_VALUE,
02343 &SingleResult);
02344
02345
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02346 (SingleResult != SINGLE_QUIET_NAN)) {
02347
goto TestFailed;
02348 }
02349
02350 Subtest += 1;
02351 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02352 SINGLE_INFINITY_VALUE,
02353
MINUS_SINGLE_INFINITY_VALUE,
02354 &SingleResult);
02355
02356
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02357 (SingleResult != SINGLE_QUIET_NAN)) {
02358
goto TestFailed;
02359 }
02360
02361 Subtest += 1;
02362 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02363
MINUS_SINGLE_INFINITY_VALUE,
02364
MINUS_SINGLE_INFINITY_VALUE,
02365 &SingleResult);
02366
02367
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02368 (SingleResult != SINGLE_QUIET_NAN)) {
02369
goto TestFailed;
02370 }
02371
02372 Subtest += 1;
02373 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02374
MINUS_SINGLE_INFINITY_VALUE,
02375 SINGLE_INFINITY_VALUE,
02376 &SingleResult);
02377
02378
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02379 (SingleResult != SINGLE_QUIET_NAN)) {
02380
goto TestFailed;
02381 }
02382
02383 Subtest += 1;
02384 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02385 0x0,
02386 0x0,
02387 &SingleResult);
02388
02389
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02390 (SingleResult != SINGLE_QUIET_NAN)) {
02391
goto TestFailed;
02392 }
02393
02394 Subtest += 1;
02395 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02396 0x0,
02397
SIGN | 0x0,
02398 &SingleResult);
02399
02400
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02401 (SingleResult != SINGLE_QUIET_NAN)) {
02402
goto TestFailed;
02403 }
02404
02405 Subtest += 1;
02406 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02407
SIGN | 0x0,
02408
SIGN | 0x0,
02409 &SingleResult);
02410
02411
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02412 (SingleResult != SINGLE_QUIET_NAN)) {
02413
goto TestFailed;
02414 }
02415
02416 Subtest += 1;
02417 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02418
SIGN | 0x0,
02419 0x0,
02420 &SingleResult);
02421
02422
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02423 (SingleResult != SINGLE_QUIET_NAN)) {
02424
goto TestFailed;
02425 }
02426
02427 Subtest += 1;
02428 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02429 SINGLE_INFINITY_VALUE,
02430 0x0,
02431 &SingleResult);
02432
02433
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02434 (SingleResult != SINGLE_INFINITY_VALUE)) {
02435
goto TestFailed;
02436 }
02437
02438 Subtest += 1;
02439 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02440 0x3f800000,
02441 0x0,
02442 &SingleResult);
02443
02444
if ((Fsr.
Data != (
SZ |
XZ | ROUND_TO_NEAREST)) ||
02445 (SingleResult != SINGLE_INFINITY_VALUE)) {
02446
goto TestFailed;
02447 }
02448
02449
02450 Subtest += 1;
02451 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02452
MINUS_SINGLE_INFINITY_VALUE,
02453 0x0,
02454 &SingleResult);
02455
02456
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02457 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02458
goto TestFailed;
02459 }
02460
02461 Subtest += 1;
02462 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02463
SIGN | 0x3f80000,
02464 0x0,
02465 &SingleResult);
02466
02467
if ((Fsr.
Data != (
SZ |
XZ | ROUND_TO_NEAREST)) ||
02468 (SingleResult !=
MINUS_SINGLE_INFINITY_VALUE)) {
02469
goto TestFailed;
02470 }
02471
02472 Subtest += 1;
02473
Count = 0;
02474
try {
02475 Fsr.
Data =
DivideSingle(
EV | ROUND_TO_NEAREST,
02476 SINGLE_INFINITY_VALUE,
02477 SINGLE_INFINITY_VALUE,
02478 &SingleResult);
02479
02480 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
02481
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02482
Count += 1;
02483 }
02484
02485
if (
Count == 0) {
02486
goto TestFailed;
02487 }
02488
02489 Subtest += 1;
02490
Count = 0;
02491
try {
02492 Fsr.
Data =
DivideSingle(
EV | ROUND_TO_NEAREST,
02493 0x0,
02494 0x0,
02495 &SingleResult);
02496
02497 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
02498
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02499
Count += 1;
02500 }
02501
02502
if (
Count == 0) {
02503
goto TestFailed;
02504 }
02505
02506 Subtest += 1;
02507
Count = 0;
02508
try {
02509 Fsr.
Data =
DivideSingle(
EZ | ROUND_TO_NEAREST,
02510 0x3f800000,
02511 0x0,
02512 &SingleResult);
02513
02514 } except ((GetExceptionCode() == STATUS_FLOAT_DIVIDE_BY_ZERO) ?
02515
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02516
Count += 1;
02517 }
02518
02519
if (
Count == 0) {
02520
goto TestFailed;
02521 }
02522
02523 Subtest += 1;
02524 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02525 SINGLE_QUIET_NAN,
02526 SINGLE_QUIET_NAN,
02527 &SingleResult);
02528
02529
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
02530 (SingleResult != SINGLE_QUIET_NAN)) {
02531
goto TestFailed;
02532 }
02533
02534 Subtest += 1;
02535 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02536 SINGLE_QUIET_NAN,
02537 0x3f800000,
02538 &SingleResult);
02539
02540
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
02541 (SingleResult != SINGLE_QUIET_NAN)) {
02542
goto TestFailed;
02543 }
02544
02545 Subtest += 1;
02546 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02547 0x3f800000,
02548 SINGLE_QUIET_NAN,
02549 &SingleResult);
02550
02551
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
02552 (SingleResult != SINGLE_QUIET_NAN)) {
02553
goto TestFailed;
02554 }
02555
02556 Subtest += 1;
02557 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02558 SINGLE_SIGNAL_NAN,
02559 SINGLE_SIGNAL_NAN,
02560 &SingleResult);
02561
02562
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02563 (SingleResult != SINGLE_QUIET_NAN)) {
02564
goto TestFailed;
02565 }
02566
02567 Subtest += 1;
02568 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02569 SINGLE_SIGNAL_NAN,
02570 0x3f800000,
02571 &SingleResult);
02572
02573
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02574 (SingleResult != SINGLE_QUIET_NAN)) {
02575
goto TestFailed;
02576 }
02577
02578 Subtest += 1;
02579 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02580 0x3f800000,
02581 SINGLE_SIGNAL_NAN,
02582 &SingleResult);
02583
02584
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
02585 (SingleResult != SINGLE_QUIET_NAN)) {
02586
goto TestFailed;
02587 }
02588
02589 Subtest += 1;
02590
try {
02591 Fsr.
Data =
DivideSingle(
EV | ROUND_TO_NEAREST,
02592 SINGLE_QUIET_NAN,
02593 SINGLE_QUIET_NAN,
02594 &SingleResult);
02595
02596 } except (
EXCEPTION_EXECUTE_HANDLER) {
02597
goto TestFailed;
02598 }
02599
02600
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
02601 (SingleResult != SINGLE_QUIET_NAN)) {
02602
goto TestFailed;
02603 }
02604
02605 Subtest += 1;
02606
Count = 0;
02607
try {
02608 Fsr.
Data =
DivideSingle(
EV | ROUND_TO_NEAREST,
02609 SINGLE_QUIET_NAN,
02610 SINGLE_SIGNAL_NAN,
02611 &SingleResult);
02612
02613 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
02614
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02615
Count += 1;
02616 }
02617
02618
if (
Count != 1) {
02619
goto TestFailed;
02620 }
02621
02622 Subtest += 1;
02623
Count = 0;
02624
try {
02625 Fsr.
Data =
DivideSingle(
EV | ROUND_TO_NEAREST,
02626 SINGLE_SIGNAL_NAN,
02627 SINGLE_QUIET_NAN,
02628 &SingleResult);
02629
02630 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
02631
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
02632
Count += 1;
02633 }
02634
02635
if (
Count != 1) {
02636
goto TestFailed;
02637 }
02638
02639 Subtest += 1;
02640 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02641 0x400000,
02642 SINGLE_INFINITY_VALUE,
02643 &SingleResult);
02644
02645
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02646 (SingleResult != 0x0)) {
02647
goto TestFailed;
02648 }
02649
02650 Subtest += 1;
02651 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02652
SIGN | 0x400000,
02653 SINGLE_INFINITY_VALUE,
02654 &SingleResult);
02655
02656
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02657 (SingleResult != (
SIGN | 0x0))) {
02658
goto TestFailed;
02659 }
02660
02661 Subtest += 1;
02662 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02663 0x400000,
02664
MINUS_SINGLE_INFINITY_VALUE,
02665 &SingleResult);
02666
02667
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02668 (SingleResult != (
SIGN | 0x0))) {
02669
goto TestFailed;
02670 }
02671
02672 Subtest += 1;
02673 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02674
SIGN | 0x400000,
02675
MINUS_SINGLE_INFINITY_VALUE,
02676 &SingleResult);
02677
02678
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02679 (SingleResult != 0x0)) {
02680
goto TestFailed;
02681 }
02682
02683 Subtest += 1;
02684 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02685 0x400000,
02686 0x400000,
02687 &SingleResult);
02688
02689
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02690 (SingleResult != 0x3f800000)) {
02691
goto TestFailed;
02692 }
02693
02694 Subtest += 1;
02695 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02696
SIGN | 0x400000,
02697 0x400000,
02698 &SingleResult);
02699
02700
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02701 (SingleResult != (
SIGN | 0x3f800000))) {
02702
goto TestFailed;
02703 }
02704
02705 Subtest += 1;
02706 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02707 0x400000,
02708
SIGN | 0x400000,
02709 &SingleResult);
02710
02711
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02712 (SingleResult != (
SIGN | 0x3f800000))) {
02713
goto TestFailed;
02714 }
02715
02716 Subtest += 1;
02717 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02718
SIGN | 0x400000,
02719
SIGN | 0x400000,
02720 &SingleResult);
02721
02722
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02723 (SingleResult != 0x3f800000)) {
02724
goto TestFailed;
02725 }
02726
02727 Subtest += 1;
02728 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02729 0x3f800000,
02730 0x400000,
02731 &SingleResult);
02732
02733
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02734 (SingleResult != 0x7f000000)) {
02735
goto TestFailed;
02736 }
02737
02738 Subtest += 1;
02739 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02740 0x40000000,
02741 0x400000,
02742 &SingleResult);
02743
02744
if ((Fsr.
Data != (
SO |
SI | ROUND_TO_NEAREST)) ||
02745 (SingleResult != SINGLE_INFINITY_VALUE)) {
02746
goto TestFailed;
02747 }
02748
02749 Subtest += 1;
02750 Fsr.
Data =
DivideSingle(ROUND_TO_NEAREST,
02751 0x3fffffff,
02752 0x400000,
02753 &SingleResult);
02754
02755
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
02756 (SingleResult != 0x7f7fffff)) {
02757
goto TestFailed;
02758 }
02759
02760
02761
02762
02763
02764 printf(
"succeeded\n");
02765
return;
02766
02767
02768
02769
02770
02771 TestFailed:
02772 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
02773 Subtest,
02774 Fsr.
Data,
02775 SingleResult);
02776
02777
return;
02778 }
02779
02780
VOID
02781 Test9 (
02782 VOID
02783 )
02784
02785 {
02786
02787 ULONG
Count;
02788
FLOATING_STATUS Fsr;
02789 ULONG Subtest;
02790
02791
02792
02793
02794
02795 Subtest = 0;
02796 printf(
" Test 9 - compare single ...");
02797
02798
02799
02800 Subtest += 1;
02801 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02802 0x0,
02803 0x400000);
02804
02805
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02806
goto TestFailed;
02807 }
02808
02809 Subtest += 1;
02810 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02811
SIGN | 0x0,
02812 0x400000);
02813
02814
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02815
goto TestFailed;
02816 }
02817
02818 Subtest += 1;
02819 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02820 0x400000,
02821 0x0);
02822
02823
if (Fsr.
Data != ROUND_TO_NEAREST) {
02824
goto TestFailed;
02825 }
02826
02827 Subtest += 1;
02828 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02829 0X400000,
02830
SIGN | 0x0);
02831
02832
if (Fsr.
Data != ROUND_TO_NEAREST) {
02833
goto TestFailed;
02834 }
02835
02836
02837
02838 Subtest += 1;
02839 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
02840 SINGLE_INFINITY_VALUE,
02841 SINGLE_INFINITY_VALUE);
02842
02843
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02844
goto TestFailed;
02845 }
02846
02847 Subtest += 1;
02848 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
02849 0x400000,
02850 0x400000);
02851
02852
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02853
goto TestFailed;
02854 }
02855
02856 Subtest += 1;
02857 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
02858
MINUS_SINGLE_INFINITY_VALUE,
02859 SINGLE_INFINITY_VALUE);
02860
02861
if (Fsr.
Data != ROUND_TO_NEAREST) {
02862
goto TestFailed;
02863 }
02864
02865 Subtest += 1;
02866 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
02867 0x400000,
02868
SIGN | 0x400000);
02869
02870
if (Fsr.
Data != ROUND_TO_NEAREST) {
02871
goto TestFailed;
02872 }
02873
02874 Subtest += 1;
02875 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02876 SINGLE_INFINITY_VALUE,
02877 SINGLE_INFINITY_VALUE);
02878
02879
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02880
goto TestFailed;
02881 }
02882
02883 Subtest += 1;
02884 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02885 0x400000,
02886 0x400000);
02887
02888
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02889
goto TestFailed;
02890 }
02891
02892 Subtest += 1;
02893 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02894
MINUS_SINGLE_INFINITY_VALUE,
02895 SINGLE_INFINITY_VALUE);
02896
02897
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02898
goto TestFailed;
02899 }
02900
02901 Subtest += 1;
02902 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02903
SIGN | 0x400000,
02904 0x400000);
02905
02906
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02907
goto TestFailed;
02908 }
02909
02910 Subtest += 1;
02911 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02912 SINGLE_INFINITY_VALUE,
02913
MINUS_SINGLE_INFINITY_VALUE);
02914
02915
if (Fsr.
Data != ROUND_TO_NEAREST) {
02916
goto TestFailed;
02917 }
02918
02919 Subtest += 1;
02920 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
02921 0x400000,
02922
SIGN | 0x400000);
02923
02924
if (Fsr.
Data != ROUND_TO_NEAREST) {
02925
goto TestFailed;
02926 }
02927
02928 Subtest += 1;
02929 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02930 SINGLE_INFINITY_VALUE,
02931 SINGLE_INFINITY_VALUE);
02932
02933
if (Fsr.
Data != ROUND_TO_NEAREST) {
02934
goto TestFailed;
02935 }
02936
02937 Subtest += 1;
02938 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02939 0x400000,
02940 0x400000);
02941
02942
if (Fsr.
Data != ROUND_TO_NEAREST) {
02943
goto TestFailed;
02944 }
02945
02946 Subtest += 1;
02947 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02948
MINUS_SINGLE_INFINITY_VALUE,
02949 SINGLE_INFINITY_VALUE);
02950
02951
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02952
goto TestFailed;
02953 }
02954
02955 Subtest += 1;
02956 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02957
SIGN | 0x400000,
02958 0x400000);
02959
02960
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02961
goto TestFailed;
02962 }
02963
02964 Subtest += 1;
02965 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02966 0x400000,
02967 0x410000);
02968
02969
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02970
goto TestFailed;
02971 }
02972
02973 Subtest += 1;
02974 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02975 0x200000,
02976 0x400000);
02977
02978
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02979
goto TestFailed;
02980 }
02981
02982 Subtest += 1;
02983 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02984
SIGN | 0x400000,
02985 0x400000);
02986
02987
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02988
goto TestFailed;
02989 }
02990
02991 Subtest += 1;
02992 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
02993
SIGN | 0x410000,
02994
SIGN | 0x400000);
02995
02996
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
02997
goto TestFailed;
02998 }
02999
03000 Subtest += 1;
03001 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
03002
SIGN | 0x400000,
03003
SIGN | 0x200000);
03004
03005
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03006
goto TestFailed;
03007 }
03008
03009 Subtest += 1;
03010 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
03011
SIGN | 0x400000,
03012 0x400000);
03013
03014
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03015
goto TestFailed;
03016 }
03017
03018 Subtest += 1;
03019 Fsr.
Data =
CompareFSingle(ROUND_TO_NEAREST,
03020 0x400000,
03021 0x400000);
03022
03023
if (Fsr.
Data != ROUND_TO_NEAREST) {
03024
goto TestFailed;
03025 }
03026
03027 Subtest += 1;
03028 Fsr.
Data =
CompareUnSingle(ROUND_TO_NEAREST,
03029 0x400000,
03030 0x400000);
03031
03032
if (Fsr.
Data != ROUND_TO_NEAREST) {
03033
goto TestFailed;
03034 }
03035
03036 Subtest += 1;
03037 Fsr.
Data =
CompareUnSingle(ROUND_TO_NEAREST,
03038 SINGLE_QUIET_NAN,
03039 0x400000);
03040
03041
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03042
goto TestFailed;
03043 }
03044
03045 Subtest += 1;
03046 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
03047 SINGLE_QUIET_NAN,
03048 SINGLE_INFINITY_VALUE);
03049
03050
if (Fsr.
Data != ROUND_TO_NEAREST) {
03051
goto TestFailed;
03052 }
03053
03054 Subtest += 1;
03055 Fsr.
Data =
CompareEqSingle(ROUND_TO_NEAREST,
03056 SINGLE_INFINITY_VALUE,
03057 SINGLE_INFINITY_VALUE);
03058
03059
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03060
goto TestFailed;
03061 }
03062
03063 Subtest += 1;
03064 Fsr.
Data =
CompareUeqSingle(ROUND_TO_NEAREST,
03065 0x400000,
03066 SINGLE_INFINITY_VALUE);
03067
03068
if (Fsr.
Data != ROUND_TO_NEAREST) {
03069
goto TestFailed;
03070 }
03071
03072 Subtest += 1;
03073 Fsr.
Data =
CompareUeqSingle(ROUND_TO_NEAREST,
03074 SINGLE_QUIET_NAN,
03075 SINGLE_INFINITY_VALUE);
03076
03077
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03078
goto TestFailed;
03079 }
03080
03081 Subtest += 1;
03082 Fsr.
Data =
CompareOltSingle(ROUND_TO_NEAREST,
03083 0x400000,
03084 SINGLE_QUIET_NAN);
03085
03086
if (Fsr.
Data != ROUND_TO_NEAREST) {
03087
goto TestFailed;
03088 }
03089
03090 Subtest += 1;
03091 Fsr.
Data =
CompareOltSingle(ROUND_TO_NEAREST,
03092 0x400000,
03093 SINGLE_INFINITY_VALUE);
03094
03095
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03096
goto TestFailed;
03097 }
03098
03099 Subtest += 1;
03100 Fsr.
Data =
CompareUltSingle(ROUND_TO_NEAREST,
03101 0x400000,
03102 0x400000);
03103
03104
if (Fsr.
Data != ROUND_TO_NEAREST) {
03105
goto TestFailed;
03106 }
03107
03108 Subtest += 1;
03109 Fsr.
Data =
CompareUltSingle(ROUND_TO_NEAREST,
03110 SINGLE_QUIET_NAN,
03111 SINGLE_INFINITY_VALUE);
03112
03113
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03114
goto TestFailed;
03115 }
03116
03117 Subtest += 1;
03118 Fsr.
Data =
CompareOleSingle(ROUND_TO_NEAREST,
03119 0x410000,
03120 0x400000);
03121
03122
if (Fsr.
Data != ROUND_TO_NEAREST) {
03123
goto TestFailed;
03124 }
03125
03126 Subtest += 1;
03127 Fsr.
Data =
CompareOleSingle(ROUND_TO_NEAREST,
03128 SINGLE_INFINITY_VALUE,
03129 SINGLE_INFINITY_VALUE);
03130
03131
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
03132
goto TestFailed;
03133 }
03134
03135 Subtest += 1;
03136 Fsr.
Data =
CompareSfSingle(ROUND_TO_NEAREST,
03137 0x410000,
03138 0x400000);
03139
03140
if (Fsr.
Data != ROUND_TO_NEAREST) {
03141
goto TestFailed;
03142 }
03143
03144 Subtest += 1;
03145 Fsr.
Data =
CompareSfSingle(ROUND_TO_NEAREST,
03146 SINGLE_INFINITY_VALUE,
03147 SINGLE_QUIET_NAN);
03148
03149
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
03150
goto TestFailed;
03151 }
03152
03153 Subtest += 1;
03154 Fsr.
Data =
CompareNgleSingle(ROUND_TO_NEAREST,
03155 0x410000,
03156 0x400000);
03157
03158
if (Fsr.
Data != ROUND_TO_NEAREST) {
03159
goto TestFailed;
03160 }
03161
03162 Subtest += 1;
03163 Fsr.
Data =
CompareNgleSingle(ROUND_TO_NEAREST,
03164 SINGLE_QUIET_NAN,
03165 SINGLE_INFINITY_VALUE);
03166
03167
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
03168
goto TestFailed;
03169 }
03170
03171 Subtest += 1;
03172 Fsr.
Data =
CompareSeqSingle(ROUND_TO_NEAREST,
03173 0x410000,
03174 0x400000);
03175
03176
if (Fsr.
Data != ROUND_TO_NEAREST) {
03177
goto TestFailed;
03178 }
03179
03180 Subtest += 1;
03181 Fsr.
Data =
CompareSeqSingle(ROUND_TO_NEAREST,
03182 SINGLE_QUIET_NAN,
03183 SINGLE_INFINITY_VALUE);
03184
03185
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
03186
goto TestFailed;
03187 }
03188
03189 Subtest += 1;
03190 Fsr.
Data =
CompareNglSingle(ROUND_TO_NEAREST,
03191 0x410000,
03192 0x400000);
03193
03194
if (Fsr.
Data != ROUND_TO_NEAREST) {
03195
goto TestFailed;
03196 }
03197
03198 Subtest += 1;
03199 Fsr.
Data =
CompareNglSingle(ROUND_TO_NEAREST,
03200 SINGLE_QUIET_NAN,
03201 SINGLE_INFINITY_VALUE);
03202
03203
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
03204
goto TestFailed;
03205 }
03206
03207 Subtest += 1;
03208 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
03209 0x410000,
03210 0x400000);
03211
03212
if (Fsr.
Data != ROUND_TO_NEAREST) {
03213
goto TestFailed;
03214 }
03215
03216 Subtest += 1;
03217 Fsr.
Data =
CompareLtSingle(ROUND_TO_NEAREST,
03218 SINGLE_QUIET_NAN,
03219 SINGLE_INFINITY_VALUE);
03220
03221
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
03222
goto TestFailed;
03223 }
03224
03225 Subtest += 1;
03226 Fsr.
Data =
CompareNgeSingle(ROUND_TO_NEAREST,
03227 0x410000,
03228 0x400000);
03229
03230
if (Fsr.
Data != ROUND_TO_NEAREST) {
03231
goto TestFailed;
03232 }
03233
03234 Subtest += 1;
03235 Fsr.
Data =
CompareNgeSingle(ROUND_TO_NEAREST,
03236 SINGLE_QUIET_NAN,
03237 SINGLE_INFINITY_VALUE);
03238
03239
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
03240
goto TestFailed;
03241 }
03242
03243 Subtest += 1;
03244 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
03245 0x410000,
03246 0x400000);
03247
03248
if (Fsr.
Data != ROUND_TO_NEAREST) {
03249
goto TestFailed;
03250 }
03251
03252 Subtest += 1;
03253 Fsr.
Data =
CompareLeSingle(ROUND_TO_NEAREST,
03254 SINGLE_QUIET_NAN,
03255 SINGLE_INFINITY_VALUE);
03256
03257
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
03258
goto TestFailed;
03259 }
03260
03261 Subtest += 1;
03262 Fsr.
Data =
CompareNgtSingle(ROUND_TO_NEAREST,
03263 0x410000,
03264 0x400000);
03265
03266
if (Fsr.
Data != ROUND_TO_NEAREST) {
03267
goto TestFailed;
03268 }
03269
03270 Subtest += 1;
03271 Fsr.
Data =
CompareNgtSingle(ROUND_TO_NEAREST,
03272 SINGLE_QUIET_NAN,
03273 SINGLE_INFINITY_VALUE);
03274
03275
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
03276
goto TestFailed;
03277 }
03278
03279 Subtest += 1;
03280
Count = 0;
03281
try {
03282 Fsr.
Data =
CompareSfSingle(
EV | ROUND_TO_NEAREST,
03283 SINGLE_INFINITY_VALUE,
03284 SINGLE_QUIET_NAN);
03285
03286 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03287
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03288
Count += 1;
03289 }
03290
03291
if (
Count == 0) {
03292
goto TestFailed;
03293 }
03294
03295 Subtest += 1;
03296
Count = 0;
03297
try {
03298 Fsr.
Data =
CompareNgleSingle(
EV | ROUND_TO_NEAREST,
03299 SINGLE_QUIET_NAN,
03300 SINGLE_INFINITY_VALUE);
03301
03302 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03303
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03304
Count += 1;
03305 }
03306
03307
if (
Count == 0) {
03308
goto TestFailed;
03309 }
03310
03311 Subtest += 1;
03312
Count = 0;
03313
try {
03314 Fsr.
Data =
CompareSeqSingle(
EV | ROUND_TO_NEAREST,
03315 SINGLE_QUIET_NAN,
03316 SINGLE_INFINITY_VALUE);
03317
03318 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03319
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03320
Count += 1;
03321 }
03322
03323
if (
Count == 0) {
03324
goto TestFailed;
03325 }
03326
03327 Subtest += 1;
03328
Count = 0;
03329
try {
03330 Fsr.
Data =
CompareNglSingle(
EV | ROUND_TO_NEAREST,
03331 SINGLE_QUIET_NAN,
03332 SINGLE_INFINITY_VALUE);
03333
03334 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03335
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03336
Count += 1;
03337 }
03338
03339
if (
Count == 0) {
03340
goto TestFailed;
03341 }
03342
03343 Subtest += 1;
03344
Count = 0;
03345
try {
03346 Fsr.
Data =
CompareLtSingle(
EV | ROUND_TO_NEAREST,
03347 SINGLE_QUIET_NAN,
03348 SINGLE_INFINITY_VALUE);
03349
03350 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03351
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03352
Count += 1;
03353 }
03354
03355
if (
Count == 0) {
03356
goto TestFailed;
03357 }
03358
03359 Subtest += 1;
03360
Count = 0;
03361
try {
03362 Fsr.
Data =
CompareNgeSingle(
EV | ROUND_TO_NEAREST,
03363 SINGLE_QUIET_NAN,
03364 SINGLE_INFINITY_VALUE);
03365
03366 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03367
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03368
Count += 1;
03369 }
03370
03371
if (
Count == 0) {
03372
goto TestFailed;
03373 }
03374
03375 Subtest += 1;
03376
Count = 0;
03377
try {
03378 Fsr.
Data =
CompareLeSingle(
EV | ROUND_TO_NEAREST,
03379 SINGLE_QUIET_NAN,
03380 SINGLE_INFINITY_VALUE);
03381
03382 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03383
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03384
Count += 1;
03385 }
03386
03387
if (
Count == 0) {
03388
goto TestFailed;
03389 }
03390
03391 Subtest += 1;
03392
Count = 0;
03393
try {
03394 Fsr.
Data =
CompareNgtSingle(
EV | ROUND_TO_NEAREST,
03395 SINGLE_QUIET_NAN,
03396 SINGLE_INFINITY_VALUE);
03397
03398 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03399
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03400
Count += 1;
03401 }
03402
03403
if (
Count == 0) {
03404
goto TestFailed;
03405 }
03406
03407 Subtest += 1;
03408
Count = 0;
03409
try {
03410 Fsr.
Data =
CompareEqSingle(
EV | ROUND_TO_NEAREST,
03411 SINGLE_SIGNAL_NAN,
03412 SINGLE_INFINITY_VALUE);
03413
03414 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03415
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03416
Count += 1;
03417 }
03418
03419
if (
Count == 0) {
03420
goto TestFailed;
03421 }
03422
03423
03424
03425
03426
03427 printf(
"succeeded\n");
03428
return;
03429
03430
03431
03432
03433
03434 TestFailed:
03435 printf(
" subtest %d failed, fsr = %lx\n", Subtest, Fsr.
Data);
03436
return;
03437 }
03438
03439
VOID
03440 Test10 (
03441 VOID
03442 )
03443
03444 {
03445
03446 ULONG
Count;
03447
FLOATING_STATUS Fsr;
03448 ULONG Subtest;
03449 ULONG SingleResult;
03450
03451
03452
03453
03454
03455 Subtest = 0;
03456 printf(
" Test 10 - absolute, move, and negate single ...");
03457 Subtest += 1;
03458 Fsr.
Data =
AbsoluteSingle(ROUND_TO_NEAREST,
03459 0x400000,
03460 &SingleResult);
03461
03462
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03463 (SingleResult != 0x400000)) {
03464
goto TestFailed;
03465 }
03466
03467 Subtest += 1;
03468 Fsr.
Data =
AbsoluteSingle(ROUND_TO_NEAREST,
03469
SIGN | 0x400000,
03470 &SingleResult);
03471
03472
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03473 (SingleResult != 0x400000)) {
03474
goto TestFailed;
03475 }
03476
03477 Subtest += 1;
03478 Fsr.
Data =
AbsoluteSingle(ROUND_TO_NEAREST,
03479 SINGLE_QUIET_NAN,
03480 &SingleResult);
03481
03482
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03483 (SingleResult != SINGLE_QUIET_NAN)) {
03484
goto TestFailed;
03485 }
03486
03487 Subtest += 1;
03488 Fsr.
Data =
AbsoluteSingle(ROUND_TO_NEAREST,
03489 SINGLE_SIGNAL_NAN,
03490 &SingleResult);
03491
03492
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
03493 (SingleResult != SINGLE_QUIET_NAN)) {
03494
goto TestFailed;
03495 }
03496
03497 Subtest += 1;
03498
Count = 0;
03499
try {
03500 Fsr.
Data =
AbsoluteSingle(
EV | ROUND_TO_NEAREST,
03501 SINGLE_SIGNAL_NAN,
03502 &SingleResult);
03503
03504 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03505
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03506
Count += 1;
03507 }
03508
03509
if (
Count == 0) {
03510
goto TestFailed;
03511 }
03512
03513 Subtest += 1;
03514 Fsr.
Data =
MoveSingle(ROUND_TO_NEAREST,
03515 0x400000,
03516 &SingleResult);
03517
03518
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03519 (SingleResult != 0x400000)) {
03520
goto TestFailed;
03521 }
03522
03523 Subtest += 1;
03524 Fsr.
Data =
MoveSingle(ROUND_TO_NEAREST,
03525
SIGN | 0x400000,
03526 &SingleResult);
03527
03528
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03529 (SingleResult != (
SIGN | 0x400000))) {
03530
goto TestFailed;
03531 }
03532
03533 Subtest += 1;
03534 Fsr.
Data =
MoveSingle(ROUND_TO_NEAREST,
03535 SINGLE_QUIET_NAN,
03536 &SingleResult);
03537
03538
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03539 (SingleResult != SINGLE_QUIET_NAN)) {
03540
goto TestFailed;
03541 }
03542
03543 Subtest += 1;
03544 Fsr.
Data =
MoveSingle(ROUND_TO_NEAREST,
03545 SINGLE_SIGNAL_NAN,
03546 &SingleResult);
03547
03548
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03549 (SingleResult != SINGLE_SIGNAL_NAN)) {
03550
goto TestFailed;
03551 }
03552
03553 Subtest += 1;
03554 Fsr.
Data =
MoveSingle(
EV | ROUND_TO_NEAREST,
03555 SINGLE_SIGNAL_NAN,
03556 &SingleResult);
03557
03558
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
03559 (SingleResult != SINGLE_SIGNAL_NAN)) {
03560
goto TestFailed;
03561 }
03562
03563 Subtest += 1;
03564 Fsr.
Data =
NegateSingle(ROUND_TO_NEAREST,
03565 0x400000,
03566 &SingleResult);
03567
03568
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03569 (SingleResult != (
SIGN | 0x400000))) {
03570
goto TestFailed;
03571 }
03572
03573 Subtest += 1;
03574 Fsr.
Data =
NegateSingle(ROUND_TO_NEAREST,
03575
SIGN | 0x400000,
03576 &SingleResult);
03577
03578
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03579 (SingleResult != 0x400000)) {
03580
goto TestFailed;
03581 }
03582
03583 Subtest += 1;
03584 Fsr.
Data =
NegateSingle(ROUND_TO_NEAREST,
03585 SINGLE_QUIET_NAN,
03586 &SingleResult);
03587
03588
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03589 (SingleResult != SINGLE_QUIET_NAN)) {
03590
goto TestFailed;
03591 }
03592
03593 Subtest += 1;
03594 Fsr.
Data =
NegateSingle(ROUND_TO_NEAREST,
03595 SINGLE_SIGNAL_NAN,
03596 &SingleResult);
03597
03598
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
03599 (SingleResult != SINGLE_QUIET_NAN)) {
03600
goto TestFailed;
03601 }
03602
03603 Subtest += 1;
03604
Count = 0;
03605
try {
03606 Fsr.
Data =
NegateSingle(
EV | ROUND_TO_NEAREST,
03607 SINGLE_SIGNAL_NAN,
03608 &SingleResult);
03609
03610 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
03611
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03612
Count += 1;
03613 }
03614
03615
if (
Count == 0) {
03616
goto TestFailed;
03617 }
03618
03619
03620
03621
03622
03623 printf(
"succeeded\n");
03624
return;
03625
03626
03627
03628
03629
03630 TestFailed:
03631 printf(
" subtest %d failed, fsr = %lx, result = %lx\n",
03632 Subtest,
03633 Fsr.
Data,
03634 SingleResult);
03635
03636
return;
03637 }
03638
03639
VOID
03640 Test11 (
03641 VOID
03642 )
03643
03644 {
03645
03646 ULONG
Count;
03647 ULARGE_INTEGER DoubleOperand1;
03648 ULARGE_INTEGER DoubleOperand2;
03649 ULARGE_INTEGER DoubleResult;
03650
FLOATING_STATUS Fsr;
03651 ULONG Subtest;
03652
03653
03654
03655
03656
03657 Subtest = 0;
03658 printf(
" Test 11 - add/subtract double denormalized ...");
03659 Subtest += 1;
03660 DoubleOperand1.LowPart = 0x3ff;
03661 DoubleOperand1.HighPart = 0x0;
03662 DoubleOperand2.LowPart = 0x1;
03663 DoubleOperand2.HighPart = 0x0;
03664 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03665 &DoubleOperand1,
03666 &DoubleOperand2,
03667 &DoubleResult);
03668
03669
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03670 (DoubleResult.LowPart != 0x400) ||
03671 (DoubleResult.HighPart != 0x0)) {
03672
goto TestFailed;
03673 }
03674
03675 Subtest += 1;
03676 DoubleOperand1.LowPart = 0x0;
03677 DoubleOperand1.HighPart = 0x1;
03678 DoubleOperand2.LowPart = 0x0;
03679 DoubleOperand2.HighPart = 0x7fff;
03680 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03681 &DoubleOperand1,
03682 &DoubleOperand2,
03683 &DoubleResult);
03684
03685
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03686 (DoubleResult.LowPart != 0x0) ||
03687 (DoubleResult.HighPart != 0x8000)) {
03688
goto TestFailed;
03689 }
03690
03691 Subtest += 1;
03692 DoubleOperand1.LowPart = 0x0;
03693 DoubleOperand1.HighPart = 0x80000;
03694 DoubleOperand2.LowPart = 0x0;
03695 DoubleOperand2.HighPart =
SIGN | 0x84000;
03696 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03697 &DoubleOperand1,
03698 &DoubleOperand2,
03699 &DoubleResult);
03700
03701
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03702 (DoubleResult.LowPart != 0x0) ||
03703 (DoubleResult.HighPart != (
SIGN | 0x4000))) {
03704
goto TestFailed;
03705 }
03706
03707 Subtest += 1;
03708 DoubleOperand1.LowPart = 0x0;
03709 DoubleOperand1.HighPart =
SIGN | 0x80000;
03710 DoubleOperand2.LowPart = 0x0;
03711 DoubleOperand2.HighPart = 0x84000;
03712 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03713 &DoubleOperand1,
03714 &DoubleOperand2,
03715 &DoubleResult);
03716
03717
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03718 (DoubleResult.LowPart != 0x0) ||
03719 (DoubleResult.HighPart != 0x4000)) {
03720
goto TestFailed;
03721 }
03722
03723 Subtest += 1;
03724 DoubleOperand1.LowPart = 0x0;
03725 DoubleOperand1.HighPart = 0x80000;
03726 DoubleOperand2.LowPart = 0x0;
03727 DoubleOperand2.HighPart =
SIGN | 0x80000;
03728 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03729 &DoubleOperand1,
03730 &DoubleOperand2,
03731 &DoubleResult);
03732
03733
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03734 (DoubleResult.LowPart != 0x0) ||
03735 (DoubleResult.HighPart != 0x0)) {
03736
goto TestFailed;
03737 }
03738
03739 Subtest += 1;
03740 DoubleOperand1.LowPart = 0x0;
03741 DoubleOperand1.HighPart =
SIGN | 0x80000;
03742 DoubleOperand2.LowPart = 0x0;
03743 DoubleOperand2.HighPart = 0x80000;
03744 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03745 &DoubleOperand1,
03746 &DoubleOperand2,
03747 &DoubleResult);
03748
03749
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03750 (DoubleResult.LowPart != 0x0) ||
03751 (DoubleResult.HighPart != (
SIGN | 0x0))) {
03752
goto TestFailed;
03753 }
03754
03755 Subtest += 1;
03756 DoubleOperand1.LowPart = 0x0;
03757 DoubleOperand1.HighPart = 0x80000;
03758 DoubleOperand2.LowPart = 0x0;
03759 DoubleOperand2.HighPart = 0x80000;
03760 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03761 &DoubleOperand1,
03762 &DoubleOperand2,
03763 &DoubleResult);
03764
03765
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03766 (DoubleResult.LowPart != 0x0) ||
03767 (DoubleResult.HighPart != 0x100000)) {
03768
goto TestFailed;
03769 }
03770
03771 Subtest += 1;
03772 DoubleOperand1.LowPart = 0x0;
03773 DoubleOperand1.HighPart = 0x100000;
03774 DoubleOperand2.LowPart = 0x0;
03775 DoubleOperand2.HighPart = 0xfffff;
03776 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03777 &DoubleOperand1,
03778 &DoubleOperand2,
03779 &DoubleResult);
03780
03781
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03782 (DoubleResult.LowPart != 0x0) ||
03783 (DoubleResult.HighPart != 0x1fffff)) {
03784
goto TestFailed;
03785 }
03786
03787 Subtest += 1;
03788 DoubleOperand1.LowPart = 0x0;
03789 DoubleOperand1.HighPart = 0x80000;
03790 DoubleOperand2.LowPart = 0x0;
03791 DoubleOperand2.HighPart = 0x1600000;
03792 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03793 &DoubleOperand1,
03794 &DoubleOperand2,
03795 &DoubleResult);
03796
03797
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03798 (DoubleResult.LowPart != 0x40000000) ||
03799 (DoubleResult.HighPart != 0x1600000)) {
03800
goto TestFailed;
03801 }
03802
03803 Subtest += 1;
03804 DoubleOperand1.LowPart = 0x0;
03805 DoubleOperand1.HighPart = 0x80000;
03806 DoubleOperand2.LowPart = 0x0;
03807 DoubleOperand2.HighPart = 0x2600000;
03808 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03809 &DoubleOperand1,
03810 &DoubleOperand2,
03811 &DoubleResult);
03812
03813
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03814 (DoubleResult.LowPart != 0x4000) ||
03815 (DoubleResult.HighPart != 0x2600000)) {
03816
goto TestFailed;
03817 }
03818
03819 Subtest += 1;
03820 DoubleOperand1.LowPart = 0x0;
03821 DoubleOperand1.HighPart = 0x80000;
03822 DoubleOperand2.LowPart = 0x0;
03823 DoubleOperand2.HighPart = 0x3f000000;
03824 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
03825 &DoubleOperand1,
03826 &DoubleOperand2,
03827 &DoubleResult);
03828
03829
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
03830 (DoubleResult.LowPart != 0x0) ||
03831 (DoubleResult.HighPart != 0x3f000000)) {
03832
goto TestFailed;
03833 }
03834
03835 Subtest += 1;
03836 DoubleOperand1.LowPart = 0x0;
03837 DoubleOperand1.HighPart = 0x100000;
03838 DoubleOperand2.LowPart = 0x0;
03839 DoubleOperand2.HighPart = 0x3ff00000;
03840
Count = 0;
03841
try {
03842 Fsr.
Data =
AddDouble(
EI | ROUND_TO_NEAREST,
03843 &DoubleOperand1,
03844 &DoubleOperand2,
03845 &DoubleResult);
03846
03847 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
03848
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03849
Count += 1;
03850 }
03851
03852
if (
Count == 0) {
03853
goto TestFailed;
03854 }
03855
03856 Subtest += 1;
03857 DoubleOperand1.LowPart = 0x0;
03858 DoubleOperand1.HighPart = 0x7fe00000;
03859 DoubleOperand2.LowPart = 0x0;
03860 DoubleOperand2.HighPart = 0x7fe00000;
03861
Count = 0;
03862
try {
03863 Fsr.
Data =
AddDouble(
EO | ROUND_TO_NEAREST,
03864 &DoubleOperand1,
03865 &DoubleOperand2,
03866 &DoubleResult);
03867
03868 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
03869
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03870
Count += 1;
03871 }
03872
03873
if (
Count == 0) {
03874
goto TestFailed;
03875 }
03876
03877 Subtest += 1;
03878 DoubleOperand1.LowPart = 0x0;
03879 DoubleOperand1.HighPart = 0x7fe00000;
03880 DoubleOperand2.LowPart = 0x0;
03881 DoubleOperand2.HighPart = 0x7fe00000;
03882
Count = 0;
03883
try {
03884 Fsr.
Data =
AddDouble(
EI | ROUND_TO_NEAREST,
03885 &DoubleOperand1,
03886 &DoubleOperand2,
03887 &DoubleResult);
03888
03889 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
03890
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03891
Count += 1;
03892 }
03893
03894
if (
Count == 0) {
03895
goto TestFailed;
03896 }
03897
03898 Subtest += 1;
03899 DoubleOperand1.LowPart = 0x0;
03900 DoubleOperand1.HighPart = 0x7fe00000;
03901 DoubleOperand2.LowPart = 0x0;
03902 DoubleOperand2.HighPart = 0x7fe00000;
03903
Count = 0;
03904
try {
03905 Fsr.
Data =
AddDouble(
EI |
EO | ROUND_TO_NEAREST,
03906 &DoubleOperand1,
03907 &DoubleOperand2,
03908 &DoubleResult);
03909
03910 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
03911
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
03912
Count += 1;
03913 }
03914
03915
if (
Count == 0) {
03916
goto TestFailed;
03917 }
03918
03919 Subtest += 1;
03920 DoubleOperand1.LowPart = 0x3ff;
03921 DoubleOperand1.HighPart = 0x0;
03922 DoubleOperand2.LowPart = 0x1;
03923 DoubleOperand2.HighPart =
SIGN;
03924 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
03925 &DoubleOperand1,
03926 &DoubleOperand2,
03927 &DoubleResult);
03928
03929
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03930 (DoubleResult.LowPart != 0x400) ||
03931 (DoubleResult.HighPart != 0x0)) {
03932
goto TestFailed;
03933 }
03934
03935 Subtest += 1;
03936 DoubleOperand1.LowPart = 0x0;
03937 DoubleOperand1.HighPart = 0x1;
03938 DoubleOperand2.LowPart = 0x0;
03939 DoubleOperand2.HighPart =
SIGN | 0x7fff;
03940 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
03941 &DoubleOperand1,
03942 &DoubleOperand2,
03943 &DoubleResult);
03944
03945
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03946 (DoubleResult.LowPart != 0x0) ||
03947 (DoubleResult.HighPart != 0x8000)) {
03948
goto TestFailed;
03949 }
03950
03951 Subtest += 1;
03952 DoubleOperand1.LowPart = 0x0;
03953 DoubleOperand1.HighPart = 0x80000;
03954 DoubleOperand2.LowPart = 0x0;
03955 DoubleOperand2.HighPart = 0x84000;
03956 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
03957 &DoubleOperand1,
03958 &DoubleOperand2,
03959 &DoubleResult);
03960
03961
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03962 (DoubleResult.LowPart != 0x0) ||
03963 (DoubleResult.HighPart != (
SIGN | 0x4000))) {
03964
goto TestFailed;
03965 }
03966
03967 Subtest += 1;
03968 DoubleOperand1.LowPart = 0x0;
03969 DoubleOperand1.HighPart =
SIGN | 0x80000;
03970 DoubleOperand2.LowPart = 0x0;
03971 DoubleOperand2.HighPart =
SIGN | 0x84000;
03972 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
03973 &DoubleOperand1,
03974 &DoubleOperand2,
03975 &DoubleResult);
03976
03977
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03978 (DoubleResult.LowPart != 0x0) ||
03979 (DoubleResult.HighPart != 0x4000)) {
03980
goto TestFailed;
03981 }
03982
03983 Subtest += 1;
03984 DoubleOperand1.LowPart = 0x0;
03985 DoubleOperand1.HighPart = 0x80000;
03986 DoubleOperand2.LowPart = 0x0;
03987 DoubleOperand2.HighPart = 0x80000;
03988 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
03989 &DoubleOperand1,
03990 &DoubleOperand2,
03991 &DoubleResult);
03992
03993
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
03994 (DoubleResult.LowPart != 0x0) ||
03995 (DoubleResult.HighPart != 0x0)) {
03996
goto TestFailed;
03997 }
03998
03999 Subtest += 1;
04000 DoubleOperand1.LowPart = 0x0;
04001 DoubleOperand1.HighPart =
SIGN | 0x80000;
04002 DoubleOperand2.LowPart = 0x0;
04003 DoubleOperand2.HighPart =
SIGN | 0x80000;
04004 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04005 &DoubleOperand1,
04006 &DoubleOperand2,
04007 &DoubleResult);
04008
04009
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04010 (DoubleResult.LowPart != 0x0) ||
04011 (DoubleResult.HighPart != (
SIGN | 0x0))) {
04012
goto TestFailed;
04013 }
04014
04015 Subtest += 1;
04016 DoubleOperand1.LowPart = 0x0;
04017 DoubleOperand1.HighPart = 0x80000;
04018 DoubleOperand2.LowPart = 0x0;
04019 DoubleOperand2.HighPart =
SIGN | 0x80000;
04020 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04021 &DoubleOperand1,
04022 &DoubleOperand2,
04023 &DoubleResult);
04024
04025
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04026 (DoubleResult.LowPart != 0x0) ||
04027 (DoubleResult.HighPart != 0x100000)) {
04028
goto TestFailed;
04029 }
04030
04031 Subtest += 1;
04032 DoubleOperand1.LowPart = 0x0;
04033 DoubleOperand1.HighPart = 0x100000;
04034 DoubleOperand2.LowPart = 0x0;
04035 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04036 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04037 &DoubleOperand1,
04038 &DoubleOperand2,
04039 &DoubleResult);
04040
04041
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04042 (DoubleResult.LowPart != 0x0) ||
04043 (DoubleResult.HighPart != 0x1fffff)) {
04044
goto TestFailed;
04045 }
04046
04047 Subtest += 1;
04048 DoubleOperand1.LowPart = 0x0;
04049 DoubleOperand1.HighPart = 0x80000;
04050 DoubleOperand2.LowPart = 0x0;
04051 DoubleOperand2.HighPart =
SIGN | 0x1600000;
04052 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04053 &DoubleOperand1,
04054 &DoubleOperand2,
04055 &DoubleResult);
04056
04057
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04058 (DoubleResult.LowPart != 0x40000000) ||
04059 (DoubleResult.HighPart != 0x1600000)) {
04060
goto TestFailed;
04061 }
04062
04063 Subtest += 1;
04064 DoubleOperand1.LowPart = 0x0;
04065 DoubleOperand1.HighPart = 0x80000;
04066 DoubleOperand2.LowPart = 0x0;
04067 DoubleOperand2.HighPart =
SIGN | 0x2600000;
04068 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04069 &DoubleOperand1,
04070 &DoubleOperand2,
04071 &DoubleResult);
04072
04073
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04074 (DoubleResult.LowPart != 0x4000) ||
04075 (DoubleResult.HighPart != 0x2600000)) {
04076
goto TestFailed;
04077 }
04078
04079 Subtest += 1;
04080 DoubleOperand1.LowPart = 0x0;
04081 DoubleOperand1.HighPart = 0x80000;
04082 DoubleOperand2.LowPart = 0x0;
04083 DoubleOperand2.HighPart =
SIGN | 0x3f000000;
04084 Fsr.
Data =
SubtractDouble(ROUND_TO_NEAREST,
04085 &DoubleOperand1,
04086 &DoubleOperand2,
04087 &DoubleResult);
04088
04089
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04090 (DoubleResult.LowPart != 0x0) ||
04091 (DoubleResult.HighPart != 0x3f000000)) {
04092
goto TestFailed;
04093 }
04094
04095 Subtest += 1;
04096 DoubleOperand1.LowPart = 0x0;
04097 DoubleOperand1.HighPart = 0x80000;
04098 DoubleOperand2.LowPart = 0x0;
04099 DoubleOperand2.HighPart =
SIGN | 0x3ff00000;
04100
Count = 0;
04101
try {
04102 Fsr.
Data =
SubtractDouble(
EI | ROUND_TO_NEAREST,
04103 &DoubleOperand1,
04104 &DoubleOperand2,
04105 &DoubleResult);
04106
04107 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
04108
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04109
Count += 1;
04110 }
04111
04112
if (
Count == 0) {
04113
goto TestFailed;
04114 }
04115
04116 Subtest += 1;
04117 DoubleOperand1.LowPart = 0x0;
04118 DoubleOperand1.HighPart = 0x7fe00000;
04119 DoubleOperand2.LowPart = 0x0;
04120 DoubleOperand2.HighPart =
SIGN | 0x7fe00000;
04121
Count = 0;
04122
try {
04123 Fsr.
Data =
SubtractDouble(
EO | ROUND_TO_NEAREST,
04124 &DoubleOperand1,
04125 &DoubleOperand2,
04126 &DoubleResult);
04127
04128 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
04129
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04130
Count += 1;
04131 }
04132
04133
if (
Count == 0) {
04134
goto TestFailed;
04135 }
04136
04137 Subtest += 1;
04138 DoubleOperand1.LowPart = 0x0;
04139 DoubleOperand1.HighPart = 0x7fe00000;
04140 DoubleOperand2.LowPart = 0x0;
04141 DoubleOperand2.HighPart =
SIGN | 0x7fe00000;
04142
Count = 0;
04143
try {
04144 Fsr.
Data =
SubtractDouble(
EI | ROUND_TO_NEAREST,
04145 &DoubleOperand1,
04146 &DoubleOperand2,
04147 &DoubleResult);
04148
04149 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
04150
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04151
Count += 1;
04152 }
04153
04154
if (
Count == 0) {
04155
goto TestFailed;
04156 }
04157
04158 Subtest += 1;
04159 DoubleOperand1.LowPart = 0x0;
04160 DoubleOperand1.HighPart = 0x7fe00000;
04161 DoubleOperand2.LowPart = 0x0;
04162 DoubleOperand2.HighPart =
SIGN | 0x7fe00000;
04163
Count = 0;
04164
try {
04165 Fsr.
Data =
SubtractDouble(
EI |
EO | ROUND_TO_NEAREST,
04166 &DoubleOperand1,
04167 &DoubleOperand2,
04168 &DoubleResult);
04169
04170 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
04171
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04172
Count += 1;
04173 }
04174
04175
if (
Count == 0) {
04176
goto TestFailed;
04177 }
04178
04179
04180
04181
04182
04183 printf(
"succeeded\n");
04184
return;
04185
04186
04187
04188
04189
04190 TestFailed:
04191 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
04192 Subtest,
04193 Fsr.
Data,
04194 DoubleResult.LowPart,
04195 DoubleResult.HighPart);
04196
04197
return;
04198 }
04199
04200
VOID
04201 Test12 (
04202 VOID
04203 )
04204
04205 {
04206
04207 ULONG
Count;
04208 ULARGE_INTEGER DoubleOperand1;
04209 ULARGE_INTEGER DoubleOperand2;
04210 ULARGE_INTEGER DoubleResult;
04211
FLOATING_STATUS Fsr;
04212 ULONG Subtest;
04213
04214
04215
04216
04217
04218 Subtest = 0;
04219 printf(
" Test 12 - add double round to nearest ...");
04220 Subtest += 1;
04221 DoubleOperand1.LowPart = 0x0;
04222 DoubleOperand1.HighPart = 0x300000;
04223 DoubleOperand2.LowPart = 0xfffffff8;
04224 DoubleOperand2.HighPart = 0xfffff;
04225 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04226 &DoubleOperand1,
04227 &DoubleOperand2,
04228 &DoubleResult);
04229
04230
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04231 (DoubleResult.LowPart != 0xfffffffe) ||
04232 (DoubleResult.HighPart != 0x33ffff)) {
04233
goto TestFailed;
04234 }
04235
04236 Subtest += 1;
04237 DoubleOperand1.LowPart = 0x0;
04238 DoubleOperand1.HighPart = 0x300000;
04239 DoubleOperand2.LowPart = 0xfffffff9;
04240 DoubleOperand2.HighPart = 0xfffff;
04241 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04242 &DoubleOperand1,
04243 &DoubleOperand2,
04244 &DoubleResult);
04245
04246
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04247 (DoubleResult.LowPart != 0xfffffffe) ||
04248 (DoubleResult.HighPart != 0x33ffff)) {
04249
goto TestFailed;
04250 }
04251
04252 Subtest += 1;
04253 DoubleOperand1.LowPart = 0x0;
04254 DoubleOperand1.HighPart = 0x300000;
04255 DoubleOperand2.LowPart = 0xfffffffa;
04256 DoubleOperand2.HighPart = 0xfffff;
04257 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04258 &DoubleOperand1,
04259 &DoubleOperand2,
04260 &DoubleResult);
04261
04262
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04263 (DoubleResult.LowPart != 0xfffffffe) ||
04264 (DoubleResult.HighPart != 0x33ffff)) {
04265
goto TestFailed;
04266 }
04267
04268 Subtest += 1;
04269 DoubleOperand1.LowPart = 0x0;
04270 DoubleOperand1.HighPart = 0x300000;
04271 DoubleOperand2.LowPart = 0xfffffffb;
04272 DoubleOperand2.HighPart = 0xfffff;
04273 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04274 &DoubleOperand1,
04275 &DoubleOperand2,
04276 &DoubleResult);
04277
04278
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04279 (DoubleResult.LowPart != 0xffffffff) ||
04280 (DoubleResult.HighPart != 0x33ffff)) {
04281
goto TestFailed;
04282 }
04283
04284 Subtest += 1;
04285 DoubleOperand1.LowPart = 0x0;
04286 DoubleOperand1.HighPart = 0x300000;
04287 DoubleOperand2.LowPart = 0xfffffffc;
04288 DoubleOperand2.HighPart = 0xfffff;
04289 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04290 &DoubleOperand1,
04291 &DoubleOperand2,
04292 &DoubleResult);
04293
04294
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
04295 (DoubleResult.LowPart != 0xffffffff) ||
04296 (DoubleResult.HighPart != 0x33ffff)) {
04297
goto TestFailed;
04298 }
04299
04300 Subtest += 1;
04301 DoubleOperand1.LowPart = 0x0;
04302 DoubleOperand1.HighPart = 0x300000;
04303 DoubleOperand2.LowPart = 0xfffffffd;
04304 DoubleOperand2.HighPart = 0xfffff;
04305 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04306 &DoubleOperand1,
04307 &DoubleOperand2,
04308 &DoubleResult);
04309
04310
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04311 (DoubleResult.LowPart != 0xffffffff) ||
04312 (DoubleResult.HighPart != 0x33ffff)) {
04313
goto TestFailed;
04314 }
04315
04316 Subtest += 1;
04317 DoubleOperand1.LowPart = 0x0;
04318 DoubleOperand1.HighPart = 0x300000;
04319 DoubleOperand2.LowPart = 0xfffffffe;
04320 DoubleOperand2.HighPart = 0xfffff;
04321 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04322 &DoubleOperand1,
04323 &DoubleOperand2,
04324 &DoubleResult);
04325
04326
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04327 (DoubleResult.LowPart != 0x0) ||
04328 (DoubleResult.HighPart != 0x340000)) {
04329
goto TestFailed;
04330 }
04331
04332 Subtest += 1;
04333 DoubleOperand1.LowPart = 0x0;
04334 DoubleOperand1.HighPart = 0x300000;
04335 DoubleOperand2.LowPart = 0xffffffff;
04336 DoubleOperand2.HighPart = 0xfffff;
04337 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
04338 &DoubleOperand1,
04339 &DoubleOperand2,
04340 &DoubleResult);
04341
04342
if ((Fsr.
Data != (
SI | ROUND_TO_NEAREST)) ||
04343 (DoubleResult.LowPart != 0x0) ||
04344 (DoubleResult.HighPart != 0x340000)) {
04345
goto TestFailed;
04346 }
04347
04348 Subtest += 1;
04349 DoubleOperand1.LowPart = 0x0;
04350 DoubleOperand1.HighPart = 0x300000;
04351 DoubleOperand2.LowPart = 0xffffffff;
04352 DoubleOperand2.HighPart = 0xfffff;
04353
Count = 0;
04354
try {
04355 Fsr.
Data =
AddDouble(
EI | ROUND_TO_NEAREST,
04356 &DoubleOperand1,
04357 &DoubleOperand2,
04358 &DoubleResult);
04359
04360 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
04361
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04362
Count += 1;
04363 }
04364
04365
if (
Count == 0) {
04366
goto TestFailed;
04367 }
04368
04369
04370
04371
04372
04373 printf(
"succeeded\n");
04374
return;
04375
04376
04377
04378
04379
04380 TestFailed:
04381 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
04382 Subtest,
04383 Fsr.
Data,
04384 DoubleResult.LowPart,
04385 DoubleResult.HighPart);
04386
04387
return;
04388 }
04389
04390
VOID
04391 Test13 (
04392 VOID
04393 )
04394
04395 {
04396
04397 ULONG
Count;
04398 ULARGE_INTEGER DoubleOperand1;
04399 ULARGE_INTEGER DoubleOperand2;
04400 ULARGE_INTEGER DoubleResult;
04401
FLOATING_STATUS Fsr;
04402 ULONG Subtest;
04403
04404
04405
04406
04407
04408 Subtest = 0;
04409 printf(
" Test 13 - add double round to zero ...");
04410 Subtest += 1;
04411 DoubleOperand1.LowPart = 0x0;
04412 DoubleOperand1.HighPart = 0x300000;
04413 DoubleOperand2.LowPart = 0xfffffff8;
04414 DoubleOperand2.HighPart = 0xfffff;
04415 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04416 &DoubleOperand1,
04417 &DoubleOperand2,
04418 &DoubleResult);
04419
04420
if ((Fsr.
Data != ROUND_TO_ZERO) ||
04421 (DoubleResult.LowPart != 0xfffffffe) ||
04422 (DoubleResult.HighPart != 0x33ffff)) {
04423
goto TestFailed;
04424 }
04425
04426 Subtest += 1;
04427 DoubleOperand1.LowPart = 0x0;
04428 DoubleOperand1.HighPart = 0x300000;
04429 DoubleOperand2.LowPart = 0xfffffff9;
04430 DoubleOperand2.HighPart = 0xfffff;
04431 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04432 &DoubleOperand1,
04433 &DoubleOperand2,
04434 &DoubleResult);
04435
04436
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04437 (DoubleResult.LowPart != 0xfffffffe) ||
04438 (DoubleResult.HighPart != 0x33ffff)) {
04439
goto TestFailed;
04440 }
04441
04442 Subtest += 1;
04443 DoubleOperand1.LowPart = 0x0;
04444 DoubleOperand1.HighPart = 0x300000;
04445 DoubleOperand2.LowPart = 0xfffffffa;
04446 DoubleOperand2.HighPart = 0xfffff;
04447 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04448 &DoubleOperand1,
04449 &DoubleOperand2,
04450 &DoubleResult);
04451
04452
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04453 (DoubleResult.LowPart != 0xfffffffe) ||
04454 (DoubleResult.HighPart != 0x33ffff)) {
04455
goto TestFailed;
04456 }
04457
04458 Subtest += 1;
04459 DoubleOperand1.LowPart = 0x0;
04460 DoubleOperand1.HighPart = 0x300000;
04461 DoubleOperand2.LowPart = 0xfffffffb;
04462 DoubleOperand2.HighPart = 0xfffff;
04463 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04464 &DoubleOperand1,
04465 &DoubleOperand2,
04466 &DoubleResult);
04467
04468
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04469 (DoubleResult.LowPart != 0xfffffffe) ||
04470 (DoubleResult.HighPart != 0x33ffff)) {
04471
goto TestFailed;
04472 }
04473
04474 Subtest += 1;
04475 DoubleOperand1.LowPart = 0x0;
04476 DoubleOperand1.HighPart = 0x300000;
04477 DoubleOperand2.LowPart = 0xfffffffc;
04478 DoubleOperand2.HighPart = 0xfffff;
04479 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04480 &DoubleOperand1,
04481 &DoubleOperand2,
04482 &DoubleResult);
04483
04484
if ((Fsr.
Data != ROUND_TO_ZERO) ||
04485 (DoubleResult.LowPart != 0xffffffff) ||
04486 (DoubleResult.HighPart != 0x33ffff)) {
04487
goto TestFailed;
04488 }
04489
04490 Subtest += 1;
04491 DoubleOperand1.LowPart = 0x0;
04492 DoubleOperand1.HighPart = 0x300000;
04493 DoubleOperand2.LowPart = 0xfffffffd;
04494 DoubleOperand2.HighPart = 0xfffff;
04495 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04496 &DoubleOperand1,
04497 &DoubleOperand2,
04498 &DoubleResult);
04499
04500
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04501 (DoubleResult.LowPart != 0xffffffff) ||
04502 (DoubleResult.HighPart != 0x33ffff)) {
04503
goto TestFailed;
04504 }
04505
04506 Subtest += 1;
04507 DoubleOperand1.LowPart = 0x0;
04508 DoubleOperand1.HighPart = 0x300000;
04509 DoubleOperand2.LowPart = 0xfffffffe;
04510 DoubleOperand2.HighPart = 0xfffff;
04511 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04512 &DoubleOperand1,
04513 &DoubleOperand2,
04514 &DoubleResult);
04515
04516
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04517 (DoubleResult.LowPart != 0xffffffff) ||
04518 (DoubleResult.HighPart != 0x33ffff)) {
04519
goto TestFailed;
04520 }
04521
04522 Subtest += 1;
04523 DoubleOperand1.LowPart = 0x0;
04524 DoubleOperand1.HighPart = 0x300000;
04525 DoubleOperand2.LowPart = 0xffffffff;
04526 DoubleOperand2.HighPart = 0xfffff;
04527 Fsr.
Data =
AddDouble(ROUND_TO_ZERO,
04528 &DoubleOperand1,
04529 &DoubleOperand2,
04530 &DoubleResult);
04531
04532
if ((Fsr.
Data != (
SI | ROUND_TO_ZERO)) ||
04533 (DoubleResult.LowPart != 0xffffffff) ||
04534 (DoubleResult.HighPart != 0x33ffff)) {
04535
goto TestFailed;
04536 }
04537
04538 Subtest += 1;
04539 DoubleOperand1.LowPart = 0x0;
04540 DoubleOperand1.HighPart = 0x300000;
04541 DoubleOperand2.LowPart = 0xffffffff;
04542 DoubleOperand2.HighPart = 0xfffff;
04543
Count = 0;
04544
try {
04545 Fsr.
Data =
AddDouble(
EI | ROUND_TO_ZERO,
04546 &DoubleOperand1,
04547 &DoubleOperand2,
04548 &DoubleResult);
04549
04550 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
04551
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04552
Count += 1;
04553 }
04554
04555
if (
Count == 0) {
04556
goto TestFailed;
04557 }
04558
04559
04560
04561
04562
04563 printf(
"succeeded\n");
04564
return;
04565
04566
04567
04568
04569
04570 TestFailed:
04571 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
04572 Subtest,
04573 Fsr.
Data,
04574 DoubleResult.LowPart,
04575 DoubleResult.HighPart);
04576
04577
return;
04578 }
04579
04580
VOID
04581 Test14 (
04582 VOID
04583 )
04584
04585 {
04586
04587 ULONG
Count;
04588 ULARGE_INTEGER DoubleOperand1;
04589 ULARGE_INTEGER DoubleOperand2;
04590
FLOATING_STATUS Fsr;
04591 ULARGE_INTEGER DoubleResult;
04592 ULONG Subtest;
04593
04594
04595
04596
04597
04598 Subtest = 0;
04599 printf(
" Test 14 - add double round to positive infinity ...");
04600 Subtest += 1;
04601 DoubleOperand1.LowPart = 0x0;
04602 DoubleOperand1.HighPart = 0x300000;
04603 DoubleOperand2.LowPart = 0xfffffff8;
04604 DoubleOperand2.HighPart = 0xfffff;
04605 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04606 &DoubleOperand1,
04607 &DoubleOperand2,
04608 &DoubleResult);
04609
04610
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
04611 (DoubleResult.LowPart != 0xfffffffe) ||
04612 (DoubleResult.HighPart != 0x33ffff)) {
04613
goto TestFailed;
04614 }
04615
04616 Subtest += 1;
04617 DoubleOperand1.LowPart = 0x0;
04618 DoubleOperand1.HighPart = 0x300000;
04619 DoubleOperand2.LowPart = 0xfffffff9;
04620 DoubleOperand2.HighPart = 0xfffff;
04621 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04622 &DoubleOperand1,
04623 &DoubleOperand2,
04624 &DoubleResult);
04625
04626
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04627 (DoubleResult.LowPart != 0xffffffff) ||
04628 (DoubleResult.HighPart != 0x33ffff)) {
04629
goto TestFailed;
04630 }
04631
04632 Subtest += 1;
04633 DoubleOperand1.LowPart = 0x0;
04634 DoubleOperand1.HighPart = 0x300000;
04635 DoubleOperand2.LowPart = 0xfffffffa;
04636 DoubleOperand2.HighPart = 0xfffff;
04637 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04638 &DoubleOperand1,
04639 &DoubleOperand2,
04640 &DoubleResult);
04641
04642
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04643 (DoubleResult.LowPart != 0xffffffff) ||
04644 (DoubleResult.HighPart != 0x33ffff)) {
04645
goto TestFailed;
04646 }
04647
04648 Subtest += 1;
04649 DoubleOperand1.LowPart = 0x0;
04650 DoubleOperand1.HighPart = 0x300000;
04651 DoubleOperand2.LowPart = 0xfffffffb;
04652 DoubleOperand2.HighPart = 0xfffff;
04653 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04654 &DoubleOperand1,
04655 &DoubleOperand2,
04656 &DoubleResult);
04657
04658
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04659 (DoubleResult.LowPart != 0xffffffff) ||
04660 (DoubleResult.HighPart != 0x33ffff)) {
04661
goto TestFailed;
04662 }
04663
04664 Subtest += 1;
04665 DoubleOperand1.LowPart = 0x0;
04666 DoubleOperand1.HighPart = 0x300000;
04667 DoubleOperand2.LowPart = 0xfffffffc;
04668 DoubleOperand2.HighPart = 0xfffff;
04669 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04670 &DoubleOperand1,
04671 &DoubleOperand2,
04672 &DoubleResult);
04673
04674
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
04675 (DoubleResult.LowPart != 0xffffffff) ||
04676 (DoubleResult.HighPart != 0x33ffff)) {
04677
goto TestFailed;
04678 }
04679
04680 Subtest += 1;
04681 DoubleOperand1.LowPart = 0x0;
04682 DoubleOperand1.HighPart = 0x300000;
04683 DoubleOperand2.LowPart = 0xfffffffd;
04684 DoubleOperand2.HighPart = 0xfffff;
04685 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04686 &DoubleOperand1,
04687 &DoubleOperand2,
04688 &DoubleResult);
04689
04690
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04691 (DoubleResult.LowPart != 0x0) ||
04692 (DoubleResult.HighPart != 0x340000)) {
04693
goto TestFailed;
04694 }
04695
04696 Subtest += 1;
04697 DoubleOperand1.LowPart = 0x0;
04698 DoubleOperand1.HighPart = 0x300000;
04699 DoubleOperand2.LowPart = 0xfffffffe;
04700 DoubleOperand2.HighPart = 0xfffff;
04701 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04702 &DoubleOperand1,
04703 &DoubleOperand2,
04704 &DoubleResult);
04705
04706
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04707 (DoubleResult.LowPart != 0x0) ||
04708 (DoubleResult.HighPart != 0x340000)) {
04709
goto TestFailed;
04710 }
04711
04712 Subtest += 1;
04713 DoubleOperand1.LowPart = 0x0;
04714 DoubleOperand1.HighPart = 0x300000;
04715 DoubleOperand2.LowPart = 0xffffffff;
04716 DoubleOperand2.HighPart = 0xfffff;
04717 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04718 &DoubleOperand1,
04719 &DoubleOperand2,
04720 &DoubleResult);
04721
04722
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04723 (DoubleResult.LowPart != 0x0) ||
04724 (DoubleResult.HighPart != 0x340000)) {
04725
goto TestFailed;
04726 }
04727
04728 Subtest += 1;
04729 DoubleOperand1.LowPart = 0x0;
04730 DoubleOperand1.HighPart = 0x300000;
04731 DoubleOperand2.LowPart = 0xffffffff;
04732 DoubleOperand2.HighPart = 0xfffff;
04733
Count = 0;
04734
try {
04735 Fsr.
Data =
AddDouble(
EI | ROUND_TO_PLUS_INFINITY,
04736 &DoubleOperand1,
04737 &DoubleOperand2,
04738 &DoubleResult);
04739
04740 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
04741
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
04742
Count += 1;
04743 }
04744
04745
if (
Count == 0) {
04746
goto TestFailed;
04747 }
04748
04749 Subtest += 1;
04750 DoubleOperand1.LowPart = 0x0;
04751 DoubleOperand1.HighPart =
SIGN | 0x300000;
04752 DoubleOperand2.LowPart = 0xfffffff8;
04753 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04754 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04755 &DoubleOperand1,
04756 &DoubleOperand2,
04757 &DoubleResult);
04758
04759
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
04760 (DoubleResult.LowPart != 0xfffffffe) ||
04761 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04762
goto TestFailed;
04763 }
04764
04765 Subtest += 1;
04766 DoubleOperand1.LowPart = 0x0;
04767 DoubleOperand1.HighPart =
SIGN | 0x300000;
04768 DoubleOperand2.LowPart = 0xfffffff9;
04769 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04770 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04771 &DoubleOperand1,
04772 &DoubleOperand2,
04773 &DoubleResult);
04774
04775
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04776 (DoubleResult.LowPart != 0xfffffffe) ||
04777 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04778
goto TestFailed;
04779 }
04780
04781 Subtest += 1;
04782 DoubleOperand1.LowPart = 0x0;
04783 DoubleOperand1.HighPart =
SIGN | 0x300000;
04784 DoubleOperand2.LowPart = 0xfffffffa;
04785 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04786 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04787 &DoubleOperand1,
04788 &DoubleOperand2,
04789 &DoubleResult);
04790
04791
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04792 (DoubleResult.LowPart != 0xfffffffe) ||
04793 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04794
goto TestFailed;
04795 }
04796
04797 Subtest += 1;
04798 DoubleOperand1.LowPart = 0x0;
04799 DoubleOperand1.HighPart =
SIGN | 0x300000;
04800 DoubleOperand2.LowPart = 0xfffffffb;
04801 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04802 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04803 &DoubleOperand1,
04804 &DoubleOperand2,
04805 &DoubleResult);
04806
04807
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04808 (DoubleResult.LowPart != 0xfffffffe) ||
04809 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04810
goto TestFailed;
04811 }
04812
04813 Subtest += 1;
04814 DoubleOperand1.LowPart = 0x0;
04815 DoubleOperand1.HighPart =
SIGN | 0x300000;
04816 DoubleOperand2.LowPart = 0xfffffffc;
04817 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04818 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04819 &DoubleOperand1,
04820 &DoubleOperand2,
04821 &DoubleResult);
04822
04823
if ((Fsr.
Data != ROUND_TO_PLUS_INFINITY) ||
04824 (DoubleResult.LowPart != 0xffffffff) ||
04825 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04826
goto TestFailed;
04827 }
04828
04829 Subtest += 1;
04830 DoubleOperand1.LowPart = 0x0;
04831 DoubleOperand1.HighPart =
SIGN | 0x300000;
04832 DoubleOperand2.LowPart = 0xfffffffd;
04833 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04834 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04835 &DoubleOperand1,
04836 &DoubleOperand2,
04837 &DoubleResult);
04838
04839
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04840 (DoubleResult.LowPart != 0xffffffff) ||
04841 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04842
goto TestFailed;
04843 }
04844
04845 Subtest += 1;
04846 DoubleOperand1.LowPart = 0x0;
04847 DoubleOperand1.HighPart =
SIGN | 0x300000;
04848 DoubleOperand2.LowPart = 0xfffffffe;
04849 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04850 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04851 &DoubleOperand1,
04852 &DoubleOperand2,
04853 &DoubleResult);
04854
04855
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04856 (DoubleResult.LowPart != 0xffffffff) ||
04857 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04858
goto TestFailed;
04859 }
04860
04861 Subtest += 1;
04862 DoubleOperand1.LowPart = 0x0;
04863 DoubleOperand1.HighPart =
SIGN | 0x300000;
04864 DoubleOperand2.LowPart = 0xffffffff;
04865 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04866 Fsr.
Data =
AddDouble(ROUND_TO_PLUS_INFINITY,
04867 &DoubleOperand1,
04868 &DoubleOperand2,
04869 &DoubleResult);
04870
04871
if ((Fsr.
Data != (
SI | ROUND_TO_PLUS_INFINITY)) ||
04872 (DoubleResult.LowPart != 0xffffffff) ||
04873 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04874
goto TestFailed;
04875 }
04876
04877
04878
04879
04880
04881 printf(
"succeeded\n");
04882
return;
04883
04884
04885
04886
04887
04888 TestFailed:
04889 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
04890 Subtest,
04891 Fsr.
Data,
04892 DoubleResult.LowPart,
04893 DoubleResult.HighPart);
04894
04895
return;
04896 }
04897
04898
VOID
04899 Test15 (
04900 VOID
04901 )
04902
04903 {
04904
04905 ULONG
Count;
04906 ULARGE_INTEGER DoubleOperand1;
04907 ULARGE_INTEGER DoubleOperand2;
04908 ULARGE_INTEGER DoubleResult;
04909
FLOATING_STATUS Fsr;
04910 ULONG Subtest;
04911
04912
04913
04914
04915
04916 Subtest = 0;
04917 printf(
" Test 15 - add double round to negative infinity ...");
04918 Subtest += 1;
04919 DoubleOperand1.LowPart = 0x0;
04920 DoubleOperand1.HighPart =
SIGN | 0x300000;
04921 DoubleOperand2.LowPart = 0xfffffff8;
04922 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04923 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
04924 &DoubleOperand1,
04925 &DoubleOperand2,
04926 &DoubleResult);
04927
04928
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
04929 (DoubleResult.LowPart != 0xfffffffe) ||
04930 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04931
goto TestFailed;
04932 }
04933
04934 Subtest += 1;
04935 DoubleOperand1.LowPart = 0x0;
04936 DoubleOperand1.HighPart =
SIGN | 0x300000;
04937 DoubleOperand2.LowPart = 0xfffffff9;
04938 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04939 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
04940 &DoubleOperand1,
04941 &DoubleOperand2,
04942 &DoubleResult);
04943
04944
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
04945 (DoubleResult.LowPart != 0xffffffff) ||
04946 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04947
goto TestFailed;
04948 }
04949
04950 Subtest += 1;
04951 DoubleOperand1.LowPart = 0x0;
04952 DoubleOperand1.HighPart =
SIGN | 0x300000;
04953 DoubleOperand2.LowPart = 0xfffffffa;
04954 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04955 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
04956 &DoubleOperand1,
04957 &DoubleOperand2,
04958 &DoubleResult);
04959
04960
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
04961 (DoubleResult.LowPart != 0xffffffff) ||
04962 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04963
goto TestFailed;
04964 }
04965
04966 Subtest += 1;
04967 DoubleOperand1.LowPart = 0x0;
04968 DoubleOperand1.HighPart =
SIGN | 0x300000;
04969 DoubleOperand2.LowPart = 0xfffffffb;
04970 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04971 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
04972 &DoubleOperand1,
04973 &DoubleOperand2,
04974 &DoubleResult);
04975
04976
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
04977 (DoubleResult.LowPart != 0xffffffff) ||
04978 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04979
goto TestFailed;
04980 }
04981
04982 Subtest += 1;
04983 DoubleOperand1.LowPart = 0x0;
04984 DoubleOperand1.HighPart =
SIGN | 0x300000;
04985 DoubleOperand2.LowPart = 0xfffffffc;
04986 DoubleOperand2.HighPart =
SIGN | 0xfffff;
04987 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
04988 &DoubleOperand1,
04989 &DoubleOperand2,
04990 &DoubleResult);
04991
04992
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
04993 (DoubleResult.LowPart != 0xffffffff) ||
04994 (DoubleResult.HighPart != (
SIGN | 0x33ffff))) {
04995
goto TestFailed;
04996 }
04997
04998 Subtest += 1;
04999 DoubleOperand1.LowPart = 0x0;
05000 DoubleOperand1.HighPart =
SIGN | 0x300000;
05001 DoubleOperand2.LowPart = 0xfffffffd;
05002 DoubleOperand2.HighPart =
SIGN | 0xfffff;
05003 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05004 &DoubleOperand1,
05005 &DoubleOperand2,
05006 &DoubleResult);
05007
05008
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05009 (DoubleResult.LowPart != 0x0) ||
05010 (DoubleResult.HighPart != (
SIGN | 0x340000))) {
05011
goto TestFailed;
05012 }
05013
05014 Subtest += 1;
05015 DoubleOperand1.LowPart = 0x0;
05016 DoubleOperand1.HighPart =
SIGN | 0x300000;
05017 DoubleOperand2.LowPart = 0xfffffffe;
05018 DoubleOperand2.HighPart =
SIGN | 0xfffff;
05019 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05020 &DoubleOperand1,
05021 &DoubleOperand2,
05022 &DoubleResult);
05023
05024
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05025 (DoubleResult.LowPart != 0x0) ||
05026 (DoubleResult.HighPart != (
SIGN | 0x340000))) {
05027
goto TestFailed;
05028 }
05029
05030 Subtest += 1;
05031 DoubleOperand1.LowPart = 0x0;
05032 DoubleOperand1.HighPart =
SIGN | 0x300000;
05033 DoubleOperand2.LowPart = 0xffffffff;
05034 DoubleOperand2.HighPart =
SIGN | 0xfffff;
05035 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05036 &DoubleOperand1,
05037 &DoubleOperand2,
05038 &DoubleResult);
05039
05040
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05041 (DoubleResult.LowPart != 0x0) ||
05042 (DoubleResult.HighPart != (
SIGN | 0x340000))) {
05043
goto TestFailed;
05044 }
05045
05046 Subtest += 1;
05047 DoubleOperand1.LowPart = 0x0;
05048 DoubleOperand1.HighPart =
SIGN | 0x300000;
05049 DoubleOperand2.LowPart = 0xffffffff;
05050 DoubleOperand2.HighPart =
SIGN | 0xfffff;
05051
Count = 0;
05052
try {
05053 Fsr.
Data =
AddDouble(
EI | ROUND_TO_MINUS_INFINITY,
05054 &DoubleOperand1,
05055 &DoubleOperand2,
05056 &DoubleResult);
05057
05058 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
05059
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05060
Count += 1;
05061 }
05062
05063
if (
Count == 0) {
05064
goto TestFailed;
05065 }
05066
05067 Subtest += 1;
05068 DoubleOperand1.LowPart = 0x0;
05069 DoubleOperand1.HighPart = 0x300000;
05070 DoubleOperand2.LowPart = 0xfffffff8;
05071 DoubleOperand2.HighPart = 0xfffff;
05072 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05073 &DoubleOperand1,
05074 &DoubleOperand2,
05075 &DoubleResult);
05076
05077
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
05078 (DoubleResult.LowPart != 0xfffffffe) ||
05079 (DoubleResult.HighPart != 0x33ffff)) {
05080
goto TestFailed;
05081 }
05082
05083 Subtest += 1;
05084 DoubleOperand1.LowPart = 0x0;
05085 DoubleOperand1.HighPart = 0x300000;
05086 DoubleOperand2.LowPart = 0xfffffff9;
05087 DoubleOperand2.HighPart = 0xfffff;
05088 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05089 &DoubleOperand1,
05090 &DoubleOperand2,
05091 &DoubleResult);
05092
05093
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05094 (DoubleResult.LowPart != 0xfffffffe) ||
05095 (DoubleResult.HighPart != 0x33ffff)) {
05096
goto TestFailed;
05097 }
05098
05099 Subtest += 1;
05100 DoubleOperand1.LowPart = 0x0;
05101 DoubleOperand1.HighPart = 0x300000;
05102 DoubleOperand2.LowPart = 0xfffffffa;
05103 DoubleOperand2.HighPart = 0xfffff;
05104 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05105 &DoubleOperand1,
05106 &DoubleOperand2,
05107 &DoubleResult);
05108
05109
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05110 (DoubleResult.LowPart != 0xfffffffe) ||
05111 (DoubleResult.HighPart != 0x33ffff)) {
05112
goto TestFailed;
05113 }
05114
05115 Subtest += 1;
05116 DoubleOperand1.LowPart = 0x0;
05117 DoubleOperand1.HighPart = 0x300000;
05118 DoubleOperand2.LowPart = 0xfffffffb;
05119 DoubleOperand2.HighPart = 0xfffff;
05120 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05121 &DoubleOperand1,
05122 &DoubleOperand2,
05123 &DoubleResult);
05124
05125
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05126 (DoubleResult.LowPart != 0xfffffffe) ||
05127 (DoubleResult.HighPart != 0x33ffff)) {
05128
goto TestFailed;
05129 }
05130
05131 Subtest += 1;
05132 DoubleOperand1.LowPart = 0x0;
05133 DoubleOperand1.HighPart = 0x300000;
05134 DoubleOperand2.LowPart = 0xfffffffc;
05135 DoubleOperand2.HighPart = 0xfffff;
05136 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05137 &DoubleOperand1,
05138 &DoubleOperand2,
05139 &DoubleResult);
05140
05141
if ((Fsr.
Data != ROUND_TO_MINUS_INFINITY) ||
05142 (DoubleResult.LowPart != 0xffffffff) ||
05143 (DoubleResult.HighPart != 0x33ffff)) {
05144
goto TestFailed;
05145 }
05146
05147 Subtest += 1;
05148 DoubleOperand1.LowPart = 0x0;
05149 DoubleOperand1.HighPart = 0x300000;
05150 DoubleOperand2.LowPart = 0xfffffffd;
05151 DoubleOperand2.HighPart = 0xfffff;
05152 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05153 &DoubleOperand1,
05154 &DoubleOperand2,
05155 &DoubleResult);
05156
05157
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05158 (DoubleResult.LowPart != 0xffffffff) ||
05159 (DoubleResult.HighPart != 0x33ffff)) {
05160
goto TestFailed;
05161 }
05162
05163 Subtest += 1;
05164 DoubleOperand1.LowPart = 0x0;
05165 DoubleOperand1.HighPart = 0x300000;
05166 DoubleOperand2.LowPart = 0xfffffffe;
05167 DoubleOperand2.HighPart = 0xfffff;
05168 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05169 &DoubleOperand1,
05170 &DoubleOperand2,
05171 &DoubleResult);
05172
05173
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05174 (DoubleResult.LowPart != 0xffffffff) ||
05175 (DoubleResult.HighPart != 0x33ffff)) {
05176
goto TestFailed;
05177 }
05178
05179 Subtest += 1;
05180 DoubleOperand1.LowPart = 0x0;
05181 DoubleOperand1.HighPart = 0x300000;
05182 DoubleOperand2.LowPart = 0xffffffff;
05183 DoubleOperand2.HighPart = 0xfffff;
05184 Fsr.
Data =
AddDouble(ROUND_TO_MINUS_INFINITY,
05185 &DoubleOperand1,
05186 &DoubleOperand2,
05187 &DoubleResult);
05188
05189
if ((Fsr.
Data != (
SI | ROUND_TO_MINUS_INFINITY)) ||
05190 (DoubleResult.LowPart != 0xffffffff) ||
05191 (DoubleResult.HighPart != 0x33ffff)) {
05192
goto TestFailed;
05193 }
05194
05195
05196
05197
05198
05199 printf(
"succeeded\n");
05200
return;
05201
05202
05203
05204
05205
05206 TestFailed:
05207 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
05208 Subtest,
05209 Fsr.
Data,
05210 DoubleResult.LowPart,
05211 DoubleResult.HighPart);
05212
05213
return;
05214 }
05215
05216
VOID
05217 Test16 (
05218 VOID
05219 )
05220
05221 {
05222
05223 ULONG
Count;
05224 ULARGE_INTEGER DoubleOperand1;
05225 ULARGE_INTEGER DoubleOperand2;
05226 ULARGE_INTEGER DoubleResult;
05227
FLOATING_STATUS Fsr;
05228 ULONG Subtest;
05229
05230
05231
05232
05233
05234 Subtest = 0;
05235 printf(
" Test 16 - add double infinity and NaN ...");
05236
05237 Subtest += 1;
05238 DoubleOperand1.LowPart = 0x0;
05239 DoubleOperand1.HighPart = 0x40000;
05240 DoubleOperand2.LowPart = 0x0;
05241 DoubleOperand2.HighPart = 0x40000;
05242 Fsr.
Data =
AddDouble(
FS | ROUND_TO_NEAREST,
05243 &DoubleOperand1,
05244 &DoubleOperand2,
05245 &DoubleResult);
05246
05247
if ((Fsr.
Data != (
FS | ROUND_TO_NEAREST)) ||
05248 (DoubleResult.LowPart != 0x0) ||
05249 (DoubleResult.HighPart != 0x0)) {
05250
goto TestFailed;
05251 }
05252
05253 Subtest += 1;
05254 DoubleOperand1.LowPart = 0x0;
05255 DoubleOperand1.HighPart = 0x80000;
05256 DoubleOperand2.LowPart = 0x0;
05257 DoubleOperand2.HighPart =
DOUBLE_SIGNAL_NAN_PREFIX;
05258 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05259 &DoubleOperand1,
05260 &DoubleOperand2,
05261 &DoubleResult);
05262
05263
if ((Fsr.
Data != (
SV | ROUND_TO_NEAREST)) ||
05264 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05265 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05266
goto TestFailed;
05267 }
05268
05269 Subtest += 1;
05270 DoubleOperand1.LowPart = 0x0;
05271 DoubleOperand1.HighPart =
DOUBLE_SIGNAL_NAN_PREFIX;
05272 DoubleOperand2.LowPart = 0x0;
05273 DoubleOperand2.HighPart = 0x80000;
05274 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05275 &DoubleOperand1,
05276 &DoubleOperand2,
05277 &DoubleResult);
05278
05279
if ((Fsr.
Data != (
SV | ROUND_TO_NEAREST)) ||
05280 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05281 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05282
goto TestFailed;
05283 }
05284
05285 Subtest += 1;
05286 DoubleOperand1.LowPart = 0x0;
05287 DoubleOperand1.HighPart = 0x80000;
05288 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05289 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05290 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05291 &DoubleOperand1,
05292 &DoubleOperand2,
05293 &DoubleResult);
05294
05295
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05296 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05297 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05298
goto TestFailed;
05299 }
05300
05301 Subtest += 1;
05302 DoubleOperand1.LowPart = 0x0;
05303 DoubleOperand1.HighPart =
SIGN | 0x80000;
05304 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05305 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05306 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05307 &DoubleOperand1,
05308 &DoubleOperand2,
05309 &DoubleResult);
05310
05311
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05312 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05313 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05314
goto TestFailed;
05315 }
05316
05317 Subtest += 1;
05318 DoubleOperand1.LowPart = 0x0;
05319 DoubleOperand1.HighPart = 0x80000;
05320 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05321 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05322 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05323 &DoubleOperand1,
05324 &DoubleOperand2,
05325 &DoubleResult);
05326
05327
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05328 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05329 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05330
goto TestFailed;
05331 }
05332
05333 Subtest += 1;
05334 DoubleOperand1.LowPart = 0x0;
05335 DoubleOperand1.HighPart =
SIGN | 0x80000;
05336 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05337 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05338 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05339 &DoubleOperand1,
05340 &DoubleOperand2,
05341 &DoubleResult);
05342
05343
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05344 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05345 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05346
goto TestFailed;
05347 }
05348
05349 Subtest += 1;
05350 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05351 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05352 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05353 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05354 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05355 &DoubleOperand1,
05356 &DoubleOperand2,
05357 &DoubleResult);
05358
05359
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05360 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05361 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05362
goto TestFailed;
05363 }
05364
05365 Subtest += 1;
05366 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05367 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05368 DoubleOperand2.LowPart = 0x0;
05369 DoubleOperand2.HighPart = 0x3ff00000;
05370 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05371 &DoubleOperand1,
05372 &DoubleOperand2,
05373 &DoubleResult);
05374
05375
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05376 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05377 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05378
goto TestFailed;
05379 }
05380
05381 Subtest += 1;
05382 DoubleOperand1.LowPart = 0x0;
05383 DoubleOperand1.HighPart = 0x3ff00000;
05384 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05385 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05386 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05387 &DoubleOperand1,
05388 &DoubleOperand2,
05389 &DoubleResult);
05390
05391
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05392 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05393 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05394
goto TestFailed;
05395 }
05396
05397 Subtest += 1;
05398 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05399 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05400 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05401 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05402 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05403 &DoubleOperand1,
05404 &DoubleOperand2,
05405 &DoubleResult);
05406
05407
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05408 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05409 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05410
goto TestFailed;
05411 }
05412
05413 Subtest += 1;
05414 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05415 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05416 DoubleOperand2.LowPart = 0x0;
05417 DoubleOperand2.HighPart = 0x3ff00000;
05418 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05419 &DoubleOperand1,
05420 &DoubleOperand2,
05421 &DoubleResult);
05422
05423
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05424 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05425 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05426
goto TestFailed;
05427 }
05428
05429 Subtest += 1;
05430 DoubleOperand1.LowPart = 0x0;
05431 DoubleOperand1.HighPart = 0x3ff00000;
05432 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05433 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05434 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05435 &DoubleOperand1,
05436 &DoubleOperand2,
05437 &DoubleResult);
05438
05439
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05440 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05441 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05442
goto TestFailed;
05443 }
05444
05445 Subtest += 1;
05446 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05447 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05448 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05449 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05450 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05451 &DoubleOperand1,
05452 &DoubleOperand2,
05453 &DoubleResult);
05454
05455
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05456 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05457 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05458
goto TestFailed;
05459 }
05460
05461 Subtest += 1;
05462 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05463 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05464 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05465 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05466 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05467 &DoubleOperand1,
05468 &DoubleOperand2,
05469 &DoubleResult);
05470
05471
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05472 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05473 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05474
goto TestFailed;
05475 }
05476
05477 Subtest += 1;
05478 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05479 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05480 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05481 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05482 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05483 &DoubleOperand1,
05484 &DoubleOperand2,
05485 &DoubleResult);
05486
05487
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05488 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05489 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05490
goto TestFailed;
05491 }
05492
05493 Subtest += 1;
05494 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05495 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05496 DoubleOperand2.LowPart = 0x0;
05497 DoubleOperand2.HighPart = 0x3ff00000;
05498 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05499 &DoubleOperand1,
05500 &DoubleOperand2,
05501 &DoubleResult);
05502
05503
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05504 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05505 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05506
goto TestFailed;
05507 }
05508
05509 Subtest += 1;
05510 DoubleOperand1.LowPart = 0x0;
05511 DoubleOperand1.HighPart = 0x3ff00000;
05512 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05513 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05514 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05515 &DoubleOperand1,
05516 &DoubleOperand2,
05517 &DoubleResult);
05518
05519
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05520 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05521 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05522
goto TestFailed;
05523 }
05524
05525 Subtest += 1;
05526 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05527 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
05528 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05529 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
05530 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05531 &DoubleOperand1,
05532 &DoubleOperand2,
05533 &DoubleResult);
05534
05535
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05536 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05537 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05538
goto TestFailed;
05539 }
05540
05541 Subtest += 1;
05542 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05543 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
05544 DoubleOperand2.LowPart = 0x0;
05545 DoubleOperand2.HighPart = 0x3ff00000;
05546 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05547 &DoubleOperand1,
05548 &DoubleOperand2,
05549 &DoubleResult);
05550
05551
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05552 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05553 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05554
goto TestFailed;
05555 }
05556
05557 Subtest += 1;
05558 DoubleOperand1.LowPart = 0x0;
05559 DoubleOperand1.HighPart = 0x3ff00000;
05560 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05561 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
05562 Fsr.
Data =
AddDouble(ROUND_TO_NEAREST,
05563 &DoubleOperand1,
05564 &DoubleOperand2,
05565 &DoubleResult);
05566
05567
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05568 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05569 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05570
goto TestFailed;
05571 }
05572
05573 Subtest += 1;
05574 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05575 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05576 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05577 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05578
try {
05579 Fsr.
Data =
AddDouble(
EV | ROUND_TO_NEAREST,
05580 &DoubleOperand1,
05581 &DoubleOperand2,
05582 &DoubleResult);
05583
05584 } except (
EXCEPTION_EXECUTE_HANDLER) {
05585
goto TestFailed;
05586 }
05587
05588
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
05589 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05590 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05591
goto TestFailed;
05592 }
05593
05594 Subtest += 1;
05595 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05596 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05597 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05598 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
05599
Count = 0;
05600
try {
05601 Fsr.
Data =
AddDouble(
EV | ROUND_TO_NEAREST,
05602 &DoubleOperand1,
05603 &DoubleOperand2,
05604 &DoubleResult);
05605
05606 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05607
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05608
Count += 1;
05609 }
05610
05611
if (
Count != 1) {
05612
goto TestFailed;
05613 }
05614
05615 Subtest += 1;
05616 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05617 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
05618 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05619 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05620
Count = 0;
05621
try {
05622 Fsr.
Data =
AddDouble(
EV | ROUND_TO_NEAREST,
05623 &DoubleOperand1,
05624 &DoubleOperand2,
05625 &DoubleResult);
05626
05627 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05628
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05629
Count += 1;
05630 }
05631
05632
if (
Count != 1) {
05633
goto TestFailed;
05634 }
05635
05636 Subtest += 1;
05637 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05638 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05639 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05640 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05641
Count = 0;
05642
try {
05643 Fsr.
Data =
AddDouble(
EV | ROUND_TO_NEAREST,
05644 &DoubleOperand1,
05645 &DoubleOperand2,
05646 &DoubleResult);
05647
05648 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05649
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05650
Count += 1;
05651 }
05652
05653
if (
Count != 1) {
05654
goto TestFailed;
05655 }
05656
05657
05658
05659
05660
05661 printf(
"succeeded\n");
05662
return;
05663
05664
05665
05666
05667
05668 TestFailed:
05669 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
05670 Subtest,
05671 Fsr.
Data,
05672 DoubleResult.LowPart,
05673 DoubleResult.HighPart);
05674
05675
return;
05676 }
05677
05678
VOID
05679 Test17 (
05680 VOID
05681 )
05682
05683 {
05684
05685 ULONG
Count;
05686 ULARGE_INTEGER DoubleOperand1;
05687 ULARGE_INTEGER DoubleOperand2;
05688 ULARGE_INTEGER DoubleResult;
05689
FLOATING_STATUS Fsr;
05690 ULONG Subtest;
05691
05692
05693
05694
05695
05696 Subtest = 0;
05697 printf(
" Test 17 - multiply double ...");
05698 Subtest += 1;
05699 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05700 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05701 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05702 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05703 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05704 &DoubleOperand1,
05705 &DoubleOperand2,
05706 &DoubleResult);
05707
05708
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05709 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05710 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05711
goto TestFailed;
05712 }
05713
05714 Subtest += 1;
05715 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05716 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05717 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05718 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05719 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05720 &DoubleOperand1,
05721 &DoubleOperand2,
05722 &DoubleResult);
05723
05724
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05725 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05726 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05727
goto TestFailed;
05728 }
05729
05730 Subtest += 1;
05731 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05732 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05733 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05734 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05735 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05736 &DoubleOperand1,
05737 &DoubleOperand2,
05738 &DoubleResult);
05739
05740
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05741 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05742 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
05743
goto TestFailed;
05744 }
05745
05746 Subtest += 1;
05747 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05748 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05749 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05750 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05751 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05752 &DoubleOperand1,
05753 &DoubleOperand2,
05754 &DoubleResult);
05755
05756
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
05757 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
05758 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
05759
goto TestFailed;
05760 }
05761
05762 Subtest += 1;
05763 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05764 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05765 DoubleOperand2.LowPart = 0x0;
05766 DoubleOperand2.HighPart = 0x0;
05767 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05768 &DoubleOperand1,
05769 &DoubleOperand2,
05770 &DoubleResult);
05771
05772
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05773 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05774 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05775
goto TestFailed;
05776 }
05777
05778 Subtest += 1;
05779 DoubleOperand1.LowPart = 0x0;
05780 DoubleOperand1.HighPart = 0x0;
05781 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05782 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05783 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05784 &DoubleOperand1,
05785 &DoubleOperand2,
05786 &DoubleResult);
05787
05788
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05789 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05790 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05791
goto TestFailed;
05792 }
05793
05794 Subtest += 1;
05795 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05796 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05797 DoubleOperand2.LowPart = 0x0;
05798 DoubleOperand2.HighPart = 0x0;
05799 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05800 &DoubleOperand1,
05801 &DoubleOperand2,
05802 &DoubleResult);
05803
05804
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05805 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05806 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05807
goto TestFailed;
05808 }
05809
05810 Subtest += 1;
05811 DoubleOperand1.LowPart = 0x0;
05812 DoubleOperand1.HighPart = 0x0;
05813 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05814 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05815 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05816 &DoubleOperand1,
05817 &DoubleOperand2,
05818 &DoubleResult);
05819
05820
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05821 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05822 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05823
goto TestFailed;
05824 }
05825
05826 Subtest += 1;
05827 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05828 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05829 DoubleOperand2.LowPart = 0x0;
05830 DoubleOperand2.HighPart = 0x0;
05831
Count = 0;
05832
try {
05833 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
05834 &DoubleOperand1,
05835 &DoubleOperand2,
05836 &DoubleResult);
05837
05838 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05839
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05840
Count += 1;
05841 }
05842
05843
if (
Count == 0) {
05844
goto TestFailed;
05845 }
05846
05847 Subtest += 1;
05848 DoubleOperand1.LowPart = 0x0;
05849 DoubleOperand1.HighPart = 0x0;
05850 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05851 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
05852
Count = 0;
05853
try {
05854 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
05855 &DoubleOperand1,
05856 &DoubleOperand2,
05857 &DoubleResult);
05858
05859 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05860
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05861
Count += 1;
05862 }
05863
05864
if (
Count == 0) {
05865
goto TestFailed;
05866 }
05867
05868 Subtest += 1;
05869 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05870 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05871 DoubleOperand2.LowPart = 0x0;
05872 DoubleOperand2.HighPart = 0x0;
05873
Count = 0;
05874
try {
05875 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
05876 &DoubleOperand1,
05877 &DoubleOperand2,
05878 &DoubleResult);
05879
05880 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05881
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05882
Count += 1;
05883 }
05884
05885
if (
Count == 0) {
05886
goto TestFailed;
05887 }
05888
05889 Subtest += 1;
05890 DoubleOperand1.LowPart = 0x0;
05891 DoubleOperand1.HighPart = 0x0;
05892 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
05893 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
05894
Count = 0;
05895
try {
05896 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
05897 &DoubleOperand1,
05898 &DoubleOperand2,
05899 &DoubleResult);
05900
05901 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
05902
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
05903
Count += 1;
05904 }
05905
05906
if (
Count == 0) {
05907
goto TestFailed;
05908 }
05909
05910 Subtest += 1;
05911 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05912 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05913 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05914 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05915 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05916 &DoubleOperand1,
05917 &DoubleOperand2,
05918 &DoubleResult);
05919
05920
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05921 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05922 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05923
goto TestFailed;
05924 }
05925
05926 Subtest += 1;
05927 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05928 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
05929 DoubleOperand2.LowPart = 0x0;
05930 DoubleOperand2.HighPart = 0x3ff00000;
05931 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05932 &DoubleOperand1,
05933 &DoubleOperand2,
05934 &DoubleResult);
05935
05936
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05937 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05938 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05939
goto TestFailed;
05940 }
05941
05942 Subtest += 1;
05943 DoubleOperand1.LowPart = 0x0;
05944 DoubleOperand1.HighPart = 0x3ff00000;
05945 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05946 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
05947 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05948 &DoubleOperand1,
05949 &DoubleOperand2,
05950 &DoubleResult);
05951
05952
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
05953 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05954 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05955
goto TestFailed;
05956 }
05957
05958 Subtest += 1;
05959 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05960 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
05961 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05962 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
05963 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05964 &DoubleOperand1,
05965 &DoubleOperand2,
05966 &DoubleResult);
05967
05968
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05969 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05970 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05971
goto TestFailed;
05972 }
05973
05974 Subtest += 1;
05975 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
05976 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
05977 DoubleOperand2.LowPart = 0x0;
05978 DoubleOperand2.HighPart = 0x3ff00000;
05979 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05980 &DoubleOperand1,
05981 &DoubleOperand2,
05982 &DoubleResult);
05983
05984
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
05985 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
05986 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
05987
goto TestFailed;
05988 }
05989
05990 Subtest += 1;
05991 DoubleOperand1.LowPart = 0x0;
05992 DoubleOperand1.HighPart = 0x3ff00000;
05993 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
05994 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
05995 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
05996 &DoubleOperand1,
05997 &DoubleOperand2,
05998 &DoubleResult);
05999
06000
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06001 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06002 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06003
goto TestFailed;
06004 }
06005
06006 Subtest += 1;
06007 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
06008 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
06009 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
06010 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
06011
try {
06012 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
06013 &DoubleOperand1,
06014 &DoubleOperand2,
06015 &DoubleResult);
06016
06017 } except (
EXCEPTION_EXECUTE_HANDLER) {
06018
goto TestFailed;
06019 }
06020
06021
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
06022 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06023 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06024
goto TestFailed;
06025 }
06026
06027 Subtest += 1;
06028 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
06029 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
06030 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
06031 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
06032
Count = 0;
06033
try {
06034 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
06035 &DoubleOperand1,
06036 &DoubleOperand2,
06037 &DoubleResult);
06038
06039 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
06040
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06041
Count += 1;
06042 }
06043
06044
if (
Count != 1) {
06045
goto TestFailed;
06046 }
06047
06048 Subtest += 1;
06049 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
06050 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
06051 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
06052 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
06053
Count = 0;
06054
try {
06055 Fsr.
Data =
MultiplyDouble(
EV | ROUND_TO_NEAREST,
06056 &DoubleOperand1,
06057 &DoubleOperand2,
06058 &DoubleResult);
06059
06060 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
06061
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06062
Count += 1;
06063 }
06064
06065
if (
Count != 1) {
06066
goto TestFailed;
06067 }
06068
06069 Subtest += 1;
06070 DoubleOperand1.LowPart = 0x0;
06071 DoubleOperand1.HighPart = 0x7fe00000;
06072 DoubleOperand2.LowPart = 0x0;
06073 DoubleOperand2.HighPart = 0x80000;
06074 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06075 &DoubleOperand1,
06076 &DoubleOperand2,
06077 &DoubleResult);
06078
06079
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06080 (DoubleResult.LowPart != 0x0) ||
06081 (DoubleResult.HighPart != 0x3ff00000)) {
06082
goto TestFailed;
06083 }
06084
06085 Subtest += 1;
06086 DoubleOperand1.LowPart = 0x0;
06087 DoubleOperand1.HighPart = 0x80000;
06088 DoubleOperand2.LowPart = 0x0;
06089 DoubleOperand2.HighPart = 0x7fe00000;
06090 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06091 &DoubleOperand1,
06092 &DoubleOperand2,
06093 &DoubleResult);
06094
06095
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06096 (DoubleResult.LowPart != 0x0) ||
06097 (DoubleResult.HighPart != 0x3ff00000)) {
06098
goto TestFailed;
06099 }
06100
06101 Subtest += 1;
06102 DoubleOperand1.LowPart = 0x0;
06103 DoubleOperand1.HighPart = 0x7fe00000;
06104 DoubleOperand2.LowPart = 0x0;
06105 DoubleOperand2.HighPart =
SIGN | 0x80000;
06106 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06107 &DoubleOperand1,
06108 &DoubleOperand2,
06109 &DoubleResult);
06110
06111
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06112 (DoubleResult.LowPart != 0x0) ||
06113 (DoubleResult.HighPart != (
SIGN | 0x3ff00000))) {
06114
goto TestFailed;
06115 }
06116
06117 Subtest += 1;
06118 DoubleOperand1.LowPart = 0x0;
06119 DoubleOperand1.HighPart = 0x80000;
06120 DoubleOperand2.LowPart = 0x0;
06121 DoubleOperand2.HighPart =
SIGN | 0x7fe00000;
06122 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06123 &DoubleOperand1,
06124 &DoubleOperand2,
06125 &DoubleResult);
06126
06127
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06128 (DoubleResult.LowPart != 0x0) ||
06129 (DoubleResult.HighPart != (
SIGN | 0x3ff00000))) {
06130
goto TestFailed;
06131 }
06132
06133 Subtest += 1;
06134 DoubleOperand1.LowPart = 0x0;
06135 DoubleOperand1.HighPart = 0x80008;
06136 DoubleOperand2.LowPart = 0x0;
06137 DoubleOperand2.HighPart = 0x7fe00001;
06138 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06139 &DoubleOperand1,
06140 &DoubleOperand2,
06141 &DoubleResult);
06142
06143
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06144 (DoubleResult.LowPart != 0x10000) ||
06145 (DoubleResult.HighPart != 0x3ff00011)) {
06146
goto TestFailed;
06147 }
06148
06149 Subtest += 1;
06150 DoubleOperand1.LowPart = 0x0;
06151 DoubleOperand1.HighPart = 0x80008;
06152 DoubleOperand2.LowPart = 0x0;
06153 DoubleOperand2.HighPart =
SIGN | 0x7fe00001;
06154 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06155 &DoubleOperand1,
06156 &DoubleOperand2,
06157 &DoubleResult);
06158
06159
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06160 (DoubleResult.LowPart != 0x10000) ||
06161 (DoubleResult.HighPart != (
SIGN | 0x3ff00011))) {
06162
goto TestFailed;
06163 }
06164
06165 Subtest += 1;
06166 DoubleOperand1.LowPart = 0x0;
06167 DoubleOperand1.HighPart = 0x80008;
06168 DoubleOperand2.LowPart = 0x1;
06169 DoubleOperand2.HighPart = 0x7fe00001;
06170
Count = 0;
06171
try {
06172 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06173 &DoubleOperand1,
06174 &DoubleOperand2,
06175 &DoubleResult);
06176
06177 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06178
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06179
Count += 1;
06180 }
06181
06182
if (
Count != 1) {
06183
goto TestFailed;
06184 }
06185
06186 Subtest += 1;
06187 DoubleOperand1.LowPart = 0x0;
06188 DoubleOperand1.HighPart = 0x80008;
06189 DoubleOperand2.LowPart = 0x1;
06190 DoubleOperand2.HighPart =
SIGN | 0x7fe00001;
06191
Count = 0;
06192
try {
06193 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06194 &DoubleOperand1,
06195 &DoubleOperand2,
06196 &DoubleResult);
06197
06198 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06199
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06200
Count += 1;
06201 }
06202
06203
if (
Count != 1) {
06204
goto TestFailed;
06205 }
06206
06207 Subtest += 1;
06208 DoubleOperand1.LowPart = 0x0;
06209 DoubleOperand1.HighPart = 0x80000;
06210 DoubleOperand2.LowPart = 0x0;
06211 DoubleOperand2.HighPart = 0x80000;
06212 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06213 &DoubleOperand1,
06214 &DoubleOperand2,
06215 &DoubleResult);
06216
06217
if ((Fsr.
Data != (
SU |
SI | ROUND_TO_NEAREST)) ||
06218 (DoubleResult.LowPart != 0x0) ||
06219 (DoubleResult.HighPart != 0x0)) {
06220
goto TestFailed;
06221 }
06222
06223 Subtest += 1;
06224 DoubleOperand1.LowPart = 0x0;
06225 DoubleOperand1.HighPart = 0x80000;
06226 DoubleOperand2.LowPart = 0x0;
06227 DoubleOperand2.HighPart =
SIGN | 0x80000;
06228 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06229 &DoubleOperand1,
06230 &DoubleOperand2,
06231 &DoubleResult);
06232
06233
if ((Fsr.
Data != (
SU |
SI | ROUND_TO_NEAREST)) ||
06234 (DoubleResult.LowPart != 0x0) ||
06235 (DoubleResult.HighPart != (
SIGN | 0x0))) {
06236
goto TestFailed;
06237 }
06238
06239 Subtest += 1;
06240 DoubleOperand1.LowPart = 0x0;
06241 DoubleOperand1.HighPart = 0x80000;
06242 DoubleOperand2.LowPart = 0x0;
06243 DoubleOperand2.HighPart = 0x80000;
06244
Count = 0;
06245
try {
06246 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06247 &DoubleOperand1,
06248 &DoubleOperand2,
06249 &DoubleResult);
06250
06251 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06252
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06253
Count += 1;
06254 }
06255
06256
if (
Count != 1) {
06257
goto TestFailed;
06258 }
06259
06260 Subtest += 1;
06261 DoubleOperand1.LowPart = 0x0;
06262 DoubleOperand1.HighPart = 0x80000;
06263 DoubleOperand2.LowPart = 0x0;
06264 DoubleOperand2.HighPart =
SIGN | 0x80000;
06265
Count = 0;
06266
try {
06267 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06268 &DoubleOperand1,
06269 &DoubleOperand2,
06270 &DoubleResult);
06271
06272 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06273
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06274
Count += 1;
06275 }
06276
06277
if (
Count != 1) {
06278
goto TestFailed;
06279 }
06280
06281 Subtest += 1;
06282 DoubleOperand1.LowPart = 0x0;
06283 DoubleOperand1.HighPart = 0x80000;
06284 DoubleOperand2.LowPart = 0x0;
06285 DoubleOperand2.HighPart = 0x80000;
06286
Count = 0;
06287
try {
06288 Fsr.
Data =
MultiplyDouble(
EU | ROUND_TO_NEAREST,
06289 &DoubleOperand1,
06290 &DoubleOperand2,
06291 &DoubleResult);
06292
06293 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
06294
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06295
Count += 1;
06296 }
06297
06298
if (
Count != 1) {
06299
goto TestFailed;
06300 }
06301
06302 Subtest += 1;
06303 DoubleOperand1.LowPart = 0x0;
06304 DoubleOperand1.HighPart = 0x80000;
06305 DoubleOperand2.LowPart = 0x0;
06306 DoubleOperand2.HighPart =
SIGN | 0x80000;
06307
Count = 0;
06308
try {
06309 Fsr.
Data =
MultiplyDouble(
EU | ROUND_TO_NEAREST,
06310 &DoubleOperand1,
06311 &DoubleOperand2,
06312 &DoubleResult);
06313
06314 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
06315
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06316
Count += 1;
06317 }
06318
06319
if (
Count != 1) {
06320
goto TestFailed;
06321 }
06322
06323 Subtest += 1;
06324 DoubleOperand1.LowPart = 0x0;
06325 DoubleOperand1.HighPart = 0x80000;
06326 DoubleOperand2.LowPart = 0x0;
06327 DoubleOperand2.HighPart = 0x80000;
06328
Count = 0;
06329
try {
06330 Fsr.
Data =
MultiplyDouble(
EU |
EI | ROUND_TO_NEAREST,
06331 &DoubleOperand1,
06332 &DoubleOperand2,
06333 &DoubleResult);
06334
06335 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
06336
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06337
Count += 1;
06338 }
06339
06340
if (
Count != 1) {
06341
goto TestFailed;
06342 }
06343
06344 Subtest += 1;
06345 DoubleOperand1.LowPart = 0x0;
06346 DoubleOperand1.HighPart = 0x80000;
06347 DoubleOperand2.LowPart = 0x0;
06348 DoubleOperand2.HighPart =
SIGN | 0x80000;
06349
Count = 0;
06350
try {
06351 Fsr.
Data =
MultiplyDouble(
EU |
EI | ROUND_TO_NEAREST,
06352 &DoubleOperand1,
06353 &DoubleOperand2,
06354 &DoubleResult);
06355
06356 } except ((GetExceptionCode() == STATUS_FLOAT_UNDERFLOW) ?
06357
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06358
Count += 1;
06359 }
06360
06361
if (
Count != 1) {
06362
goto TestFailed;
06363 }
06364
06365 Subtest += 1;
06366 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06367 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06368 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06369 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06370 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06371 &DoubleOperand1,
06372 &DoubleOperand2,
06373 &DoubleResult);
06374
06375
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
06376 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06377 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06378
goto TestFailed;
06379 }
06380
06381 Subtest += 1;
06382 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06383 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06384 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06385 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06386 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06387 &DoubleOperand1,
06388 &DoubleOperand2,
06389 &DoubleResult);
06390
06391
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
06392 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06393 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06394
goto TestFailed;
06395 }
06396
06397 Subtest += 1;
06398 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06399 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06400 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06401 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06402 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06403 &DoubleOperand1,
06404 &DoubleOperand2,
06405 &DoubleResult);
06406
06407
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
06408 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06409 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06410
goto TestFailed;
06411 }
06412
06413 Subtest += 1;
06414 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06415 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06416 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06417 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06418 Fsr.
Data =
MultiplyDouble(ROUND_TO_NEAREST,
06419 &DoubleOperand1,
06420 &DoubleOperand2,
06421 &DoubleResult);
06422
06423
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_NEAREST)) ||
06424 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06425 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06426
goto TestFailed;
06427 }
06428
06429 Subtest += 1;
06430 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06431 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06432 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06433 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06434 Fsr.
Data =
MultiplyDouble(ROUND_TO_ZERO,
06435 &DoubleOperand1,
06436 &DoubleOperand2,
06437 &DoubleResult);
06438
06439
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
06440 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06441 (DoubleResult.HighPart != DOUBLE_MAXIMUM_VALUE_HIGH)) {
06442
goto TestFailed;
06443 }
06444
06445 Subtest += 1;
06446 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06447 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06448 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06449 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06450 Fsr.
Data =
MultiplyDouble(ROUND_TO_ZERO,
06451 &DoubleOperand1,
06452 &DoubleOperand2,
06453 &DoubleResult);
06454
06455
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
06456 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06457 (DoubleResult.HighPart != (
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH))) {
06458
goto TestFailed;
06459 }
06460
06461 Subtest += 1;
06462 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06463 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06464 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06465 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06466 Fsr.
Data =
MultiplyDouble(ROUND_TO_ZERO,
06467 &DoubleOperand1,
06468 &DoubleOperand2,
06469 &DoubleResult);
06470
06471
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
06472 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06473 (DoubleResult.HighPart != (
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH))) {
06474
goto TestFailed;
06475 }
06476
06477 Subtest += 1;
06478 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06479 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06480 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06481 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06482 Fsr.
Data =
MultiplyDouble(ROUND_TO_ZERO,
06483 &DoubleOperand1,
06484 &DoubleOperand2,
06485 &DoubleResult);
06486
06487
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_ZERO)) ||
06488 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06489 (DoubleResult.HighPart != DOUBLE_MAXIMUM_VALUE_HIGH)) {
06490
goto TestFailed;
06491 }
06492
06493 Subtest += 1;
06494 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06495 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06496 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06497 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06498 Fsr.
Data =
MultiplyDouble(ROUND_TO_PLUS_INFINITY,
06499 &DoubleOperand1,
06500 &DoubleOperand2,
06501 &DoubleResult);
06502
06503
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
06504 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06505 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06506
goto TestFailed;
06507 }
06508
06509 Subtest += 1;
06510 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06511 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06512 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06513 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06514 Fsr.
Data =
MultiplyDouble(ROUND_TO_PLUS_INFINITY,
06515 &DoubleOperand1,
06516 &DoubleOperand2,
06517 &DoubleResult);
06518
06519
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
06520 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06521 (DoubleResult.HighPart != (
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH))) {
06522
goto TestFailed;
06523 }
06524
06525 Subtest += 1;
06526 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06527 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06528 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06529 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06530 Fsr.
Data =
MultiplyDouble(ROUND_TO_PLUS_INFINITY,
06531 &DoubleOperand1,
06532 &DoubleOperand2,
06533 &DoubleResult);
06534
06535
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
06536 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06537 (DoubleResult.HighPart != (
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH))) {
06538
goto TestFailed;
06539 }
06540
06541 Subtest += 1;
06542 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06543 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06544 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06545 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06546 Fsr.
Data =
MultiplyDouble(ROUND_TO_PLUS_INFINITY,
06547 &DoubleOperand1,
06548 &DoubleOperand2,
06549 &DoubleResult);
06550
06551
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_PLUS_INFINITY)) ||
06552 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06553 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06554
goto TestFailed;
06555 }
06556
06557 Subtest += 1;
06558 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06559 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06560 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06561 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06562 Fsr.
Data =
MultiplyDouble(ROUND_TO_MINUS_INFINITY,
06563 &DoubleOperand1,
06564 &DoubleOperand2,
06565 &DoubleResult);
06566
06567
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
06568 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06569 (DoubleResult.HighPart != DOUBLE_MAXIMUM_VALUE_HIGH)) {
06570
goto TestFailed;
06571 }
06572
06573 Subtest += 1;
06574 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06575 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06576 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06577 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06578 Fsr.
Data =
MultiplyDouble(ROUND_TO_MINUS_INFINITY,
06579 &DoubleOperand1,
06580 &DoubleOperand2,
06581 &DoubleResult);
06582
06583
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
06584 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06585 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06586
goto TestFailed;
06587 }
06588
06589 Subtest += 1;
06590 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06591 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06592 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06593 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06594 Fsr.
Data =
MultiplyDouble(ROUND_TO_MINUS_INFINITY,
06595 &DoubleOperand1,
06596 &DoubleOperand2,
06597 &DoubleResult);
06598
06599
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
06600 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06601 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06602
goto TestFailed;
06603 }
06604
06605 Subtest += 1;
06606 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06607 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06608 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06609 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06610 Fsr.
Data =
MultiplyDouble(ROUND_TO_MINUS_INFINITY,
06611 &DoubleOperand1,
06612 &DoubleOperand2,
06613 &DoubleResult);
06614
06615
if ((Fsr.
Data != (
SO |
SI |
XO |
XI | ROUND_TO_MINUS_INFINITY)) ||
06616 (DoubleResult.LowPart != DOUBLE_MAXIMUM_VALUE_LOW) ||
06617 (DoubleResult.HighPart != DOUBLE_MAXIMUM_VALUE_HIGH)) {
06618
goto TestFailed;
06619 }
06620
06621 Subtest += 1;
06622 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06623 DoubleOperand1.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06624 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06625 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06626
Count = 0;
06627
try {
06628 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06629 &DoubleOperand1,
06630 &DoubleOperand2,
06631 &DoubleResult);
06632
06633 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06634
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06635
Count += 1;
06636 }
06637
06638
if (
Count != 1) {
06639
goto TestFailed;
06640 }
06641
06642 Subtest += 1;
06643 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06644 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06645 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06646 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06647
Count = 0;
06648
try {
06649 Fsr.
Data =
MultiplyDouble(
EI | ROUND_TO_NEAREST,
06650 &DoubleOperand1,
06651 &DoubleOperand2,
06652 &DoubleResult);
06653
06654 } except ((GetExceptionCode() == STATUS_FLOAT_INEXACT_RESULT) ?
06655
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06656
Count += 1;
06657 }
06658
06659
if (
Count != 1) {
06660
goto TestFailed;
06661 }
06662
06663 Subtest += 1;
06664 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06665 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06666 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06667 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06668
Count = 0;
06669
try {
06670 Fsr.
Data =
MultiplyDouble(
EO | ROUND_TO_NEAREST,
06671 &DoubleOperand1,
06672 &DoubleOperand2,
06673 &DoubleResult);
06674
06675 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
06676
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06677
Count += 1;
06678 }
06679
06680
if (
Count != 1) {
06681
goto TestFailed;
06682 }
06683
06684 Subtest += 1;
06685 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06686 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06687 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06688 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06689
Count = 0;
06690
try {
06691 Fsr.
Data =
MultiplyDouble(
EO | ROUND_TO_NEAREST,
06692 &DoubleOperand1,
06693 &DoubleOperand2,
06694 &DoubleResult);
06695
06696 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
06697
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06698
Count += 1;
06699 }
06700
06701
if (
Count != 1) {
06702
goto TestFailed;
06703 }
06704
06705 Subtest += 1;
06706 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06707 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06708 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06709 DoubleOperand2.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06710
Count = 0;
06711
try {
06712 Fsr.
Data =
MultiplyDouble(
EO |
EI | ROUND_TO_NEAREST,
06713 &DoubleOperand1,
06714 &DoubleOperand2,
06715 &DoubleResult);
06716
06717 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
06718
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06719
Count += 1;
06720 }
06721
06722
if (
Count != 1) {
06723
goto TestFailed;
06724 }
06725
06726 Subtest += 1;
06727 DoubleOperand1.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06728 DoubleOperand1.HighPart = DOUBLE_MAXIMUM_VALUE_HIGH;
06729 DoubleOperand2.LowPart = DOUBLE_MAXIMUM_VALUE_LOW;
06730 DoubleOperand2.HighPart =
SIGN | DOUBLE_MAXIMUM_VALUE_HIGH;
06731
Count = 0;
06732
try {
06733 Fsr.
Data =
MultiplyDouble(
EO |
EI | ROUND_TO_NEAREST,
06734 &DoubleOperand1,
06735 &DoubleOperand2,
06736 &DoubleResult);
06737
06738 } except ((GetExceptionCode() == STATUS_FLOAT_OVERFLOW) ?
06739
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06740
Count += 1;
06741 }
06742
06743
if (
Count != 1) {
06744
goto TestFailed;
06745 }
06746
06747
06748
06749
06750
06751 printf(
"succeeded\n");
06752
return;
06753
06754
06755
06756
06757
06758 TestFailed:
06759 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
06760 Subtest,
06761 Fsr.
Data,
06762 DoubleResult.LowPart,
06763 DoubleResult.HighPart);
06764
06765
return;
06766 }
06767
06768
VOID
06769 Test18 (
06770 VOID
06771 )
06772
06773 {
06774
06775 ULONG
Count;
06776 ULARGE_INTEGER DoubleOperand1;
06777 ULARGE_INTEGER DoubleOperand2;
06778 ULARGE_INTEGER DoubleResult;
06779
FLOATING_STATUS Fsr;
06780 ULONG Subtest;
06781
06782
06783
06784
06785
06786 Subtest = 0;
06787 printf(
" Test 18 - divide double ...");
06788 Subtest += 1;
06789 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06790 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06791 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06792 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06793 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06794 &DoubleOperand1,
06795 &DoubleOperand2,
06796 &DoubleResult);
06797
06798
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06799 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06800 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06801
goto TestFailed;
06802 }
06803
06804 Subtest += 1;
06805 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06806 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06807 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06808 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
06809 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06810 &DoubleOperand1,
06811 &DoubleOperand2,
06812 &DoubleResult);
06813
06814
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06815 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06816 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06817
goto TestFailed;
06818 }
06819
06820 Subtest += 1;
06821 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06822 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
06823 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06824 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
06825 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06826 &DoubleOperand1,
06827 &DoubleOperand2,
06828 &DoubleResult);
06829
06830
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06831 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06832 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06833
goto TestFailed;
06834 }
06835
06836 Subtest += 1;
06837 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06838 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
06839 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06840 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06841 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06842 &DoubleOperand1,
06843 &DoubleOperand2,
06844 &DoubleResult);
06845
06846
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06847 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06848 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06849
goto TestFailed;
06850 }
06851
06852 Subtest += 1;
06853 DoubleOperand1.LowPart = 0x0;
06854 DoubleOperand1.HighPart = 0x0;
06855 DoubleOperand2.LowPart = 0x0;
06856 DoubleOperand2.HighPart = 0x0;
06857 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06858 &DoubleOperand1,
06859 &DoubleOperand2,
06860 &DoubleResult);
06861
06862
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06863 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06864 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06865
goto TestFailed;
06866 }
06867
06868 Subtest += 1;
06869 DoubleOperand1.LowPart = 0x0;
06870 DoubleOperand1.HighPart = 0x0;
06871 DoubleOperand2.LowPart = 0x0;
06872 DoubleOperand2.HighPart =
SIGN | 0x0;
06873 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06874 &DoubleOperand1,
06875 &DoubleOperand2,
06876 &DoubleResult);
06877
06878
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06879 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06880 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06881
goto TestFailed;
06882 }
06883
06884 Subtest += 1;
06885 DoubleOperand1.LowPart = 0x0;
06886 DoubleOperand1.HighPart =
SIGN | 0x0;
06887 DoubleOperand2.LowPart = 0x0;
06888 DoubleOperand2.HighPart =
SIGN | 0x0;
06889 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06890 &DoubleOperand1,
06891 &DoubleOperand2,
06892 &DoubleResult);
06893
06894
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06895 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06896 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06897
goto TestFailed;
06898 }
06899
06900 Subtest += 1;
06901 DoubleOperand1.LowPart = 0x0;
06902 DoubleOperand1.HighPart =
SIGN | 0x0;
06903 DoubleOperand2.LowPart = 0x0;
06904 DoubleOperand2.HighPart = 0x0;
06905 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06906 &DoubleOperand1,
06907 &DoubleOperand2,
06908 &DoubleResult);
06909
06910
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
06911 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
06912 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
06913
goto TestFailed;
06914 }
06915
06916 Subtest += 1;
06917 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06918 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06919 DoubleOperand2.LowPart = 0x0;
06920 DoubleOperand2.HighPart = 0x0;
06921 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06922 &DoubleOperand1,
06923 &DoubleOperand2,
06924 &DoubleResult);
06925
06926
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06927 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06928 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06929
goto TestFailed;
06930 }
06931
06932 Subtest += 1;
06933 DoubleOperand1.LowPart = 0x0;
06934 DoubleOperand1.HighPart = 0x3ff00000;
06935 DoubleOperand2.LowPart = 0x0;
06936 DoubleOperand2.HighPart = 0x0;
06937 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06938 &DoubleOperand1,
06939 &DoubleOperand2,
06940 &DoubleResult);
06941
06942
if ((Fsr.
Data != (
SZ |
XZ | ROUND_TO_NEAREST)) ||
06943 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06944 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
06945
goto TestFailed;
06946 }
06947
06948
06949 Subtest += 1;
06950 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06951 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
06952 DoubleOperand2.LowPart = 0x0;
06953 DoubleOperand2.HighPart = 0x0;
06954 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06955 &DoubleOperand1,
06956 &DoubleOperand2,
06957 &DoubleResult);
06958
06959
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
06960 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06961 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06962
goto TestFailed;
06963 }
06964
06965 Subtest += 1;
06966 DoubleOperand1.LowPart = 0x0;
06967 DoubleOperand1.HighPart =
SIGN | 0x3ff00000;
06968 DoubleOperand2.LowPart = 0x0;
06969 DoubleOperand2.HighPart = 0x0;
06970 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
06971 &DoubleOperand1,
06972 &DoubleOperand2,
06973 &DoubleResult);
06974
06975
if ((Fsr.
Data != (
SZ |
XZ | ROUND_TO_NEAREST)) ||
06976 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
06977 (DoubleResult.HighPart !=
MINUS_DOUBLE_INFINITY_VALUE)) {
06978
goto TestFailed;
06979 }
06980
06981 Subtest += 1;
06982 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06983 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06984 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
06985 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
06986
Count = 0;
06987
try {
06988 Fsr.
Data =
DivideDouble(
EV | ROUND_TO_NEAREST,
06989 &DoubleOperand1,
06990 &DoubleOperand2,
06991 &DoubleResult);
06992
06993 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
06994
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
06995
Count += 1;
06996 }
06997
06998
if (
Count == 0) {
06999
goto TestFailed;
07000 }
07001
07002 Subtest += 1;
07003 DoubleOperand1.LowPart = 0x0;
07004 DoubleOperand1.HighPart = 0x0;
07005 DoubleOperand2.LowPart = 0x0;
07006 DoubleOperand2.HighPart = 0x0;
07007
Count = 0;
07008
try {
07009 Fsr.
Data =
DivideDouble(
EV | ROUND_TO_NEAREST,
07010 &DoubleOperand1,
07011 &DoubleOperand2,
07012 &DoubleResult);
07013
07014 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
07015
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
07016
Count += 1;
07017 }
07018
07019
if (
Count == 0) {
07020
goto TestFailed;
07021 }
07022
07023 Subtest += 1;
07024 DoubleOperand1.LowPart = 0x0;
07025 DoubleOperand1.HighPart = 0x3ff00000;
07026 DoubleOperand2.LowPart = 0x0;
07027 DoubleOperand2.HighPart = 0x0;
07028
Count = 0;
07029
try {
07030 Fsr.
Data =
DivideDouble(
EZ | ROUND_TO_NEAREST,
07031 &DoubleOperand1,
07032 &DoubleOperand2,
07033 &DoubleResult);
07034
07035 } except ((GetExceptionCode() == STATUS_FLOAT_DIVIDE_BY_ZERO) ?
07036
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
07037
Count += 1;
07038 }
07039
07040
if (
Count == 0) {
07041
goto TestFailed;
07042 }
07043
07044 Subtest += 1;
07045 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07046 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07047 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07048 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07049 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07050 &DoubleOperand1,
07051 &DoubleOperand2,
07052 &DoubleResult);
07053
07054
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
07055 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07056 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07057
goto TestFailed;
07058 }
07059
07060 Subtest += 1;
07061 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07062 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07063 DoubleOperand2.LowPart = 0x0;
07064 DoubleOperand2.HighPart = 0x3ff00000;
07065 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07066 &DoubleOperand1,
07067 &DoubleOperand2,
07068 &DoubleResult);
07069
07070
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
07071 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07072 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07073
goto TestFailed;
07074 }
07075
07076 Subtest += 1;
07077 DoubleOperand1.LowPart = 0x0;
07078 DoubleOperand1.HighPart = 0x3ff00000;
07079 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07080 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07081 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07082 &DoubleOperand1,
07083 &DoubleOperand2,
07084 &DoubleResult);
07085
07086
if ((Fsr.
Data != (ROUND_TO_NEAREST)) ||
07087 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07088 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07089
goto TestFailed;
07090 }
07091
07092 Subtest += 1;
07093 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07094 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
07095 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07096 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
07097 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07098 &DoubleOperand1,
07099 &DoubleOperand2,
07100 &DoubleResult);
07101
07102
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
07103 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07104 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07105
goto TestFailed;
07106 }
07107
07108 Subtest += 1;
07109 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07110 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
07111 DoubleOperand2.LowPart = 0x0;
07112 DoubleOperand2.HighPart = 0x3ff00000;
07113 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07114 &DoubleOperand1,
07115 &DoubleOperand2,
07116 &DoubleResult);
07117
07118
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
07119 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07120 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07121
goto TestFailed;
07122 }
07123
07124 Subtest += 1;
07125 DoubleOperand1.LowPart = 0x0;
07126 DoubleOperand1.HighPart = 0x3ff00000;
07127 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07128 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
07129 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07130 &DoubleOperand1,
07131 &DoubleOperand2,
07132 &DoubleResult);
07133
07134
if ((Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) ||
07135 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07136 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07137
goto TestFailed;
07138 }
07139
07140 Subtest += 1;
07141 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07142 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07143 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07144 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07145
try {
07146 Fsr.
Data =
DivideDouble(
EV | ROUND_TO_NEAREST,
07147 &DoubleOperand1,
07148 &DoubleOperand2,
07149 &DoubleResult);
07150
07151 } except (
EXCEPTION_EXECUTE_HANDLER) {
07152
goto TestFailed;
07153 }
07154
07155
if ((Fsr.
Data != (
EV | ROUND_TO_NEAREST)) ||
07156 (DoubleResult.LowPart != DOUBLE_NAN_LOW) ||
07157 (DoubleResult.HighPart != DOUBLE_QUIET_NAN)) {
07158
goto TestFailed;
07159 }
07160
07161 Subtest += 1;
07162 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07163 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07164 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07165 DoubleOperand2.HighPart = DOUBLE_SIGNAL_NAN;
07166
Count = 0;
07167
try {
07168 Fsr.
Data =
DivideDouble(
EV | ROUND_TO_NEAREST,
07169 &DoubleOperand1,
07170 &DoubleOperand2,
07171 &DoubleResult);
07172
07173 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
07174
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
07175
Count += 1;
07176 }
07177
07178
if (
Count != 1) {
07179
goto TestFailed;
07180 }
07181
07182 Subtest += 1;
07183 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07184 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
07185 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07186 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07187
Count = 0;
07188
try {
07189 Fsr.
Data =
DivideDouble(
EV | ROUND_TO_NEAREST,
07190 &DoubleOperand1,
07191 &DoubleOperand2,
07192 &DoubleResult);
07193
07194 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
07195
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
07196
Count += 1;
07197 }
07198
07199
if (
Count != 1) {
07200
goto TestFailed;
07201 }
07202
07203 Subtest += 1;
07204 DoubleOperand1.LowPart = 0x0;
07205 DoubleOperand1.HighPart = 0x80000;
07206 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07207 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07208 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07209 &DoubleOperand1,
07210 &DoubleOperand2,
07211 &DoubleResult);
07212
07213
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07214 (DoubleResult.LowPart != 0x0) ||
07215 (DoubleResult.HighPart != 0x0)) {
07216
goto TestFailed;
07217 }
07218
07219 Subtest += 1;
07220 DoubleOperand1.LowPart = 0x0;
07221 DoubleOperand1.HighPart =
SIGN | 0x80000;
07222 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07223 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07224 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07225 &DoubleOperand1,
07226 &DoubleOperand2,
07227 &DoubleResult);
07228
07229
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07230 (DoubleResult.LowPart != 0x0) ||
07231 (DoubleResult.HighPart != (
SIGN | 0x0))) {
07232
goto TestFailed;
07233 }
07234
07235 Subtest += 1;
07236 DoubleOperand1.LowPart = 0x0;
07237 DoubleOperand1.HighPart = 0x80000;
07238 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07239 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07240 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07241 &DoubleOperand1,
07242 &DoubleOperand2,
07243 &DoubleResult);
07244
07245
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07246 (DoubleResult.LowPart != 0x0) ||
07247 (DoubleResult.HighPart != (
SIGN | 0x0))) {
07248
goto TestFailed;
07249 }
07250
07251 Subtest += 1;
07252 DoubleOperand1.LowPart = 0x0;
07253 DoubleOperand1.HighPart =
SIGN | 0x80000;
07254 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07255 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07256 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07257 &DoubleOperand1,
07258 &DoubleOperand2,
07259 &DoubleResult);
07260
07261
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07262 (DoubleResult.LowPart != 0x0) ||
07263 (DoubleResult.HighPart != 0x0)) {
07264
goto TestFailed;
07265 }
07266
07267 Subtest += 1;
07268 DoubleOperand1.LowPart = 0x0;
07269 DoubleOperand1.HighPart = 0x80000;
07270 DoubleOperand2.LowPart = 0x0;
07271 DoubleOperand2.HighPart = 0x80000;
07272 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07273 &DoubleOperand1,
07274 &DoubleOperand2,
07275 &DoubleResult);
07276
07277
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07278 (DoubleResult.LowPart != 0x0) ||
07279 (DoubleResult.HighPart != 0x3ff00000)) {
07280
goto TestFailed;
07281 }
07282
07283 Subtest += 1;
07284 DoubleOperand1.LowPart = 0x0;
07285 DoubleOperand1.HighPart =
SIGN | 0x80000;
07286 DoubleOperand2.LowPart = 0x0;
07287 DoubleOperand2.HighPart = 0x80000;
07288 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07289 &DoubleOperand1,
07290 &DoubleOperand2,
07291 &DoubleResult);
07292
07293
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07294 (DoubleResult.LowPart != 0x0) ||
07295 (DoubleResult.HighPart != (
SIGN | 0x3ff00000))) {
07296
goto TestFailed;
07297 }
07298
07299 Subtest += 1;
07300 DoubleOperand1.LowPart = 0x0;
07301 DoubleOperand1.HighPart = 0x80000;
07302 DoubleOperand2.LowPart = 0x0;
07303 DoubleOperand2.HighPart =
SIGN | 0x80000;
07304 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07305 &DoubleOperand1,
07306 &DoubleOperand2,
07307 &DoubleResult);
07308
07309
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07310 (DoubleResult.LowPart != 0x0) ||
07311 (DoubleResult.HighPart != (
SIGN | 0x3ff00000))) {
07312
goto TestFailed;
07313 }
07314
07315 Subtest += 1;
07316 DoubleOperand1.LowPart = 0x0;
07317 DoubleOperand1.HighPart =
SIGN | 0x80000;
07318 DoubleOperand2.LowPart = 0x0;
07319 DoubleOperand2.HighPart =
SIGN | 0x80000;
07320 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07321 &DoubleOperand1,
07322 &DoubleOperand2,
07323 &DoubleResult);
07324
07325
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07326 (DoubleResult.LowPart != 0x0) ||
07327 (DoubleResult.HighPart != 0x3ff00000)) {
07328
goto TestFailed;
07329 }
07330
07331 Subtest += 1;
07332 DoubleOperand1.LowPart = 0x0;
07333 DoubleOperand1.HighPart = 0x3ff00000;
07334 DoubleOperand2.LowPart = 0x0;
07335 DoubleOperand2.HighPart = 0x80000;
07336 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07337 &DoubleOperand1,
07338 &DoubleOperand2,
07339 &DoubleResult);
07340
07341
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07342 (DoubleResult.LowPart != 0x0) ||
07343 (DoubleResult.HighPart != 0x7fe00000)) {
07344
goto TestFailed;
07345 }
07346
07347 Subtest += 1;
07348 DoubleOperand1.LowPart = 0x0;
07349 DoubleOperand1.HighPart = 0x40000000;
07350 DoubleOperand2.LowPart = 0x0;
07351 DoubleOperand2.HighPart = 0x80000;
07352 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07353 &DoubleOperand1,
07354 &DoubleOperand2,
07355 &DoubleResult);
07356
07357
if ((Fsr.
Data != (
SO |
SI | ROUND_TO_NEAREST)) ||
07358 (DoubleResult.LowPart != DOUBLE_INFINITY_VALUE_LOW) ||
07359 (DoubleResult.HighPart != DOUBLE_INFINITY_VALUE_HIGH)) {
07360
goto TestFailed;
07361 }
07362
07363 Subtest += 1;
07364 DoubleOperand1.LowPart = 0xffffffff;
07365 DoubleOperand1.HighPart = 0x3fffffff;
07366 DoubleOperand2.LowPart = 0x0;
07367 DoubleOperand2.HighPart = 0x80000;
07368 Fsr.
Data =
DivideDouble(ROUND_TO_NEAREST,
07369 &DoubleOperand1,
07370 &DoubleOperand2,
07371 &DoubleResult);
07372
07373
if ((Fsr.
Data != ROUND_TO_NEAREST) ||
07374 (DoubleResult.LowPart != 0xffffffff) ||
07375 (DoubleResult.HighPart != 0x7fefffff)) {
07376
goto TestFailed;
07377 }
07378
07379
07380
07381
07382
07383 printf(
"succeeded\n");
07384
return;
07385
07386
07387
07388
07389
07390 TestFailed:
07391 printf(
" subtest %d failed, fsr = %lx, result = %lx, %lx\n",
07392 Subtest,
07393 Fsr.
Data,
07394 DoubleResult.LowPart,
07395 DoubleResult.HighPart);
07396
07397
return;
07398 }
07399
07400
VOID
07401 Test19 (
07402 VOID
07403 )
07404
07405 {
07406
07407 ULONG
Count;
07408 ULARGE_INTEGER DoubleOperand1;
07409 ULARGE_INTEGER DoubleOperand2;
07410
FLOATING_STATUS Fsr;
07411 ULONG Subtest;
07412
07413
07414
07415
07416
07417 Subtest = 0;
07418 printf(
" Test 19 - compare double ...");
07419
07420
07421
07422 Subtest += 1;
07423 DoubleOperand1.LowPart = 0x0;
07424 DoubleOperand1.HighPart = 0x0;
07425 DoubleOperand2.LowPart = 0x0;
07426 DoubleOperand2.HighPart = 0x80000;
07427 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07428 &DoubleOperand1,
07429 &DoubleOperand2);
07430
07431
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07432
goto TestFailed;
07433 }
07434
07435 Subtest += 1;
07436 DoubleOperand1.LowPart = 0x0;
07437 DoubleOperand1.HighPart =
SIGN | 0x0;
07438 DoubleOperand2.LowPart = 0x0;
07439 DoubleOperand2.HighPart = 0x80000;
07440 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07441 &DoubleOperand1,
07442 &DoubleOperand2);
07443
07444
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07445
goto TestFailed;
07446 }
07447
07448 Subtest += 1;
07449 DoubleOperand1.LowPart = 0x0;
07450 DoubleOperand1.HighPart = 0x80000;
07451 DoubleOperand2.LowPart = 0x0;
07452 DoubleOperand2.HighPart = 0x0;
07453 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07454 &DoubleOperand1,
07455 &DoubleOperand2);
07456
07457
if (Fsr.
Data != ROUND_TO_NEAREST) {
07458
goto TestFailed;
07459 }
07460
07461 Subtest += 1;
07462 DoubleOperand1.LowPart = 0x0;
07463 DoubleOperand1.HighPart = 0x80000;
07464 DoubleOperand2.LowPart = 0x0;
07465 DoubleOperand2.HighPart =
SIGN | 0x0;
07466 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07467 &DoubleOperand1,
07468 &DoubleOperand2);
07469
07470
if (Fsr.
Data != ROUND_TO_NEAREST) {
07471
goto TestFailed;
07472 }
07473
07474
07475
07476 Subtest += 1;
07477 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07478 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07479 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07480 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07481 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07482 &DoubleOperand1,
07483 &DoubleOperand2);
07484
07485
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07486
goto TestFailed;
07487 }
07488
07489 Subtest += 1;
07490 DoubleOperand1.LowPart = 0x0;
07491 DoubleOperand1.HighPart = 0x80000;
07492 DoubleOperand2.LowPart = 0x0;
07493 DoubleOperand2.HighPart = 0x80000;
07494 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07495 &DoubleOperand1,
07496 &DoubleOperand2);
07497
07498
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07499
goto TestFailed;
07500 }
07501
07502 Subtest += 1;
07503 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07504 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07505 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07506 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07507 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07508 &DoubleOperand1,
07509 &DoubleOperand2);
07510
07511
if (Fsr.
Data != ROUND_TO_NEAREST) {
07512
goto TestFailed;
07513 }
07514
07515 Subtest += 1;
07516 DoubleOperand1.LowPart = 0x0;
07517 DoubleOperand1.HighPart = 0x80000;
07518 DoubleOperand2.LowPart = 0x0;
07519 DoubleOperand2.HighPart =
SIGN | 0x80000;
07520 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07521 &DoubleOperand1,
07522 &DoubleOperand2);
07523
07524
if (Fsr.
Data != ROUND_TO_NEAREST) {
07525
goto TestFailed;
07526 }
07527
07528 Subtest += 1;
07529 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07530 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07531 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07532 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07533 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07534 &DoubleOperand1,
07535 &DoubleOperand2);
07536
07537
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07538
goto TestFailed;
07539 }
07540
07541 Subtest += 1;
07542 DoubleOperand1.LowPart = 0x0;
07543 DoubleOperand1.HighPart = 0x80000;
07544 DoubleOperand2.LowPart = 0x0;
07545 DoubleOperand2.HighPart = 0x80000;
07546 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07547 &DoubleOperand1,
07548 &DoubleOperand2);
07549
07550
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07551
goto TestFailed;
07552 }
07553
07554 Subtest += 1;
07555 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07556 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07557 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07558 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07559 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07560 &DoubleOperand1,
07561 &DoubleOperand2);
07562
07563
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07564
goto TestFailed;
07565 }
07566
07567 Subtest += 1;
07568 DoubleOperand1.LowPart = 0x0;
07569 DoubleOperand1.HighPart =
SIGN | 0x80000;
07570 DoubleOperand2.LowPart = 0x0;
07571 DoubleOperand2.HighPart = 0x80000;
07572 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07573 &DoubleOperand1,
07574 &DoubleOperand2);
07575
07576
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07577
goto TestFailed;
07578 }
07579
07580 Subtest += 1;
07581 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07582 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07583 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07584 DoubleOperand2.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07585 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07586 &DoubleOperand1,
07587 &DoubleOperand2);
07588
07589
if (Fsr.
Data != ROUND_TO_NEAREST) {
07590
goto TestFailed;
07591 }
07592
07593 Subtest += 1;
07594 DoubleOperand1.LowPart = 0x0;
07595 DoubleOperand1.HighPart = 0x80000;
07596 DoubleOperand2.LowPart = 0x0;
07597 DoubleOperand2.HighPart =
SIGN | 0x80000;
07598 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
07599 &DoubleOperand1,
07600 &DoubleOperand2);
07601
07602
if (Fsr.
Data != ROUND_TO_NEAREST) {
07603
goto TestFailed;
07604 }
07605
07606 Subtest += 1;
07607 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07608 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07609 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07610 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07611 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07612 &DoubleOperand1,
07613 &DoubleOperand2);
07614
07615
if (Fsr.
Data != ROUND_TO_NEAREST) {
07616
goto TestFailed;
07617 }
07618
07619 Subtest += 1;
07620 DoubleOperand1.LowPart = 0x0;
07621 DoubleOperand1.HighPart = 0x80000;
07622 DoubleOperand2.LowPart = 0x0;
07623 DoubleOperand2.HighPart = 0x80000;
07624 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07625 &DoubleOperand1,
07626 &DoubleOperand2);
07627
07628
if (Fsr.
Data != ROUND_TO_NEAREST) {
07629
goto TestFailed;
07630 }
07631
07632 Subtest += 1;
07633 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07634 DoubleOperand1.HighPart =
MINUS_DOUBLE_INFINITY_VALUE;
07635 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07636 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07637 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07638 &DoubleOperand1,
07639 &DoubleOperand2);
07640
07641
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07642
goto TestFailed;
07643 }
07644
07645 Subtest += 1;
07646 DoubleOperand1.LowPart = 0x0;
07647 DoubleOperand1.HighPart =
SIGN | 0x80000;
07648 DoubleOperand2.LowPart = 0x0;
07649 DoubleOperand2.HighPart = 0x80000;
07650 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07651 &DoubleOperand1,
07652 &DoubleOperand2);
07653
07654
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07655
goto TestFailed;
07656 }
07657
07658 Subtest += 1;
07659 DoubleOperand1.LowPart = 0x0;
07660 DoubleOperand1.HighPart = 0x80000;
07661 DoubleOperand2.LowPart = 0x1000;
07662 DoubleOperand2.HighPart = 0x80000;
07663 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07664 &DoubleOperand1,
07665 &DoubleOperand2);
07666
07667
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07668
goto TestFailed;
07669 }
07670
07671 Subtest += 1;
07672 DoubleOperand1.LowPart = 0x0;
07673 DoubleOperand1.HighPart = 0x80000;
07674 DoubleOperand2.LowPart = 0x0;
07675 DoubleOperand2.HighPart = 0x81000;
07676 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07677 &DoubleOperand1,
07678 &DoubleOperand2);
07679
07680
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07681
goto TestFailed;
07682 }
07683
07684 Subtest += 1;
07685 DoubleOperand1.LowPart = 0x0;
07686 DoubleOperand1.HighPart = 0x40000;
07687 DoubleOperand2.LowPart = 0x0;
07688 DoubleOperand2.HighPart = 0x80000;
07689 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07690 &DoubleOperand1,
07691 &DoubleOperand2);
07692
07693
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07694
goto TestFailed;
07695 }
07696
07697 Subtest += 1;
07698 DoubleOperand1.LowPart = 0x0;
07699 DoubleOperand1.HighPart =
SIGN | 0x80000;
07700 DoubleOperand2.LowPart = 0x0;
07701 DoubleOperand2.HighPart = 0x80000;
07702 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07703 &DoubleOperand1,
07704 &DoubleOperand2);
07705
07706
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07707
goto TestFailed;
07708 }
07709
07710 Subtest += 1;
07711 DoubleOperand1.LowPart = 0x1000;
07712 DoubleOperand1.HighPart =
SIGN | 0x80000;
07713 DoubleOperand2.LowPart = 0x0;
07714 DoubleOperand2.HighPart =
SIGN | 0x80000;
07715 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07716 &DoubleOperand1,
07717 &DoubleOperand2);
07718
07719
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07720
goto TestFailed;
07721 }
07722
07723 Subtest += 1;
07724 DoubleOperand1.LowPart = 0x0;
07725 DoubleOperand1.HighPart =
SIGN | 0x81000;
07726 DoubleOperand2.LowPart = 0x0;
07727 DoubleOperand2.HighPart =
SIGN | 0x80000;
07728 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07729 &DoubleOperand1,
07730 &DoubleOperand2);
07731
07732
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07733
goto TestFailed;
07734 }
07735
07736 Subtest += 1;
07737 DoubleOperand1.LowPart = 0x0;
07738 DoubleOperand1.HighPart =
SIGN | 0x80000;
07739 DoubleOperand2.LowPart = 0x0;
07740 DoubleOperand2.HighPart =
SIGN | 0x40000;
07741 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07742 &DoubleOperand1,
07743 &DoubleOperand2);
07744
07745
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07746
goto TestFailed;
07747 }
07748
07749 Subtest += 1;
07750 DoubleOperand1.LowPart = 0x0;
07751 DoubleOperand1.HighPart =
SIGN | 0x80000;
07752 DoubleOperand2.LowPart = 0x0;
07753 DoubleOperand2.HighPart = 0x80000;
07754 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
07755 &DoubleOperand1,
07756 &DoubleOperand2);
07757
07758
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07759
goto TestFailed;
07760 }
07761
07762 Subtest += 1;
07763 DoubleOperand1.LowPart = 0x0;
07764 DoubleOperand1.HighPart = 0x80000;
07765 DoubleOperand2.LowPart = 0x0;
07766 DoubleOperand2.HighPart = 0x80000;
07767 Fsr.
Data =
CompareFDouble(ROUND_TO_NEAREST,
07768 &DoubleOperand1,
07769 &DoubleOperand2);
07770
07771
if (Fsr.
Data != ROUND_TO_NEAREST) {
07772
goto TestFailed;
07773 }
07774
07775 Subtest += 1;
07776 DoubleOperand1.LowPart = 0x0;
07777 DoubleOperand1.HighPart = 0x80000;
07778 DoubleOperand2.LowPart = 0x0;
07779 DoubleOperand2.HighPart = 0x80000;
07780 Fsr.
Data =
CompareUnDouble(ROUND_TO_NEAREST,
07781 &DoubleOperand1,
07782 &DoubleOperand2);
07783
07784
if (Fsr.
Data != ROUND_TO_NEAREST) {
07785
goto TestFailed;
07786 }
07787
07788 Subtest += 1;
07789 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07790 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07791 DoubleOperand2.LowPart = 0x0;
07792 DoubleOperand2.HighPart = 0x80000;
07793 Fsr.
Data =
CompareUnDouble(ROUND_TO_NEAREST,
07794 &DoubleOperand1,
07795 &DoubleOperand2);
07796
07797
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07798
goto TestFailed;
07799 }
07800
07801 Subtest += 1;
07802 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07803 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07804 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07805 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07806 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07807 &DoubleOperand1,
07808 &DoubleOperand2);
07809
07810
if (Fsr.
Data != ROUND_TO_NEAREST) {
07811
goto TestFailed;
07812 }
07813
07814 Subtest += 1;
07815 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07816 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07817 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07818 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07819 Fsr.
Data =
CompareEqDouble(ROUND_TO_NEAREST,
07820 &DoubleOperand1,
07821 &DoubleOperand2);
07822
07823
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07824
goto TestFailed;
07825 }
07826
07827 Subtest += 1;
07828 DoubleOperand1.LowPart = 0x0;
07829 DoubleOperand1.HighPart = 0x80000;
07830 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07831 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07832 Fsr.
Data =
CompareUeqDouble(ROUND_TO_NEAREST,
07833 &DoubleOperand1,
07834 &DoubleOperand2);
07835
07836
if (Fsr.
Data != ROUND_TO_NEAREST) {
07837
goto TestFailed;
07838 }
07839
07840 Subtest += 1;
07841 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07842 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07843 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07844 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07845 Fsr.
Data =
CompareUeqDouble(ROUND_TO_NEAREST,
07846 &DoubleOperand1,
07847 &DoubleOperand2);
07848
07849
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07850
goto TestFailed;
07851 }
07852
07853 Subtest += 1;
07854 DoubleOperand1.LowPart = 0x0;
07855 DoubleOperand1.HighPart = 0x80000;
07856 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07857 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07858 Fsr.
Data =
CompareOltDouble(ROUND_TO_NEAREST,
07859 &DoubleOperand1,
07860 &DoubleOperand2);
07861
07862
if (Fsr.
Data != ROUND_TO_NEAREST) {
07863
goto TestFailed;
07864 }
07865
07866 Subtest += 1;
07867 DoubleOperand1.LowPart = 0x0;
07868 DoubleOperand1.HighPart = 0x80000;
07869 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07870 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07871 Fsr.
Data =
CompareOltDouble(ROUND_TO_NEAREST,
07872 &DoubleOperand1,
07873 &DoubleOperand2);
07874
07875
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07876
goto TestFailed;
07877 }
07878
07879 Subtest += 1;
07880 DoubleOperand1.LowPart = 0x0;
07881 DoubleOperand1.HighPart = 0x80000;
07882 DoubleOperand2.LowPart = 0x0;
07883 DoubleOperand2.HighPart = 0x80000;
07884 Fsr.
Data =
CompareUltDouble(ROUND_TO_NEAREST,
07885 &DoubleOperand1,
07886 &DoubleOperand2);
07887
07888
if (Fsr.
Data != ROUND_TO_NEAREST) {
07889
goto TestFailed;
07890 }
07891
07892 Subtest += 1;
07893 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07894 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07895 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07896 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07897 Fsr.
Data =
CompareUltDouble(ROUND_TO_NEAREST,
07898 &DoubleOperand1,
07899 &DoubleOperand2);
07900
07901
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07902
goto TestFailed;
07903 }
07904
07905 Subtest += 1;
07906 DoubleOperand1.LowPart = 0x0;
07907 DoubleOperand1.HighPart = 0x81000;
07908 DoubleOperand2.LowPart = 0x0;
07909 DoubleOperand2.HighPart = 0x80000;
07910 Fsr.
Data =
CompareOleDouble(ROUND_TO_NEAREST,
07911 &DoubleOperand1,
07912 &DoubleOperand2);
07913
07914
if (Fsr.
Data != ROUND_TO_NEAREST) {
07915
goto TestFailed;
07916 }
07917
07918 Subtest += 1;
07919 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07920 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07921 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07922 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07923 Fsr.
Data =
CompareOleDouble(ROUND_TO_NEAREST,
07924 &DoubleOperand1,
07925 &DoubleOperand2);
07926
07927
if (Fsr.
Data != (
CC | ROUND_TO_NEAREST)) {
07928
goto TestFailed;
07929 }
07930
07931 Subtest += 1;
07932 DoubleOperand1.LowPart = 0x0;
07933 DoubleOperand1.HighPart = 0x81000;
07934 DoubleOperand2.LowPart = 0x0;
07935 DoubleOperand2.HighPart = 0x80000;
07936 Fsr.
Data =
CompareSfDouble(ROUND_TO_NEAREST,
07937 &DoubleOperand1,
07938 &DoubleOperand2);
07939
07940
if (Fsr.
Data != ROUND_TO_NEAREST) {
07941
goto TestFailed;
07942 }
07943
07944 Subtest += 1;
07945 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07946 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07947 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
07948 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
07949 Fsr.
Data =
CompareSfDouble(ROUND_TO_NEAREST,
07950 &DoubleOperand1,
07951 &DoubleOperand2);
07952
07953
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
07954
goto TestFailed;
07955 }
07956
07957 Subtest += 1;
07958 DoubleOperand1.LowPart = 0x0;
07959 DoubleOperand1.HighPart = 0x81000;
07960 DoubleOperand2.LowPart = 0x0;
07961 DoubleOperand2.HighPart = 0x80000;
07962 Fsr.
Data =
CompareNgleDouble(ROUND_TO_NEAREST,
07963 &DoubleOperand1,
07964 &DoubleOperand2);
07965
07966
if (Fsr.
Data != ROUND_TO_NEAREST) {
07967
goto TestFailed;
07968 }
07969
07970 Subtest += 1;
07971 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07972 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07973 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
07974 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
07975 Fsr.
Data =
CompareNgleDouble(ROUND_TO_NEAREST,
07976 &DoubleOperand1,
07977 &DoubleOperand2);
07978
07979
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
07980
goto TestFailed;
07981 }
07982
07983 Subtest += 1;
07984 DoubleOperand1.LowPart = 0x0;
07985 DoubleOperand1.HighPart = 0x81000;
07986 DoubleOperand2.LowPart = 0x0;
07987 DoubleOperand2.HighPart = 0x80000;
07988 Fsr.
Data =
CompareSeqDouble(ROUND_TO_NEAREST,
07989 &DoubleOperand1,
07990 &DoubleOperand2);
07991
07992
if (Fsr.
Data != ROUND_TO_NEAREST) {
07993
goto TestFailed;
07994 }
07995
07996 Subtest += 1;
07997 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
07998 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
07999 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08000 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08001 Fsr.
Data =
CompareSeqDouble(ROUND_TO_NEAREST,
08002 &DoubleOperand1,
08003 &DoubleOperand2);
08004
08005
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
08006
goto TestFailed;
08007 }
08008
08009 Subtest += 1;
08010 DoubleOperand1.LowPart = 0x0;
08011 DoubleOperand1.HighPart = 0x81000;
08012 DoubleOperand2.LowPart = 0x0;
08013 DoubleOperand2.HighPart = 0x80000;
08014 Fsr.
Data =
CompareNglDouble(ROUND_TO_NEAREST,
08015 &DoubleOperand1,
08016 &DoubleOperand2);
08017
08018
if (Fsr.
Data != ROUND_TO_NEAREST) {
08019
goto TestFailed;
08020 }
08021
08022 Subtest += 1;
08023 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08024 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08025 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08026 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08027 Fsr.
Data =
CompareNglDouble(ROUND_TO_NEAREST,
08028 &DoubleOperand1,
08029 &DoubleOperand2);
08030
08031
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
08032
goto TestFailed;
08033 }
08034
08035 Subtest += 1;
08036 DoubleOperand1.LowPart = 0x0;
08037 DoubleOperand1.HighPart = 0x81000;
08038 DoubleOperand2.LowPart = 0x0;
08039 DoubleOperand2.HighPart = 0x80000;
08040 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
08041 &DoubleOperand1,
08042 &DoubleOperand2);
08043
08044
if (Fsr.
Data != ROUND_TO_NEAREST) {
08045
goto TestFailed;
08046 }
08047
08048 Subtest += 1;
08049 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08050 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08051 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08052 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08053 Fsr.
Data =
CompareLtDouble(ROUND_TO_NEAREST,
08054 &DoubleOperand1,
08055 &DoubleOperand2);
08056
08057
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
08058
goto TestFailed;
08059 }
08060
08061 Subtest += 1;
08062 DoubleOperand1.LowPart = 0x0;
08063 DoubleOperand1.HighPart = 0x81000;
08064 DoubleOperand2.LowPart = 0x0;
08065 DoubleOperand2.HighPart = 0x80000;
08066 Fsr.
Data =
CompareNgeDouble(ROUND_TO_NEAREST,
08067 &DoubleOperand1,
08068 &DoubleOperand2);
08069
08070
if (Fsr.
Data != ROUND_TO_NEAREST) {
08071
goto TestFailed;
08072 }
08073
08074 Subtest += 1;
08075 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08076 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08077 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08078 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08079 Fsr.
Data =
CompareNgeDouble(ROUND_TO_NEAREST,
08080 &DoubleOperand1,
08081 &DoubleOperand2);
08082
08083
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
08084
goto TestFailed;
08085 }
08086
08087 Subtest += 1;
08088 DoubleOperand1.LowPart = 0x0;
08089 DoubleOperand1.HighPart = 0x81000;
08090 DoubleOperand2.LowPart = 0x0;
08091 DoubleOperand2.HighPart = 0x80000;
08092 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
08093 &DoubleOperand1,
08094 &DoubleOperand2);
08095
08096
if (Fsr.
Data != ROUND_TO_NEAREST) {
08097
goto TestFailed;
08098 }
08099
08100 Subtest += 1;
08101 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08102 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08103 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08104 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08105 Fsr.
Data =
CompareLeDouble(ROUND_TO_NEAREST,
08106 &DoubleOperand1,
08107 &DoubleOperand2);
08108
08109
if (Fsr.
Data != (
SV |
XV | ROUND_TO_NEAREST)) {
08110
goto TestFailed;
08111 }
08112
08113 Subtest += 1;
08114 DoubleOperand1.LowPart = 0x0;
08115 DoubleOperand1.HighPart = 0x81000;
08116 DoubleOperand2.LowPart = 0x0;
08117 DoubleOperand2.HighPart = 0x80000;
08118 Fsr.
Data =
CompareNgtDouble(ROUND_TO_NEAREST,
08119 &DoubleOperand1,
08120 &DoubleOperand2);
08121
08122
if (Fsr.
Data != ROUND_TO_NEAREST) {
08123
goto TestFailed;
08124 }
08125
08126 Subtest += 1;
08127 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08128 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08129 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08130 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08131 Fsr.
Data =
CompareNgtDouble(ROUND_TO_NEAREST,
08132 &DoubleOperand1,
08133 &DoubleOperand2);
08134
08135
if (Fsr.
Data != (
CC |
SV |
XV | ROUND_TO_NEAREST)) {
08136
goto TestFailed;
08137 }
08138
08139 Subtest += 1;
08140 DoubleOperand1.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08141 DoubleOperand1.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08142 DoubleOperand2.LowPart = DOUBLE_NAN_LOW;
08143 DoubleOperand2.HighPart = DOUBLE_QUIET_NAN;
08144
Count = 0;
08145
try {
08146 Fsr.
Data =
CompareSfDouble(
EV | ROUND_TO_NEAREST,
08147 &DoubleOperand1,
08148 &DoubleOperand2);
08149
08150 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08151
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08152
Count += 1;
08153 }
08154
08155
if (
Count == 0) {
08156
goto TestFailed;
08157 }
08158
08159 Subtest += 1;
08160 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08161 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08162 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08163 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08164
Count = 0;
08165
try {
08166 Fsr.
Data =
CompareNgleDouble(
EV | ROUND_TO_NEAREST,
08167 &DoubleOperand1,
08168 &DoubleOperand2);
08169
08170 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08171
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08172
Count += 1;
08173 }
08174
08175
if (
Count == 0) {
08176
goto TestFailed;
08177 }
08178
08179 Subtest += 1;
08180 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08181 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08182 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08183 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08184
Count = 0;
08185
try {
08186 Fsr.
Data =
CompareSeqDouble(
EV | ROUND_TO_NEAREST,
08187 &DoubleOperand1,
08188 &DoubleOperand2);
08189
08190 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08191
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08192
Count += 1;
08193 }
08194
08195
if (
Count == 0) {
08196
goto TestFailed;
08197 }
08198
08199 Subtest += 1;
08200 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08201 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08202 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08203 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08204
Count = 0;
08205
try {
08206 Fsr.
Data =
CompareNglDouble(
EV | ROUND_TO_NEAREST,
08207 &DoubleOperand1,
08208 &DoubleOperand2);
08209
08210 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08211
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08212
Count += 1;
08213 }
08214
08215
if (
Count == 0) {
08216
goto TestFailed;
08217 }
08218
08219 Subtest += 1;
08220 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08221 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08222 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08223 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08224
Count = 0;
08225
try {
08226 Fsr.
Data =
CompareLtDouble(
EV | ROUND_TO_NEAREST,
08227 &DoubleOperand1,
08228 &DoubleOperand2);
08229
08230 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08231
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08232
Count += 1;
08233 }
08234
08235
if (
Count == 0) {
08236
goto TestFailed;
08237 }
08238
08239 Subtest += 1;
08240 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08241 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08242 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08243 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08244
Count = 0;
08245
try {
08246 Fsr.
Data =
CompareNgeDouble(
EV | ROUND_TO_NEAREST,
08247 &DoubleOperand1,
08248 &DoubleOperand2);
08249
08250 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08251
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08252
Count += 1;
08253 }
08254
08255
if (
Count == 0) {
08256
goto TestFailed;
08257 }
08258
08259 Subtest += 1;
08260 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08261 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08262 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08263 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08264
Count = 0;
08265
try {
08266 Fsr.
Data =
CompareLeDouble(
EV | ROUND_TO_NEAREST,
08267 &DoubleOperand1,
08268 &DoubleOperand2);
08269
08270 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08271
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08272
Count += 1;
08273 }
08274
08275
if (
Count == 0) {
08276
goto TestFailed;
08277 }
08278
08279 Subtest += 1;
08280 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08281 DoubleOperand1.HighPart = DOUBLE_QUIET_NAN;
08282 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08283 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08284
Count = 0;
08285
try {
08286 Fsr.
Data =
CompareNgtDouble(
EV | ROUND_TO_NEAREST,
08287 &DoubleOperand1,
08288 &DoubleOperand2);
08289
08290 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08291
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08292
Count += 1;
08293 }
08294
08295
if (
Count == 0) {
08296
goto TestFailed;
08297 }
08298
08299 Subtest += 1;
08300 DoubleOperand1.LowPart = DOUBLE_NAN_LOW;
08301 DoubleOperand1.HighPart = DOUBLE_SIGNAL_NAN;
08302 DoubleOperand2.LowPart = DOUBLE_INFINITY_VALUE_LOW;
08303 DoubleOperand2.HighPart = DOUBLE_INFINITY_VALUE_HIGH;
08304
Count = 0;
08305
try {
08306 Fsr.
Data =
CompareEqDouble(
EV | ROUND_TO_NEAREST,
08307 &DoubleOperand1,
08308 &DoubleOperand2);
08309
08310 } except ((GetExceptionCode() == STATUS_FLOAT_INVALID_OPERATION) ?
08311
EXCEPTION_EXECUTE_HANDLER :
EXCEPTION_CONTINUE_SEARCH) {
08312
Count += 1;
08313 }
08314
08315
if (
Count == 0) {
08316
goto TestFailed;
08317 }
08318
08319
08320
08321
08322
08323 printf(
"succeeded\n");
08324
return;
08325
08326
08327
08328
08329
08330 TestFailed:
08331 printf(
" subtest %d failed, fsr = %lx\n", Subtest, Fsr.
Data);
08332
return;
08333 }