OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [testfloat/] [testLoops.c] - Blame information for rev 625

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 234 jeremybenn
 
2
/*
3
===============================================================================
4
 
5
This C source file is part of TestFloat, Release 2a, a package of programs
6
for testing the correctness of floating-point arithmetic complying to the
7
IEC/IEEE Standard for Floating-Point.
8
 
9
Written by John R. Hauser.  More information is available through the Web
10
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
11
 
12
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
13
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14
TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
15
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
17
 
18
Derivative works are acceptable, even for commercial purposes, so long as
19
(1) they include prominent notice that the work is derivative, and (2) they
20
include prominent notice akin to these four paragraphs for those parts of
21
this code that are retained.
22
 
23
Modified for use with or1ksim's testsuite.
24
 
25
Contributor Julius Baxter <julius.baxter@orsoc.se>
26
 
27
===============================================================================
28
*/
29
                                                                 /*
30
#include <stdlib.h>
31
#include <stdio.h>
32
                                                                 */
33
#include "support.h" // OR1k support C library
34
#include "milieu.h"
35
#include "softfloat.h"
36
#include "testCases.h"
37
#include "writeHex.h"
38
#include "testLoops.h"
39
 
40
volatile flag stop = FALSE;
41
 
42
char *trueName, *testName;
43
flag forever, errorStop;
44
uint32 maxErrorCount = 0;
45
flag checkNaNs = FALSE;
46
int8 *trueFlagsPtr;
47
int8 ( *testFlagsFunctionPtr )( void );
48
char *functionName;
49
char *roundingPrecisionName, *roundingModeName, *tininessModeName;
50
flag anyErrors = FALSE;
51
 
52
void
53
writeFunctionName( /* FILE *stream */ )
54
{
55
 
56
    printf( functionName/*, stream */ );
57
    if ( roundingModeName ) {
58
        if ( roundingPrecisionName ) {
59
            printf( ", precision "/*, stream */ );
60
            printf( roundingPrecisionName/*, stream */ );
61
        }
62
        printf( ", rounding "/*, stream */ );
63
        printf( roundingModeName/*, stream */ );
64
        if ( tininessModeName ) {
65
            printf( ", tininess "/*, stream */ );
66
            printf( tininessModeName/*, stream */ );
67
            printf( " rounding"/*, stream */ );
68
        }
69
    }
70
 
71
}
72
 
73
void
74
exitWithStatus( void )
75
{
76
 
77
  exit( anyErrors ? /*EXIT_FAILURE */ 0x1 : /* EXIT_SUCCESS */ 0 );
78
 
79
}
80
 
81
static uint32 tenthousandsCount, errorCount = 0;
82
 
83
static void
84
writeTestsTotal( void )
85
{
86
 
87
    if ( forever ) {
88
        printf( "Unbounded tests.\n"/*, stderr */ );
89
    }
90
    else {
91
        printf( "\r%d tests total.\n", testCases_total );
92
    }
93
 
94
}
95
 
96
static void
97
writeTestsPerformed( int16 count )
98
{
99
 
100
    if ( tenthousandsCount ) {
101
        printf(
102
             "\r%d%04d tests performed", tenthousandsCount, count );
103
    }
104
    else {
105
        printf(  "\r%d tests performed", count );
106
    }
107
    if ( errorCount ) {
108
        printf(
109
 
110
            "; %d error%s found.\n",
111
            errorCount,
112
            ( errorCount == 1 ) ? "" : "s"
113
        );
114
    }
115
    else {
116
        printf( ".\n"/*, stderr */ );
117
        printf( "No errors found in "/*, stdout*/ );
118
        writeFunctionName( /*stdout */ );
119
        printf( ".\n"/*, stdout*/ );
120
        //fflush( stdout );
121
    }
122
 
123
}
124
 
125
static void
126
checkEarlyExit( void )
127
{
128
 
129
    ++tenthousandsCount;
130
    if ( stop ) {
131
        writeTestsPerformed( 0 );
132
        exitWithStatus();
133
    }
134
    printf(  "\r%3d0000", tenthousandsCount );
135
 
136
}
137
 
138
static void
139
writeErrorFound( int16 count )
140
{
141
 
142
    putchar( '\r'/*, stderr */ );
143
    if ( errorCount == 1 ) {
144
        printf( "Errors found in "/*, stdout*/ );
145
        writeFunctionName( /*stdout*/ );
146
        printf( ":\n"/*, stdout*/ );
147
    }
148
    if ( stop ) {
149
        writeTestsPerformed( count );
150
        exitWithStatus();
151
    }
152
    anyErrors = TRUE;
153
 
154
}
155
 
156
INLINE void
157
writeInput_a_int32( void )
158
{
159
 
160
    writeHex_bits32( testCases_a_int32/*, stdout*/ );
161
 
162
}
163
 
164
#ifdef BITS64
165
 
166
INLINE void
167
writeInput_a_int64( void )
168
{
169
 
170
    writeHex_bits64( testCases_a_int64/*, stdout*/ );
171
 
172
}
173
 
174
#endif
175
 
176
INLINE void
177
writeInput_a_float32( void )
178
{
179
 
180
    writeHex_float32( testCases_a_float32/*, stdout*/ );
181
 
182
}
183
 
184
static void
185
writeInputs_ab_float32( void )
186
{
187
 
188
    writeHex_float32( testCases_a_float32/*, stdout*/ );
189
    printf( "  "/*, stdout*/ );
190
    writeHex_float32( testCases_b_float32/*, stdout*/ );
191
 
192
}
193
 
194
INLINE void
195
writeInput_a_float64( void )
196
{
197
 
198
    writeHex_float64( testCases_a_float64/*, stdout*/ );
199
 
200
}
201
 
202
static void
203
writeInputs_ab_float64( void )
204
{
205
 
206
    writeHex_float64( testCases_a_float64/*, stdout*/ );
207
    printf( "  "/*, stdout*/ );
208
    writeHex_float64( testCases_b_float64/*, stdout*/ );
209
 
210
}
211
 
212
#ifdef FLOATX80
213
 
214
INLINE void
215
writeInput_a_floatx80( void )
216
{
217
 
218
    writeHex_floatx80( testCases_a_floatx80/*, stdout*/ );
219
 
220
}
221
 
222
static void
223
writeInputs_ab_floatx80( void )
224
{
225
 
226
    writeHex_floatx80( testCases_a_floatx80/*, stdout*/ );
227
    printf( "  "/*, stdout*/ );
228
    writeHex_floatx80( testCases_b_floatx80/*, stdout*/ );
229
 
230
}
231
 
232
#endif
233
 
234
#ifdef FLOAT128
235
 
236
INLINE void
237
writeInput_a_float128( void )
238
{
239
 
240
    writeHex_float128( testCases_a_float128/*, stdout*/ );
241
 
242
}
243
 
244
static void
245
writeInputs_ab_float128( void )
246
{
247
 
248
    writeHex_float128( testCases_a_float128/*, stdout*/ );
249
    printf( "  "/*, stdout*/ );
250
    writeHex_float128( testCases_b_float128/*, stdout*/ );
251
 
252
}
253
 
254
#endif
255
 
256
static void
257
 writeOutputs_z_flag(
258
     flag trueZ, uint8 trueFlags, flag testZ, uint8 testFlags )
259
{
260
 
261
    printf( trueName/*, stdout*/ );
262
    printf( ": "/*, stdout*/ );
263
    writeHex_flag( trueZ/*, stdout*/ );
264
    putchar( ' '/*, stdout*/ );
265
    writeHex_float_flags( trueFlags/*, stdout*/ );
266
    printf( "  "/*, stdout*/ );
267
    printf( testName/*, stdout*/ );
268
    printf( ": "/*, stdout*/ );
269
    writeHex_flag( testZ/*, stdout*/ );
270
    putchar( ' '/*, stdout*/ );
271
    writeHex_float_flags( testFlags/*, stdout*/ );
272
    putchar( '\n'/*, stdout*/ );
273
 
274
}
275
 
276
static void
277
 writeOutputs_z_int32(
278
     int32 trueZ, uint8 trueFlags, int32 testZ, uint8 testFlags )
279
{
280
 
281
    printf( trueName/*, stdout*/ );
282
    printf( ": "/*, stdout*/ );
283
    writeHex_bits32( trueZ/*, stdout*/ );
284
    putchar( ' '/*, stdout*/ );
285
    writeHex_float_flags( trueFlags/*, stdout*/ );
286
    printf( "  "/*, stdout*/ );
287
    printf( testName/*, stdout*/ );
288
    printf( ": "/*, stdout*/ );
289
    writeHex_bits32( testZ/*, stdout*/ );
290
    putchar( ' '/*, stdout*/ );
291
    writeHex_float_flags( testFlags/*, stdout*/ );
292
    putchar( '\n'/*, stdout*/ );
293
 
294
}
295
 
296
#ifdef BITS64
297
 
298
static void
299
 writeOutputs_z_int64(
300
     int64 trueZ, uint8 trueFlags, int64 testZ, uint8 testFlags )
301
{
302
 
303
    printf( trueName/*, stdout*/ );
304
    printf( ": "/*, stdout*/ );
305
    writeHex_bits64( trueZ/*, stdout*/ );
306
    putchar( ' '/*, stdout*/ );
307
    writeHex_float_flags( trueFlags/*, stdout*/ );
308
    printf( "  "/*, stdout*/ );
309
    printf( testName/*, stdout*/ );
310
    printf( ": "/*, stdout*/ );
311
    writeHex_bits64( testZ/*, stdout*/ );
312
    putchar( ' '/*, stdout*/ );
313
    writeHex_float_flags( testFlags/*, stdout*/ );
314
    putchar( '\n'/*, stdout*/ );
315
 
316
}
317
 
318
#endif
319
 
320
static void
321
 writeOutputs_z_float32(
322
     float32 trueZ, uint8 trueFlags, float32 testZ, uint8 testFlags )
323
{
324
 
325
    printf( trueName/*, stdout*/ );
326
    printf( ": "/*, stdout*/ );
327
    writeHex_float32( trueZ/*, stdout*/ );
328
    putchar( ' '/*, stdout*/ );
329
    writeHex_float_flags( trueFlags/*, stdout*/ );
330
    printf( "  "/*, stdout*/ );
331
    printf( testName/*, stdout*/ );
332
    printf( ": "/*, stdout*/ );
333
    writeHex_float32( testZ/*, stdout*/ );
334
    putchar( ' '/*, stdout*/ );
335
    writeHex_float_flags( testFlags/*, stdout*/ );
336
    putchar( '\n'/*, stdout*/ );
337
 
338
}
339
 
340
static void
341
 writeOutputs_z_float64(
342
     float64 trueZ, uint8 trueFlags, float64 testZ, uint8 testFlags )
343
{
344
 
345
    printf( trueName/*, stdout*/ );
346
    printf( ": "/*, stdout*/ );
347
    writeHex_float64( trueZ/*, stdout*/ );
348
    putchar( ' '/*, stdout*/ );
349
    writeHex_float_flags( trueFlags/*, stdout*/ );
350
    printf( "  "/*, stdout*/ );
351
    printf( testName/*, stdout*/ );
352
    printf( ": "/*, stdout*/ );
353
    writeHex_float64( testZ/*, stdout*/ );
354
    putchar( ' '/*, stdout*/ );
355
    writeHex_float_flags( testFlags/*, stdout*/ );
356
    putchar( '\n'/*, stdout*/ );
357
 
358
}
359
 
360
#ifdef FLOATX80
361
 
362
static void
363
 writeOutputs_z_floatx80(
364
     floatx80 trueZ, uint8 trueFlags, floatx80 testZ, uint8 testFlags )
365
{
366
 
367
    printf( trueName/*, stdout*/ );
368
    printf( ": "/*, stdout*/ );
369
    writeHex_floatx80( trueZ/*, stdout*/ );
370
    putchar( ' '/*, stdout*/ );
371
    writeHex_float_flags( trueFlags/*, stdout*/ );
372
    printf( "  "/*, stdout*/ );
373
    printf( testName/*, stdout*/ );
374
    printf( ": "/*, stdout*/ );
375
    writeHex_floatx80( testZ/*, stdout*/ );
376
    putchar( ' '/*, stdout*/ );
377
    writeHex_float_flags( testFlags/*, stdout*/ );
378
    putchar( '\n'/*, stdout*/ );
379
 
380
}
381
 
382
#endif
383
 
384
#ifdef FLOAT128
385
 
386
static void
387
 writeOutputs_z_float128(
388
     float128 trueZ, uint8 trueFlags, float128 testZ, uint8 testFlags )
389
{
390
 
391
    printf( trueName/*, stdout*/ );
392
    printf( ": "/*, stdout*/ );
393
    writeHex_float128( trueZ/*, stdout*/ );
394
    putchar( ' '/*, stdout*/ );
395
    writeHex_float_flags( trueFlags/*, stdout*/ );
396
    printf( "\n\t"/*, stdout*/ );
397
    printf( testName/*, stdout*/ );
398
    printf( ": "/*, stdout*/ );
399
    writeHex_float128( testZ/*, stdout*/ );
400
    putchar( ' '/*, stdout*/ );
401
    writeHex_float_flags( testFlags/*, stdout*/ );
402
    putchar( '\n'/*, stdout*/ );
403
 
404
}
405
 
406
#endif
407
 
408
INLINE flag float32_isNaN( float32 a )
409
{
410
 
411
    return 0x7F800000 < ( a & 0x7FFFFFFF );
412
 
413
}
414
 
415
#ifdef BITS64
416
 
417
INLINE flag float64_same( float64 a, float64 b )
418
{
419
 
420
    return a == b;
421
 
422
}
423
 
424
INLINE flag float64_isNaN( float64 a )
425
{
426
 
427
    return LIT64( 0x7FF0000000000000 ) < ( a & LIT64( 0x7FFFFFFFFFFFFFFF ) );
428
 
429
}
430
 
431
#else
432
 
433
INLINE flag float64_same( float64 a, float64 b )
434
{
435
 
436
    return ( a.high == b.high ) && ( a.low == b.low );
437
 
438
}
439
 
440
INLINE flag float64_isNaN( float64 a )
441
{
442
    bits32 absAHigh;
443
 
444
    absAHigh = a.high & 0x7FFFFFFF;
445
    return
446
        ( 0x7FF00000 < absAHigh ) || ( ( absAHigh == 0x7FF00000 ) && a.low );
447
 
448
}
449
 
450
#endif
451
 
452
#ifdef FLOATX80
453
 
454
INLINE flag floatx80_same( floatx80 a, floatx80 b )
455
{
456
 
457
    return ( a.high == b.high ) && ( a.low == b.low );
458
 
459
}
460
 
461
INLINE flag floatx80_isNaN( floatx80 a )
462
{
463
 
464
    return ( ( a.high & 0x7FFF ) == 0x7FFF ) && a.low;
465
 
466
}
467
 
468
#endif
469
 
470
#ifdef FLOAT128
471
 
472
INLINE flag float128_same( float128 a, float128 b )
473
{
474
 
475
    return ( a.high == b.high ) && ( a.low == b.low );
476
 
477
}
478
 
479
INLINE flag float128_isNaN( float128 a )
480
{
481
    bits64 absAHigh;
482
 
483
    absAHigh = a.high & LIT64( 0x7FFFFFFFFFFFFFFF );
484
    return
485
           ( LIT64( 0x7FFF000000000000 ) < absAHigh )
486
        || ( ( absAHigh == LIT64( 0x7FFF000000000000 ) ) && a.low );
487
 
488
}
489
 
490
#endif
491
 
492
void
493
 test_a_int32_z_float32(
494
     float32 trueFunction( int32 ), float32 testFunction( int32 ) )
495
{
496
    int16 count;
497
    float32 trueZ, testZ;
498
    uint8 trueFlags, testFlags;
499
 
500
    errorCount = 0;
501
    tenthousandsCount = 0;
502
    count = 10000;
503
    testCases_initSequence( testCases_sequence_a_int32 );
504
    writeTestsTotal();
505
    while ( ! testCases_done || forever ) {
506
        testCases_next();
507
        *trueFlagsPtr = 0;
508
        trueZ = trueFunction( testCases_a_int32 );
509
        trueFlags = *trueFlagsPtr;
510
        (void) testFlagsFunctionPtr();
511
        testZ = testFunction( testCases_a_int32 );
512
        testFlags = testFlagsFunctionPtr();
513
        --count;
514
        if ( count == 0 ) {
515
            checkEarlyExit();
516
            count = 10000;
517
        }
518
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
519
            if (    ! checkNaNs
520
                 && float32_isNaN( trueZ )
521
                 && float32_isNaN( testZ )
522
                 && ! float32_is_signaling_nan( testZ )
523
                 && ( trueFlags == testFlags )
524
               ) {
525
                /* no problem */
526
            }
527
            else {
528
                ++errorCount;
529
                writeErrorFound( 10000 - count );
530
                writeInput_a_int32();
531
                printf( "  "/*, stdout*/ );
532
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
533
                //fflush( stdout );
534
                if ( errorCount == maxErrorCount ) goto exit;
535
            }
536
        }
537
    }
538
 exit:
539
    writeTestsPerformed( 10000 - count );
540
 
541
}
542
 
543
void
544
 test_a_int32_z_float64(
545
     float64 trueFunction( int32 ), float64 testFunction( int32 ) )
546
{
547
    int16 count;
548
    float64 trueZ, testZ;
549
    uint8 trueFlags, testFlags;
550
 
551
    errorCount = 0;
552
    tenthousandsCount = 0;
553
    count = 10000;
554
    testCases_initSequence( testCases_sequence_a_int32 );
555
    writeTestsTotal();
556
    while ( ! testCases_done || forever ) {
557
        testCases_next();
558
        *trueFlagsPtr = 0;
559
        trueZ = trueFunction( testCases_a_int32 );
560
        trueFlags = *trueFlagsPtr;
561
        (void) testFlagsFunctionPtr();
562
        testZ = testFunction( testCases_a_int32 );
563
        testFlags = testFlagsFunctionPtr();
564
        --count;
565
        if ( count == 0 ) {
566
            checkEarlyExit();
567
            count = 10000;
568
        }
569
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
570
            if (    ! checkNaNs
571
                 && float64_isNaN( trueZ )
572
                 && float64_isNaN( testZ )
573
                 && ! float64_is_signaling_nan( testZ )
574
                 && ( trueFlags == testFlags )
575
               ) {
576
                /* no problem */
577
            }
578
            else {
579
                ++errorCount;
580
                writeErrorFound( 10000 - count );
581
                writeInput_a_int32();
582
                printf( "  "/*, stdout*/ );
583
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
584
                //fflush( stdout );
585
                if ( errorCount == maxErrorCount ) goto exit;
586
            }
587
        }
588
    }
589
 exit:
590
    writeTestsPerformed( 10000 - count );
591
 
592
}
593
 
594
#ifdef FLOATX80
595
 
596
void
597
 test_a_int32_z_floatx80(
598
     floatx80 trueFunction( int32 ), floatx80 testFunction( int32 ) )
599
{
600
    int16 count;
601
    floatx80 trueZ, testZ;
602
    uint8 trueFlags, testFlags;
603
 
604
    errorCount = 0;
605
    tenthousandsCount = 0;
606
    count = 10000;
607
    testCases_initSequence( testCases_sequence_a_int32 );
608
    writeTestsTotal();
609
    while ( ! testCases_done || forever ) {
610
        testCases_next();
611
        *trueFlagsPtr = 0;
612
        trueZ = trueFunction( testCases_a_int32 );
613
        trueFlags = *trueFlagsPtr;
614
        (void) testFlagsFunctionPtr();
615
        testZ = testFunction( testCases_a_int32 );
616
        testFlags = testFlagsFunctionPtr();
617
        --count;
618
        if ( count == 0 ) {
619
            checkEarlyExit();
620
            count = 10000;
621
        }
622
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
623
            if (    ! checkNaNs
624
                 && floatx80_isNaN( trueZ )
625
                 && floatx80_isNaN( testZ )
626
                 && ! floatx80_is_signaling_nan( testZ )
627
                 && ( trueFlags == testFlags )
628
               ) {
629
                /* no problem */
630
            }
631
            else {
632
                ++errorCount;
633
                writeErrorFound( 10000 - count );
634
                writeInput_a_int32();
635
                printf( "  "/*, stdout*/ );
636
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
637
                //fflush( stdout );
638
                if ( errorCount == maxErrorCount ) goto exit;
639
            }
640
        }
641
    }
642
 exit:
643
    writeTestsPerformed( 10000 - count );
644
 
645
}
646
 
647
#endif
648
 
649
#ifdef FLOAT128
650
 
651
void
652
 test_a_int32_z_float128(
653
     float128 trueFunction( int32 ), float128 testFunction( int32 ) )
654
{
655
    int16 count;
656
    float128 trueZ, testZ;
657
    uint8 trueFlags, testFlags;
658
 
659
    errorCount = 0;
660
    tenthousandsCount = 0;
661
    count = 10000;
662
    testCases_initSequence( testCases_sequence_a_int32 );
663
    writeTestsTotal();
664
    while ( ! testCases_done || forever ) {
665
        testCases_next();
666
        *trueFlagsPtr = 0;
667
        trueZ = trueFunction( testCases_a_int32 );
668
        trueFlags = *trueFlagsPtr;
669
        (void) testFlagsFunctionPtr();
670
        testZ = testFunction( testCases_a_int32 );
671
        testFlags = testFlagsFunctionPtr();
672
        --count;
673
        if ( count == 0 ) {
674
            checkEarlyExit();
675
            count = 10000;
676
        }
677
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
678
            if (    ! checkNaNs
679
                 && float128_isNaN( trueZ )
680
                 && float128_isNaN( testZ )
681
                 && ! float128_is_signaling_nan( testZ )
682
                 && ( trueFlags == testFlags )
683
               ) {
684
                /* no problem */
685
            }
686
            else {
687
                ++errorCount;
688
                writeErrorFound( 10000 - count );
689
                writeInput_a_int32();
690
                printf( "\n\t"/*, stdout*/ );
691
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
692
                //fflush( stdout );
693
                if ( errorCount == maxErrorCount ) goto exit;
694
            }
695
        }
696
    }
697
 exit:
698
    writeTestsPerformed( 10000 - count );
699
 
700
}
701
 
702
#endif
703
 
704
#ifdef BITS64
705
 
706
void
707
 test_a_int64_z_float32(
708
     float32 trueFunction( int64 ), float32 testFunction( int64 ) )
709
{
710
    int16 count;
711
    float32 trueZ, testZ;
712
    uint8 trueFlags, testFlags;
713
 
714
    errorCount = 0;
715
    tenthousandsCount = 0;
716
    count = 10000;
717
    testCases_initSequence( testCases_sequence_a_int64 );
718
    writeTestsTotal();
719
    while ( ! testCases_done || forever ) {
720
        testCases_next();
721
        *trueFlagsPtr = 0;
722
        trueZ = trueFunction( testCases_a_int64 );
723
        trueFlags = *trueFlagsPtr;
724
        (void) testFlagsFunctionPtr();
725
        testZ = testFunction( testCases_a_int64 );
726
        testFlags = testFlagsFunctionPtr();
727
        --count;
728
        if ( count == 0 ) {
729
            checkEarlyExit();
730
            count = 10000;
731
        }
732
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
733
            if (    ! checkNaNs
734
                 && float32_isNaN( trueZ )
735
                 && float32_isNaN( testZ )
736
                 && ! float32_is_signaling_nan( testZ )
737
                 && ( trueFlags == testFlags )
738
               ) {
739
                /* no problem */
740
            }
741
            else {
742
                ++errorCount;
743
                writeErrorFound( 10000 - count );
744
                writeInput_a_int64();
745
                printf( "  "/*, stdout*/ );
746
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
747
                //fflush( stdout );
748
                if ( errorCount == maxErrorCount ) goto exit;
749
            }
750
        }
751
    }
752
 exit:
753
    writeTestsPerformed( 10000 - count );
754
 
755
}
756
 
757
void
758
 test_a_int64_z_float64(
759
     float64 trueFunction( int64 ), float64 testFunction( int64 ) )
760
{
761
    int16 count;
762
    float64 trueZ, testZ;
763
    uint8 trueFlags, testFlags;
764
 
765
    errorCount = 0;
766
    tenthousandsCount = 0;
767
    count = 10000;
768
    testCases_initSequence( testCases_sequence_a_int64 );
769
    writeTestsTotal();
770
    while ( ! testCases_done || forever ) {
771
        testCases_next();
772
        *trueFlagsPtr = 0;
773
        trueZ = trueFunction( testCases_a_int64 );
774
        trueFlags = *trueFlagsPtr;
775
        (void) testFlagsFunctionPtr();
776
        testZ = testFunction( testCases_a_int64 );
777
        testFlags = testFlagsFunctionPtr();
778
        --count;
779
        if ( count == 0 ) {
780
            checkEarlyExit();
781
            count = 10000;
782
        }
783
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
784
            if (    ! checkNaNs
785
                 && float64_isNaN( trueZ )
786
                 && float64_isNaN( testZ )
787
                 && ! float64_is_signaling_nan( testZ )
788
                 && ( trueFlags == testFlags )
789
               ) {
790
                /* no problem */
791
            }
792
            else {
793
                ++errorCount;
794
                writeErrorFound( 10000 - count );
795
                writeInput_a_int64();
796
                printf( "  "/*, stdout*/ );
797
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
798
                //fflush( stdout );
799
                if ( errorCount == maxErrorCount ) goto exit;
800
            }
801
        }
802
    }
803
 exit:
804
    writeTestsPerformed( 10000 - count );
805
 
806
}
807
 
808
#ifdef FLOATX80
809
 
810
void
811
 test_a_int64_z_floatx80(
812
     floatx80 trueFunction( int64 ), floatx80 testFunction( int64 ) )
813
{
814
    int16 count;
815
    floatx80 trueZ, testZ;
816
    uint8 trueFlags, testFlags;
817
 
818
    errorCount = 0;
819
    tenthousandsCount = 0;
820
    count = 10000;
821
    testCases_initSequence( testCases_sequence_a_int64 );
822
    writeTestsTotal();
823
    while ( ! testCases_done || forever ) {
824
        testCases_next();
825
        *trueFlagsPtr = 0;
826
        trueZ = trueFunction( testCases_a_int64 );
827
        trueFlags = *trueFlagsPtr;
828
        (void) testFlagsFunctionPtr();
829
        testZ = testFunction( testCases_a_int64 );
830
        testFlags = testFlagsFunctionPtr();
831
        --count;
832
        if ( count == 0 ) {
833
            checkEarlyExit();
834
            count = 10000;
835
        }
836
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
837
            if (    ! checkNaNs
838
                 && floatx80_isNaN( trueZ )
839
                 && floatx80_isNaN( testZ )
840
                 && ! floatx80_is_signaling_nan( testZ )
841
                 && ( trueFlags == testFlags )
842
               ) {
843
                /* no problem */
844
            }
845
            else {
846
                ++errorCount;
847
                writeErrorFound( 10000 - count );
848
                writeInput_a_int64();
849
                printf( "  "/*, stdout*/ );
850
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
851
                //fflush( stdout );
852
                if ( errorCount == maxErrorCount ) goto exit;
853
            }
854
        }
855
    }
856
 exit:
857
    writeTestsPerformed( 10000 - count );
858
 
859
}
860
 
861
#endif
862
 
863
#ifdef FLOAT128
864
 
865
void
866
 test_a_int64_z_float128(
867
     float128 trueFunction( int64 ), float128 testFunction( int64 ) )
868
{
869
    int16 count;
870
    float128 trueZ, testZ;
871
    uint8 trueFlags, testFlags;
872
 
873
    errorCount = 0;
874
    tenthousandsCount = 0;
875
    count = 10000;
876
    testCases_initSequence( testCases_sequence_a_int64 );
877
    writeTestsTotal();
878
    while ( ! testCases_done || forever ) {
879
        testCases_next();
880
        *trueFlagsPtr = 0;
881
        trueZ = trueFunction( testCases_a_int64 );
882
        trueFlags = *trueFlagsPtr;
883
        (void) testFlagsFunctionPtr();
884
        testZ = testFunction( testCases_a_int64 );
885
        testFlags = testFlagsFunctionPtr();
886
        --count;
887
        if ( count == 0 ) {
888
            checkEarlyExit();
889
            count = 10000;
890
        }
891
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
892
            if (    ! checkNaNs
893
                 && float128_isNaN( trueZ )
894
                 && float128_isNaN( testZ )
895
                 && ! float128_is_signaling_nan( testZ )
896
                 && ( trueFlags == testFlags )
897
               ) {
898
                /* no problem */
899
            }
900
            else {
901
                ++errorCount;
902
                writeErrorFound( 10000 - count );
903
                writeInput_a_int64();
904
                printf( "\n\t"/*, stdout*/ );
905
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
906
                //fflush( stdout );
907
                if ( errorCount == maxErrorCount ) goto exit;
908
            }
909
        }
910
    }
911
 exit:
912
    writeTestsPerformed( 10000 - count );
913
 
914
}
915
 
916
#endif
917
 
918
#endif
919
 
920
void
921
 test_a_float32_z_int32(
922
     int32 trueFunction( float32 ), int32 testFunction( float32 ) )
923
{
924
    int16 count;
925
    int32 trueZ, testZ;
926
    uint8 trueFlags, testFlags;
927
 
928
    errorCount = 0;
929
    tenthousandsCount = 0;
930
    count = 10000;
931
    testCases_initSequence( testCases_sequence_a_float32 );
932
    writeTestsTotal();
933
    while ( ! testCases_done || forever ) {
934
        testCases_next();
935
        *trueFlagsPtr = 0;
936
        trueZ = trueFunction( testCases_a_float32 );
937
        trueFlags = *trueFlagsPtr;
938
        (void) testFlagsFunctionPtr();
939
        testZ = testFunction( testCases_a_float32 );
940
        testFlags = testFlagsFunctionPtr();
941
        --count;
942
        if ( count == 0 ) {
943
            checkEarlyExit();
944
            count = 10000;
945
        }
946
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
947
            if (    ! checkNaNs
948
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
949
                trueFlags |= float_flag_invalid;
950
            }
951
            if (    ( trueZ == 0x7FFFFFFF )
952
                 && (    ( testZ == 0x7FFFFFFF )
953
                      || ( testZ == (sbits32) 0x80000000 ) )
954
                 && ( trueFlags == float_flag_invalid )
955
                 && ( testFlags == float_flag_invalid )
956
               ) {
957
                /* no problem */
958
            }
959
            else {
960
                ++errorCount;
961
                writeErrorFound( 10000 - count );
962
                writeInput_a_float32();
963
                printf( "  "/*, stdout*/ );
964
                writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
965
                //fflush( stdout );
966
                if ( errorCount == maxErrorCount ) goto exit;
967
            }
968
        }
969
    }
970
 exit:
971
    writeTestsPerformed( 10000 - count );
972
 
973
}
974
 
975
#ifdef BITS64
976
 
977
void
978
 test_a_float32_z_int64(
979
     int64 trueFunction( float32 ), int64 testFunction( float32 ) )
980
{
981
    int16 count;
982
    int64 trueZ, testZ;
983
    uint8 trueFlags, testFlags;
984
 
985
    errorCount = 0;
986
    tenthousandsCount = 0;
987
    count = 10000;
988
    testCases_initSequence( testCases_sequence_a_float32 );
989
    writeTestsTotal();
990
    while ( ! testCases_done || forever ) {
991
        testCases_next();
992
        *trueFlagsPtr = 0;
993
        trueZ = trueFunction( testCases_a_float32 );
994
        trueFlags = *trueFlagsPtr;
995
        (void) testFlagsFunctionPtr();
996
        testZ = testFunction( testCases_a_float32 );
997
        testFlags = testFlagsFunctionPtr();
998
        --count;
999
        if ( count == 0 ) {
1000
            checkEarlyExit();
1001
            count = 10000;
1002
        }
1003
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1004
            if (    ! checkNaNs
1005
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1006
                trueFlags |= float_flag_invalid;
1007
            }
1008
            if (    ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1009
                 && (    ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1010
                      || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
1011
                 && ( trueFlags == float_flag_invalid )
1012
                 && ( testFlags == float_flag_invalid )
1013
               ) {
1014
                /* no problem */
1015
            }
1016
            else {
1017
                ++errorCount;
1018
                writeErrorFound( 10000 - count );
1019
                writeInput_a_float32();
1020
                printf( "  "/*, stdout*/ );
1021
                writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1022
                //fflush( stdout );
1023
                if ( errorCount == maxErrorCount ) goto exit;
1024
            }
1025
        }
1026
    }
1027
 exit:
1028
    writeTestsPerformed( 10000 - count );
1029
 
1030
}
1031
 
1032
#endif
1033
 
1034
void
1035
 test_a_float32_z_float64(
1036
     float64 trueFunction( float32 ), float64 testFunction( float32 ) )
1037
{
1038
    int16 count;
1039
    float64 trueZ, testZ;
1040
    uint8 trueFlags, testFlags;
1041
 
1042
    errorCount = 0;
1043
    tenthousandsCount = 0;
1044
    count = 10000;
1045
    testCases_initSequence( testCases_sequence_a_float32 );
1046
    writeTestsTotal();
1047
    while ( ! testCases_done || forever ) {
1048
        testCases_next();
1049
        *trueFlagsPtr = 0;
1050
        trueZ = trueFunction( testCases_a_float32 );
1051
        trueFlags = *trueFlagsPtr;
1052
        (void) testFlagsFunctionPtr();
1053
        testZ = testFunction( testCases_a_float32 );
1054
        testFlags = testFlagsFunctionPtr();
1055
        --count;
1056
        if ( count == 0 ) {
1057
            checkEarlyExit();
1058
            count = 10000;
1059
        }
1060
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1061
            if (    ! checkNaNs
1062
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1063
                trueFlags |= float_flag_invalid;
1064
            }
1065
            if (    ! checkNaNs
1066
                 && float64_isNaN( trueZ )
1067
                 && float64_isNaN( testZ )
1068
                 && ! float64_is_signaling_nan( testZ )
1069
                 && ( trueFlags == testFlags )
1070
               ) {
1071
                /* no problem */
1072
            }
1073
            else {
1074
                ++errorCount;
1075
                writeErrorFound( 10000 - count );
1076
                writeInput_a_float32();
1077
                printf( "  "/*, stdout*/ );
1078
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1079
                //fflush( stdout );
1080
                if ( errorCount == maxErrorCount ) goto exit;
1081
            }
1082
        }
1083
    }
1084
 exit:
1085
    writeTestsPerformed( 10000 - count );
1086
 
1087
}
1088
 
1089
#ifdef FLOATX80
1090
 
1091
void
1092
 test_a_float32_z_floatx80(
1093
     floatx80 trueFunction( float32 ), floatx80 testFunction( float32 ) )
1094
{
1095
    int16 count;
1096
    floatx80 trueZ, testZ;
1097
    uint8 trueFlags, testFlags;
1098
 
1099
    errorCount = 0;
1100
    tenthousandsCount = 0;
1101
    count = 10000;
1102
    testCases_initSequence( testCases_sequence_a_float32 );
1103
    writeTestsTotal();
1104
    while ( ! testCases_done || forever ) {
1105
        testCases_next();
1106
        *trueFlagsPtr = 0;
1107
        trueZ = trueFunction( testCases_a_float32 );
1108
        trueFlags = *trueFlagsPtr;
1109
        (void) testFlagsFunctionPtr();
1110
        testZ = testFunction( testCases_a_float32 );
1111
        testFlags = testFlagsFunctionPtr();
1112
        --count;
1113
        if ( count == 0 ) {
1114
            checkEarlyExit();
1115
            count = 10000;
1116
        }
1117
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1118
            if (    ! checkNaNs
1119
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1120
                trueFlags |= float_flag_invalid;
1121
            }
1122
            if (    ! checkNaNs
1123
                 && floatx80_isNaN( trueZ )
1124
                 && floatx80_isNaN( testZ )
1125
                 && ! floatx80_is_signaling_nan( testZ )
1126
                 && ( trueFlags == testFlags )
1127
               ) {
1128
                /* no problem */
1129
            }
1130
            else {
1131
                ++errorCount;
1132
                writeErrorFound( 10000 - count );
1133
                writeInput_a_float32();
1134
                printf( "\n\t"/*, stdout*/ );
1135
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
1136
                //fflush( stdout );
1137
                if ( errorCount == maxErrorCount ) goto exit;
1138
            }
1139
        }
1140
    }
1141
 exit:
1142
    writeTestsPerformed( 10000 - count );
1143
 
1144
}
1145
 
1146
#endif
1147
 
1148
#ifdef FLOAT128
1149
 
1150
void
1151
 test_a_float32_z_float128(
1152
     float128 trueFunction( float32 ), float128 testFunction( float32 ) )
1153
{
1154
    int16 count;
1155
    float128 trueZ, testZ;
1156
    uint8 trueFlags, testFlags;
1157
 
1158
    errorCount = 0;
1159
    tenthousandsCount = 0;
1160
    count = 10000;
1161
    testCases_initSequence( testCases_sequence_a_float32 );
1162
    writeTestsTotal();
1163
    while ( ! testCases_done || forever ) {
1164
        testCases_next();
1165
        *trueFlagsPtr = 0;
1166
        trueZ = trueFunction( testCases_a_float32 );
1167
        trueFlags = *trueFlagsPtr;
1168
        (void) testFlagsFunctionPtr();
1169
        testZ = testFunction( testCases_a_float32 );
1170
        testFlags = testFlagsFunctionPtr();
1171
        --count;
1172
        if ( count == 0 ) {
1173
            checkEarlyExit();
1174
            count = 10000;
1175
        }
1176
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1177
            if (    ! checkNaNs
1178
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1179
                trueFlags |= float_flag_invalid;
1180
            }
1181
            if (    ! checkNaNs
1182
                 && float128_isNaN( trueZ )
1183
                 && float128_isNaN( testZ )
1184
                 && ! float128_is_signaling_nan( testZ )
1185
                 && ( trueFlags == testFlags )
1186
               ) {
1187
                /* no problem */
1188
            }
1189
            else {
1190
                ++errorCount;
1191
                writeErrorFound( 10000 - count );
1192
                writeInput_a_float32();
1193
                printf( "\n\t"/*, stdout*/ );
1194
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
1195
                //fflush( stdout );
1196
                if ( errorCount == maxErrorCount ) goto exit;
1197
            }
1198
        }
1199
    }
1200
 exit:
1201
    writeTestsPerformed( 10000 - count );
1202
 
1203
}
1204
 
1205
#endif
1206
 
1207
void
1208
 test_az_float32(
1209
     float32 trueFunction( float32 ), float32 testFunction( float32 ) )
1210
{
1211
    int16 count;
1212
    float32 trueZ, testZ;
1213
    uint8 trueFlags, testFlags;
1214
 
1215
    errorCount = 0;
1216
    tenthousandsCount = 0;
1217
    count = 10000;
1218
    testCases_initSequence( testCases_sequence_a_float32 );
1219
    writeTestsTotal();
1220
    while ( ! testCases_done || forever ) {
1221
        testCases_next();
1222
        *trueFlagsPtr = 0;
1223
        trueZ = trueFunction( testCases_a_float32 );
1224
        trueFlags = *trueFlagsPtr;
1225
        (void) testFlagsFunctionPtr();
1226
        testZ = testFunction( testCases_a_float32 );
1227
        testFlags = testFlagsFunctionPtr();
1228
        --count;
1229
        if ( count == 0 ) {
1230
            checkEarlyExit();
1231
            count = 10000;
1232
        }
1233
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1234
            if (    ! checkNaNs
1235
                 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1236
                trueFlags |= float_flag_invalid;
1237
            }
1238
            if (    ! checkNaNs
1239
                 && float32_isNaN( trueZ )
1240
                 && float32_isNaN( testZ )
1241
                 && ! float32_is_signaling_nan( testZ )
1242
                 && ( trueFlags == testFlags )
1243
               ) {
1244
                /* no problem */
1245
            }
1246
            else {
1247
                ++errorCount;
1248
                writeErrorFound( 10000 - count );
1249
                writeInput_a_float32();
1250
                printf( "  "/*, stdout*/ );
1251
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1252
                //fflush( stdout );
1253
                if ( errorCount == maxErrorCount ) goto exit;
1254
            }
1255
        }
1256
    }
1257
 exit:
1258
    writeTestsPerformed( 10000 - count );
1259
 
1260
}
1261
 
1262
void
1263
 test_ab_float32_z_flag(
1264
     flag trueFunction( float32, float32 ),
1265
     flag testFunction( float32, float32 )
1266
 )
1267
{
1268
    int16 count;
1269
    flag trueZ, testZ;
1270
    uint8 trueFlags, testFlags;
1271
 
1272
    errorCount = 0;
1273
    tenthousandsCount = 0;
1274
    count = 10000;
1275
    testCases_initSequence( testCases_sequence_ab_float32 );
1276
    writeTestsTotal();
1277
    while ( ! testCases_done || forever ) {
1278
        testCases_next();
1279
        *trueFlagsPtr = 0;
1280
        trueZ = trueFunction( testCases_a_float32, testCases_b_float32 );
1281
        trueFlags = *trueFlagsPtr;
1282
        (void) testFlagsFunctionPtr();
1283
        testZ = testFunction( testCases_a_float32, testCases_b_float32 );
1284
        testFlags = testFlagsFunctionPtr();
1285
        --count;
1286
        if ( count == 0 ) {
1287
            checkEarlyExit();
1288
            count = 10000;
1289
        }
1290
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1291
            if (    ! checkNaNs
1292
                 && (    float32_is_signaling_nan( testCases_a_float32 )
1293
                      || float32_is_signaling_nan( testCases_b_float32 ) )
1294
               ) {
1295
                trueFlags |= float_flag_invalid;
1296
            }
1297
            if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1298
                ++errorCount;
1299
                writeErrorFound( 10000 - count );
1300
                writeInputs_ab_float32();
1301
                puts( "  "/*, stdout*/ );
1302
                writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
1303
                //fflush( stdout );
1304
                if ( errorCount == maxErrorCount ) goto exit;
1305
            }
1306
        }
1307
    }
1308
 exit:
1309
    writeTestsPerformed( 10000 - count );
1310
    return;
1311
 
1312
}
1313
 
1314
void
1315
 test_abz_float32(
1316
     float32 trueFunction( float32, float32 ),
1317
     float32 testFunction( float32, float32 )
1318
 )
1319
{
1320
    int16 count;
1321
    float32 trueZ, testZ;
1322
    uint8 trueFlags, testFlags;
1323
 
1324
    errorCount = 0;
1325
    tenthousandsCount = 0;
1326
    count = 10000;
1327
    testCases_initSequence( testCases_sequence_ab_float32 );
1328
    writeTestsTotal();
1329
    while ( ! testCases_done || forever ) {
1330
        testCases_next();
1331
        *trueFlagsPtr = 0;
1332
        trueZ = trueFunction( testCases_a_float32, testCases_b_float32 );
1333
        trueFlags = *trueFlagsPtr;
1334
        (void) testFlagsFunctionPtr();
1335
        testZ = testFunction( testCases_a_float32, testCases_b_float32 );
1336
        testFlags = testFlagsFunctionPtr();
1337
        --count;
1338
        if ( count == 0 ) {
1339
            checkEarlyExit();
1340
            count = 10000;
1341
        }
1342
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1343
            if (    ! checkNaNs
1344
                 && (    float32_is_signaling_nan( testCases_a_float32 )
1345
                      || float32_is_signaling_nan( testCases_b_float32 ) )
1346
               ) {
1347
                trueFlags |= float_flag_invalid;
1348
            }
1349
            if (    ! checkNaNs
1350
                 && float32_isNaN( trueZ )
1351
                 && float32_isNaN( testZ )
1352
                 && ! float32_is_signaling_nan( testZ )
1353
                 && ( trueFlags == testFlags )
1354
               ) {
1355
                /* no problem */
1356
            }
1357
            else {
1358
                ++errorCount;
1359
                writeErrorFound( 10000 - count );
1360
                writeInputs_ab_float32();
1361
                puts( "  "/*, stdout*/ );
1362
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1363
                //fflush( stdout );
1364
                if ( errorCount == maxErrorCount ) goto exit;
1365
            }
1366
        }
1367
    }
1368
 exit:
1369
    writeTestsPerformed( 10000 - count );
1370
    return;
1371
 
1372
}
1373
 
1374
void
1375
 test_a_float64_z_int32(
1376
     int32 trueFunction( float64 ), int32 testFunction( float64 ) )
1377
{
1378
    int16 count;
1379
    int32 trueZ, testZ;
1380
    uint8 trueFlags, testFlags;
1381
 
1382
    errorCount = 0;
1383
    tenthousandsCount = 0;
1384
    count = 10000;
1385
    testCases_initSequence( testCases_sequence_a_float64 );
1386
    writeTestsTotal();
1387
    while ( ! testCases_done || forever ) {
1388
        testCases_next();
1389
        *trueFlagsPtr = 0;
1390
        trueZ = trueFunction( testCases_a_float64 );
1391
        trueFlags = *trueFlagsPtr;
1392
        (void) testFlagsFunctionPtr();
1393
        testZ = testFunction( testCases_a_float64 );
1394
        testFlags = testFlagsFunctionPtr();
1395
        --count;
1396
        if ( count == 0 ) {
1397
            checkEarlyExit();
1398
            count = 10000;
1399
        }
1400
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1401
            if (    ! checkNaNs
1402
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1403
                trueFlags |= float_flag_invalid;
1404
            }
1405
            if (    ( trueZ == 0x7FFFFFFF )
1406
                 && (    ( testZ == 0x7FFFFFFF )
1407
                      || ( testZ == (sbits32) 0x80000000 ) )
1408
                 && ( trueFlags == float_flag_invalid )
1409
                 && ( testFlags == float_flag_invalid )
1410
               ) {
1411
                /* no problem */
1412
            }
1413
            else {
1414
                ++errorCount;
1415
                writeErrorFound( 10000 - count );
1416
                writeInput_a_float64();
1417
                puts( "  "/*, stdout*/ );
1418
                writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
1419
                //fflush( stdout );
1420
                if ( errorCount == maxErrorCount ) goto exit;
1421
            }
1422
        }
1423
    }
1424
 exit:
1425
    writeTestsPerformed( 10000 - count );
1426
 
1427
}
1428
 
1429
#ifdef BITS64
1430
 
1431
void
1432
 test_a_float64_z_int64(
1433
     int64 trueFunction( float64 ), int64 testFunction( float64 ) )
1434
{
1435
    int16 count;
1436
    int64 trueZ, testZ;
1437
    uint8 trueFlags, testFlags;
1438
 
1439
    errorCount = 0;
1440
    tenthousandsCount = 0;
1441
    count = 10000;
1442
    testCases_initSequence( testCases_sequence_a_float64 );
1443
    writeTestsTotal();
1444
    while ( ! testCases_done || forever ) {
1445
        testCases_next();
1446
        *trueFlagsPtr = 0;
1447
        trueZ = trueFunction( testCases_a_float64 );
1448
        trueFlags = *trueFlagsPtr;
1449
        (void) testFlagsFunctionPtr();
1450
        testZ = testFunction( testCases_a_float64 );
1451
        testFlags = testFlagsFunctionPtr();
1452
        --count;
1453
        if ( count == 0 ) {
1454
            checkEarlyExit();
1455
            count = 10000;
1456
        }
1457
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1458
            if (    ! checkNaNs
1459
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1460
                trueFlags |= float_flag_invalid;
1461
            }
1462
            if (    ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1463
                 && (    ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1464
                      || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
1465
                 && ( trueFlags == float_flag_invalid )
1466
                 && ( testFlags == float_flag_invalid )
1467
               ) {
1468
                /* no problem */
1469
            }
1470
            else {
1471
                ++errorCount;
1472
                writeErrorFound( 10000 - count );
1473
                writeInput_a_float64();
1474
                puts( "  "/*, stdout*/ );
1475
                writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1476
                //fflush( stdout );
1477
                if ( errorCount == maxErrorCount ) goto exit;
1478
            }
1479
        }
1480
    }
1481
 exit:
1482
    writeTestsPerformed( 10000 - count );
1483
 
1484
}
1485
 
1486
#endif
1487
 
1488
void
1489
 test_a_float64_z_float32(
1490
     float32 trueFunction( float64 ), float32 testFunction( float64 ) )
1491
{
1492
    int16 count;
1493
    float32 trueZ, testZ;
1494
    uint8 trueFlags, testFlags;
1495
 
1496
    errorCount = 0;
1497
    tenthousandsCount = 0;
1498
    count = 10000;
1499
    testCases_initSequence( testCases_sequence_a_float64 );
1500
    writeTestsTotal();
1501
    while ( ! testCases_done || forever ) {
1502
        testCases_next();
1503
        *trueFlagsPtr = 0;
1504
        trueZ = trueFunction( testCases_a_float64 );
1505
        trueFlags = *trueFlagsPtr;
1506
        (void) testFlagsFunctionPtr();
1507
        testZ = testFunction( testCases_a_float64 );
1508
        testFlags = testFlagsFunctionPtr();
1509
        --count;
1510
        if ( count == 0 ) {
1511
            checkEarlyExit();
1512
            count = 10000;
1513
        }
1514
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1515
            if (    ! checkNaNs
1516
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1517
                trueFlags |= float_flag_invalid;
1518
            }
1519
            if (    ! checkNaNs
1520
                 && float32_isNaN( trueZ )
1521
                 && float32_isNaN( testZ )
1522
                 && ! float32_is_signaling_nan( testZ )
1523
                 && ( trueFlags == testFlags )
1524
               ) {
1525
                /* no problem */
1526
            }
1527
            else {
1528
                ++errorCount;
1529
                writeErrorFound( 10000 - count );
1530
                writeInput_a_float64();
1531
                puts( "  "/*, stdout*/ );
1532
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1533
                //fflush( stdout );
1534
                if ( errorCount == maxErrorCount ) goto exit;
1535
            }
1536
        }
1537
    }
1538
 exit:
1539
    writeTestsPerformed( 10000 - count );
1540
 
1541
}
1542
 
1543
#ifdef FLOATX80
1544
 
1545
void
1546
 test_a_float64_z_floatx80(
1547
     floatx80 trueFunction( float64 ), floatx80 testFunction( float64 ) )
1548
{
1549
    int16 count;
1550
    floatx80 trueZ, testZ;
1551
    uint8 trueFlags, testFlags;
1552
 
1553
    errorCount = 0;
1554
    tenthousandsCount = 0;
1555
    count = 10000;
1556
    testCases_initSequence( testCases_sequence_a_float64 );
1557
    writeTestsTotal();
1558
    while ( ! testCases_done || forever ) {
1559
        testCases_next();
1560
        *trueFlagsPtr = 0;
1561
        trueZ = trueFunction( testCases_a_float64 );
1562
        trueFlags = *trueFlagsPtr;
1563
        (void) testFlagsFunctionPtr();
1564
        testZ = testFunction( testCases_a_float64 );
1565
        testFlags = testFlagsFunctionPtr();
1566
        --count;
1567
        if ( count == 0 ) {
1568
            checkEarlyExit();
1569
            count = 10000;
1570
        }
1571
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1572
            if (    ! checkNaNs
1573
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1574
                trueFlags |= float_flag_invalid;
1575
            }
1576
            if (    ! checkNaNs
1577
                 && floatx80_isNaN( trueZ )
1578
                 && floatx80_isNaN( testZ )
1579
                 && ! floatx80_is_signaling_nan( testZ )
1580
                 && ( trueFlags == testFlags )
1581
               ) {
1582
                /* no problem */
1583
            }
1584
            else {
1585
                ++errorCount;
1586
                writeErrorFound( 10000 - count );
1587
                writeInput_a_float64();
1588
                puts( "\n\t"/*, stdout*/ );
1589
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
1590
                //fflush( stdout );
1591
                if ( errorCount == maxErrorCount ) goto exit;
1592
            }
1593
        }
1594
    }
1595
 exit:
1596
    writeTestsPerformed( 10000 - count );
1597
 
1598
}
1599
 
1600
#endif
1601
 
1602
#ifdef FLOAT128
1603
 
1604
void
1605
 test_a_float64_z_float128(
1606
     float128 trueFunction( float64 ), float128 testFunction( float64 ) )
1607
{
1608
    int16 count;
1609
    float128 trueZ, testZ;
1610
    uint8 trueFlags, testFlags;
1611
 
1612
    errorCount = 0;
1613
    tenthousandsCount = 0;
1614
    count = 10000;
1615
    testCases_initSequence( testCases_sequence_a_float64 );
1616
    writeTestsTotal();
1617
    while ( ! testCases_done || forever ) {
1618
        testCases_next();
1619
        *trueFlagsPtr = 0;
1620
        trueZ = trueFunction( testCases_a_float64 );
1621
        trueFlags = *trueFlagsPtr;
1622
        (void) testFlagsFunctionPtr();
1623
        testZ = testFunction( testCases_a_float64 );
1624
        testFlags = testFlagsFunctionPtr();
1625
        --count;
1626
        if ( count == 0 ) {
1627
            checkEarlyExit();
1628
            count = 10000;
1629
        }
1630
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1631
            if (    ! checkNaNs
1632
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1633
                trueFlags |= float_flag_invalid;
1634
            }
1635
            if (    ! checkNaNs
1636
                 && float128_isNaN( trueZ )
1637
                 && float128_isNaN( testZ )
1638
                 && ! float128_is_signaling_nan( testZ )
1639
                 && ( trueFlags == testFlags )
1640
               ) {
1641
                /* no problem */
1642
            }
1643
            else {
1644
                ++errorCount;
1645
                writeErrorFound( 10000 - count );
1646
                writeInput_a_float64();
1647
                puts( "\n\t"/*, stdout*/ );
1648
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
1649
                //fflush( stdout );
1650
                if ( errorCount == maxErrorCount ) goto exit;
1651
            }
1652
        }
1653
    }
1654
 exit:
1655
    writeTestsPerformed( 10000 - count );
1656
 
1657
}
1658
 
1659
#endif
1660
 
1661
void
1662
 test_az_float64(
1663
     float64 trueFunction( float64 ), float64 testFunction( float64 ) )
1664
{
1665
    int16 count;
1666
    float64 trueZ, testZ;
1667
    uint8 trueFlags, testFlags;
1668
 
1669
    errorCount = 0;
1670
    tenthousandsCount = 0;
1671
    count = 10000;
1672
    testCases_initSequence( testCases_sequence_a_float64 );
1673
    writeTestsTotal();
1674
    while ( ! testCases_done || forever ) {
1675
        testCases_next();
1676
        *trueFlagsPtr = 0;
1677
        trueZ = trueFunction( testCases_a_float64 );
1678
        trueFlags = *trueFlagsPtr;
1679
        (void) testFlagsFunctionPtr();
1680
        testZ = testFunction( testCases_a_float64 );
1681
        testFlags = testFlagsFunctionPtr();
1682
        --count;
1683
        if ( count == 0 ) {
1684
            checkEarlyExit();
1685
            count = 10000;
1686
        }
1687
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1688
            if (    ! checkNaNs
1689
                 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1690
                trueFlags |= float_flag_invalid;
1691
            }
1692
            if (    ! checkNaNs
1693
                 && float64_isNaN( trueZ )
1694
                 && float64_isNaN( testZ )
1695
                 && ! float64_is_signaling_nan( testZ )
1696
                 && ( trueFlags == testFlags )
1697
               ) {
1698
                /* no problem */
1699
            }
1700
            else {
1701
                ++errorCount;
1702
                writeErrorFound( 10000 - count );
1703
                writeInput_a_float64();
1704
                puts( "  "/*, stdout*/ );
1705
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1706
                //fflush( stdout );
1707
                if ( errorCount == maxErrorCount ) goto exit;
1708
            }
1709
        }
1710
    }
1711
 exit:
1712
    writeTestsPerformed( 10000 - count );
1713
 
1714
}
1715
 
1716
void
1717
 test_ab_float64_z_flag(
1718
     flag trueFunction( float64, float64 ),
1719
     flag testFunction( float64, float64 )
1720
 )
1721
{
1722
    int16 count;
1723
    flag trueZ, testZ;
1724
    uint8 trueFlags, testFlags;
1725
 
1726
    errorCount = 0;
1727
    tenthousandsCount = 0;
1728
    count = 10000;
1729
    testCases_initSequence( testCases_sequence_ab_float64 );
1730
    writeTestsTotal();
1731
    while ( ! testCases_done || forever ) {
1732
        testCases_next();
1733
        *trueFlagsPtr = 0;
1734
        trueZ = trueFunction( testCases_a_float64, testCases_b_float64 );
1735
        trueFlags = *trueFlagsPtr;
1736
        (void) testFlagsFunctionPtr();
1737
        testZ = testFunction( testCases_a_float64, testCases_b_float64 );
1738
        testFlags = testFlagsFunctionPtr();
1739
        --count;
1740
        if ( count == 0 ) {
1741
            checkEarlyExit();
1742
            count = 10000;
1743
        }
1744
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1745
            if (    ! checkNaNs
1746
                 && (    float64_is_signaling_nan( testCases_a_float64 )
1747
                      || float64_is_signaling_nan( testCases_b_float64 ) )
1748
               ) {
1749
                trueFlags |= float_flag_invalid;
1750
            }
1751
            if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1752
                ++errorCount;
1753
                writeErrorFound( 10000 - count );
1754
                writeInputs_ab_float64();
1755
                puts( "  "/*, stdout*/ );
1756
                writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
1757
                //fflush( stdout );
1758
                if ( errorCount == maxErrorCount ) goto exit;
1759
            }
1760
        }
1761
    }
1762
 exit:
1763
    writeTestsPerformed( 10000 - count );
1764
    return;
1765
 
1766
}
1767
 
1768
void
1769
 test_abz_float64(
1770
     float64 trueFunction( float64, float64 ),
1771
     float64 testFunction( float64, float64 )
1772
 )
1773
{
1774
    int16 count;
1775
    float64 trueZ, testZ;
1776
    uint8 trueFlags, testFlags;
1777
 
1778
    errorCount = 0;
1779
    tenthousandsCount = 0;
1780
    count = 10000;
1781
    testCases_initSequence( testCases_sequence_ab_float64 );
1782
    writeTestsTotal();
1783
    while ( ! testCases_done || forever ) {
1784
        testCases_next();
1785
        *trueFlagsPtr = 0;
1786
        trueZ = trueFunction( testCases_a_float64, testCases_b_float64 );
1787
        trueFlags = *trueFlagsPtr;
1788
        (void) testFlagsFunctionPtr();
1789
        testZ = testFunction( testCases_a_float64, testCases_b_float64 );
1790
        testFlags = testFlagsFunctionPtr();
1791
        --count;
1792
        if ( count == 0 ) {
1793
            checkEarlyExit();
1794
            count = 10000;
1795
        }
1796
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1797
            if (    ! checkNaNs
1798
                 && (    float64_is_signaling_nan( testCases_a_float64 )
1799
                      || float64_is_signaling_nan( testCases_b_float64 ) )
1800
               ) {
1801
                trueFlags |= float_flag_invalid;
1802
            }
1803
            if (    ! checkNaNs
1804
                 && float64_isNaN( trueZ )
1805
                 && float64_isNaN( testZ )
1806
                 && ! float64_is_signaling_nan( testZ )
1807
                 && ( trueFlags == testFlags )
1808
               ) {
1809
                /* no problem */
1810
            }
1811
            else {
1812
                ++errorCount;
1813
                writeErrorFound( 10000 - count );
1814
                writeInputs_ab_float64();
1815
                puts( "\n\t"/*, stdout*/ );
1816
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1817
                //fflush( stdout );
1818
                if ( errorCount == maxErrorCount ) goto exit;
1819
            }
1820
        }
1821
    }
1822
 exit:
1823
    writeTestsPerformed( 10000 - count );
1824
    return;
1825
 
1826
}
1827
 
1828
#ifdef FLOATX80
1829
 
1830
void
1831
 test_a_floatx80_z_int32(
1832
     int32 trueFunction( floatx80 ), int32 testFunction( floatx80 ) )
1833
{
1834
    int16 count;
1835
    int32 trueZ, testZ;
1836
    uint8 trueFlags, testFlags;
1837
 
1838
    errorCount = 0;
1839
    tenthousandsCount = 0;
1840
    count = 10000;
1841
    testCases_initSequence( testCases_sequence_a_floatx80 );
1842
    writeTestsTotal();
1843
    while ( ! testCases_done || forever ) {
1844
        testCases_next();
1845
        *trueFlagsPtr = 0;
1846
        trueZ = trueFunction( testCases_a_floatx80 );
1847
        trueFlags = *trueFlagsPtr;
1848
        (void) testFlagsFunctionPtr();
1849
        testZ = testFunction( testCases_a_floatx80 );
1850
        testFlags = testFlagsFunctionPtr();
1851
        --count;
1852
        if ( count == 0 ) {
1853
            checkEarlyExit();
1854
            count = 10000;
1855
        }
1856
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1857
            if (    ! checkNaNs
1858
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1859
                trueFlags |= float_flag_invalid;
1860
            }
1861
            if (    ( trueZ == 0x7FFFFFFF )
1862
                 && (    ( testZ == 0x7FFFFFFF )
1863
                      || ( testZ == (sbits32) 0x80000000 ) )
1864
                 && ( trueFlags == float_flag_invalid )
1865
                 && ( testFlags == float_flag_invalid )
1866
               ) {
1867
                /* no problem */
1868
            }
1869
            else {
1870
                ++errorCount;
1871
                writeErrorFound( 10000 - count );
1872
                writeInput_a_floatx80();
1873
                puts( "  "/*, stdout*/ );
1874
                writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
1875
                //fflush( stdout );
1876
                if ( errorCount == maxErrorCount ) goto exit;
1877
            }
1878
        }
1879
    }
1880
 exit:
1881
    writeTestsPerformed( 10000 - count );
1882
 
1883
}
1884
 
1885
#ifdef BITS64
1886
 
1887
void
1888
 test_a_floatx80_z_int64(
1889
     int64 trueFunction( floatx80 ), int64 testFunction( floatx80 ) )
1890
{
1891
    int16 count;
1892
    int64 trueZ, testZ;
1893
    uint8 trueFlags, testFlags;
1894
 
1895
    errorCount = 0;
1896
    tenthousandsCount = 0;
1897
    count = 10000;
1898
    testCases_initSequence( testCases_sequence_a_floatx80 );
1899
    writeTestsTotal();
1900
    while ( ! testCases_done || forever ) {
1901
        testCases_next();
1902
        *trueFlagsPtr = 0;
1903
        trueZ = trueFunction( testCases_a_floatx80 );
1904
        trueFlags = *trueFlagsPtr;
1905
        (void) testFlagsFunctionPtr();
1906
        testZ = testFunction( testCases_a_floatx80 );
1907
        testFlags = testFlagsFunctionPtr();
1908
        --count;
1909
        if ( count == 0 ) {
1910
            checkEarlyExit();
1911
            count = 10000;
1912
        }
1913
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1914
            if (    ! checkNaNs
1915
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1916
                trueFlags |= float_flag_invalid;
1917
            }
1918
            if (    ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1919
                 && (    ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1920
                      || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
1921
                 && ( trueFlags == float_flag_invalid )
1922
                 && ( testFlags == float_flag_invalid )
1923
               ) {
1924
                /* no problem */
1925
            }
1926
            else {
1927
                ++errorCount;
1928
                writeErrorFound( 10000 - count );
1929
                writeInput_a_floatx80();
1930
                puts( "  "/*, stdout*/ );
1931
                writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1932
                //fflush( stdout );
1933
                if ( errorCount == maxErrorCount ) goto exit;
1934
            }
1935
        }
1936
    }
1937
 exit:
1938
    writeTestsPerformed( 10000 - count );
1939
 
1940
}
1941
 
1942
#endif
1943
 
1944
void
1945
 test_a_floatx80_z_float32(
1946
     float32 trueFunction( floatx80 ), float32 testFunction( floatx80 ) )
1947
{
1948
    int16 count;
1949
    float32 trueZ, testZ;
1950
    uint8 trueFlags, testFlags;
1951
 
1952
    errorCount = 0;
1953
    tenthousandsCount = 0;
1954
    count = 10000;
1955
    testCases_initSequence( testCases_sequence_a_floatx80 );
1956
    writeTestsTotal();
1957
    while ( ! testCases_done || forever ) {
1958
        testCases_next();
1959
        *trueFlagsPtr = 0;
1960
        trueZ = trueFunction( testCases_a_floatx80 );
1961
        trueFlags = *trueFlagsPtr;
1962
        (void) testFlagsFunctionPtr();
1963
        testZ = testFunction( testCases_a_floatx80 );
1964
        testFlags = testFlagsFunctionPtr();
1965
        --count;
1966
        if ( count == 0 ) {
1967
            checkEarlyExit();
1968
            count = 10000;
1969
        }
1970
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1971
            if (    ! checkNaNs
1972
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1973
                trueFlags |= float_flag_invalid;
1974
            }
1975
            if (    ! checkNaNs
1976
                 && float32_isNaN( trueZ )
1977
                 && float32_isNaN( testZ )
1978
                 && ! float32_is_signaling_nan( testZ )
1979
                 && ( trueFlags == testFlags )
1980
               ) {
1981
                /* no problem */
1982
            }
1983
            else {
1984
                ++errorCount;
1985
                writeErrorFound( 10000 - count );
1986
                writeInput_a_floatx80();
1987
                puts( "  "/*, stdout*/ );
1988
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1989
                //fflush( stdout );
1990
                if ( errorCount == maxErrorCount ) goto exit;
1991
            }
1992
        }
1993
    }
1994
 exit:
1995
    writeTestsPerformed( 10000 - count );
1996
 
1997
}
1998
 
1999
void
2000
 test_a_floatx80_z_float64(
2001
     float64 trueFunction( floatx80 ), float64 testFunction( floatx80 ) )
2002
{
2003
    int16 count;
2004
    float64 trueZ, testZ;
2005
    uint8 trueFlags, testFlags;
2006
 
2007
    errorCount = 0;
2008
    tenthousandsCount = 0;
2009
    count = 10000;
2010
    testCases_initSequence( testCases_sequence_a_floatx80 );
2011
    writeTestsTotal();
2012
    while ( ! testCases_done || forever ) {
2013
        testCases_next();
2014
        *trueFlagsPtr = 0;
2015
        trueZ = trueFunction( testCases_a_floatx80 );
2016
        trueFlags = *trueFlagsPtr;
2017
        (void) testFlagsFunctionPtr();
2018
        testZ = testFunction( testCases_a_floatx80 );
2019
        testFlags = testFlagsFunctionPtr();
2020
        --count;
2021
        if ( count == 0 ) {
2022
            checkEarlyExit();
2023
            count = 10000;
2024
        }
2025
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2026
            if (    ! checkNaNs
2027
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2028
                trueFlags |= float_flag_invalid;
2029
            }
2030
            if (    ! checkNaNs
2031
                 && float64_isNaN( trueZ )
2032
                 && float64_isNaN( testZ )
2033
                 && ! float64_is_signaling_nan( testZ )
2034
                 && ( trueFlags == testFlags )
2035
               ) {
2036
                /* no problem */
2037
            }
2038
            else {
2039
                ++errorCount;
2040
                writeErrorFound( 10000 - count );
2041
                writeInput_a_floatx80();
2042
                puts( "\n\t"/*, stdout*/ );
2043
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
2044
                //fflush( stdout );
2045
                if ( errorCount == maxErrorCount ) goto exit;
2046
            }
2047
        }
2048
    }
2049
 exit:
2050
    writeTestsPerformed( 10000 - count );
2051
 
2052
}
2053
 
2054
#ifdef FLOAT128
2055
 
2056
void
2057
 test_a_floatx80_z_float128(
2058
     float128 trueFunction( floatx80 ), float128 testFunction( floatx80 ) )
2059
{
2060
    int16 count;
2061
    float128 trueZ, testZ;
2062
    uint8 trueFlags, testFlags;
2063
 
2064
    errorCount = 0;
2065
    tenthousandsCount = 0;
2066
    count = 10000;
2067
    testCases_initSequence( testCases_sequence_a_floatx80 );
2068
    writeTestsTotal();
2069
    while ( ! testCases_done || forever ) {
2070
        testCases_next();
2071
        *trueFlagsPtr = 0;
2072
        trueZ = trueFunction( testCases_a_floatx80 );
2073
        trueFlags = *trueFlagsPtr;
2074
        (void) testFlagsFunctionPtr();
2075
        testZ = testFunction( testCases_a_floatx80 );
2076
        testFlags = testFlagsFunctionPtr();
2077
        --count;
2078
        if ( count == 0 ) {
2079
            checkEarlyExit();
2080
            count = 10000;
2081
        }
2082
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2083
            if (    ! checkNaNs
2084
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2085
                trueFlags |= float_flag_invalid;
2086
            }
2087
            if (    ! checkNaNs
2088
                 && float128_isNaN( trueZ )
2089
                 && float128_isNaN( testZ )
2090
                 && ! float128_is_signaling_nan( testZ )
2091
                 && ( trueFlags == testFlags )
2092
               ) {
2093
                /* no problem */
2094
            }
2095
            else {
2096
                ++errorCount;
2097
                writeErrorFound( 10000 - count );
2098
                writeInput_a_floatx80();
2099
                puts( "\n\t"/*, stdout*/ );
2100
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2101
                //fflush( stdout );
2102
                if ( errorCount == maxErrorCount ) goto exit;
2103
            }
2104
        }
2105
    }
2106
 exit:
2107
    writeTestsPerformed( 10000 - count );
2108
 
2109
}
2110
 
2111
#endif
2112
 
2113
void
2114
 test_az_floatx80(
2115
     floatx80 trueFunction( floatx80 ), floatx80 testFunction( floatx80 ) )
2116
{
2117
    int16 count;
2118
    floatx80 trueZ, testZ;
2119
    uint8 trueFlags, testFlags;
2120
 
2121
    errorCount = 0;
2122
    tenthousandsCount = 0;
2123
    count = 10000;
2124
    testCases_initSequence( testCases_sequence_a_floatx80 );
2125
    writeTestsTotal();
2126
    while ( ! testCases_done || forever ) {
2127
        testCases_next();
2128
        *trueFlagsPtr = 0;
2129
        trueZ = trueFunction( testCases_a_floatx80 );
2130
        trueFlags = *trueFlagsPtr;
2131
        (void) testFlagsFunctionPtr();
2132
        testZ = testFunction( testCases_a_floatx80 );
2133
        testFlags = testFlagsFunctionPtr();
2134
        --count;
2135
        if ( count == 0 ) {
2136
            checkEarlyExit();
2137
            count = 10000;
2138
        }
2139
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2140
            if (    ! checkNaNs
2141
                 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2142
                trueFlags |= float_flag_invalid;
2143
            }
2144
            if (    ! checkNaNs
2145
                 && floatx80_isNaN( trueZ )
2146
                 && floatx80_isNaN( testZ )
2147
                 && ! floatx80_is_signaling_nan( testZ )
2148
                 && ( trueFlags == testFlags )
2149
               ) {
2150
                /* no problem */
2151
            }
2152
            else {
2153
                ++errorCount;
2154
                writeErrorFound( 10000 - count );
2155
                writeInput_a_floatx80();
2156
                puts( "\n\t"/*, stdout*/ );
2157
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2158
                //fflush( stdout );
2159
                if ( errorCount == maxErrorCount ) goto exit;
2160
            }
2161
        }
2162
    }
2163
 exit:
2164
    writeTestsPerformed( 10000 - count );
2165
 
2166
}
2167
 
2168
void
2169
 test_ab_floatx80_z_flag(
2170
     flag trueFunction( floatx80, floatx80 ),
2171
     flag testFunction( floatx80, floatx80 )
2172
 )
2173
{
2174
    int16 count;
2175
    flag trueZ, testZ;
2176
    uint8 trueFlags, testFlags;
2177
 
2178
    errorCount = 0;
2179
    tenthousandsCount = 0;
2180
    count = 10000;
2181
    testCases_initSequence( testCases_sequence_ab_floatx80 );
2182
    writeTestsTotal();
2183
    while ( ! testCases_done || forever ) {
2184
        testCases_next();
2185
        *trueFlagsPtr = 0;
2186
        trueZ = trueFunction( testCases_a_floatx80, testCases_b_floatx80 );
2187
        trueFlags = *trueFlagsPtr;
2188
        (void) testFlagsFunctionPtr();
2189
        testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 );
2190
        testFlags = testFlagsFunctionPtr();
2191
        --count;
2192
        if ( count == 0 ) {
2193
            checkEarlyExit();
2194
            count = 10000;
2195
        }
2196
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2197
            if (    ! checkNaNs
2198
                 && (    floatx80_is_signaling_nan( testCases_a_floatx80 )
2199
                      || floatx80_is_signaling_nan( testCases_b_floatx80 ) )
2200
               ) {
2201
                trueFlags |= float_flag_invalid;
2202
            }
2203
            if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2204
                ++errorCount;
2205
                writeErrorFound( 10000 - count );
2206
                writeInputs_ab_floatx80();
2207
                puts( "  "/*, stdout*/ );
2208
                writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
2209
                //fflush( stdout );
2210
                if ( errorCount == maxErrorCount ) goto exit;
2211
            }
2212
        }
2213
    }
2214
 exit:
2215
    writeTestsPerformed( 10000 - count );
2216
    return;
2217
 
2218
}
2219
 
2220
void
2221
 test_abz_floatx80(
2222
     floatx80 trueFunction( floatx80, floatx80 ),
2223
     floatx80 testFunction( floatx80, floatx80 )
2224
 )
2225
{
2226
    int16 count;
2227
    floatx80 trueZ, testZ;
2228
    uint8 trueFlags, testFlags;
2229
 
2230
    errorCount = 0;
2231
    tenthousandsCount = 0;
2232
    count = 10000;
2233
    testCases_initSequence( testCases_sequence_ab_floatx80 );
2234
    writeTestsTotal();
2235
    while ( ! testCases_done || forever ) {
2236
        testCases_next();
2237
        *trueFlagsPtr = 0;
2238
        trueZ = trueFunction( testCases_a_floatx80, testCases_b_floatx80 );
2239
        trueFlags = *trueFlagsPtr;
2240
        (void) testFlagsFunctionPtr();
2241
        testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 );
2242
        testFlags = testFlagsFunctionPtr();
2243
        --count;
2244
        if ( count == 0 ) {
2245
            checkEarlyExit();
2246
            count = 10000;
2247
        }
2248
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2249
            if (    ! checkNaNs
2250
                 && (    floatx80_is_signaling_nan( testCases_a_floatx80 )
2251
                      || floatx80_is_signaling_nan( testCases_b_floatx80 ) )
2252
               ) {
2253
                trueFlags |= float_flag_invalid;
2254
            }
2255
            if (    ! checkNaNs
2256
                 && floatx80_isNaN( trueZ )
2257
                 && floatx80_isNaN( testZ )
2258
                 && ! floatx80_is_signaling_nan( testZ )
2259
                 && ( trueFlags == testFlags )
2260
               ) {
2261
                /* no problem */
2262
            }
2263
            else {
2264
                ++errorCount;
2265
                writeErrorFound( 10000 - count );
2266
                writeInputs_ab_floatx80();
2267
                puts( "\n\t"/*, stdout*/ );
2268
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2269
                //fflush( stdout );
2270
                if ( errorCount == maxErrorCount ) goto exit;
2271
            }
2272
        }
2273
    }
2274
 exit:
2275
    writeTestsPerformed( 10000 - count );
2276
    return;
2277
 
2278
}
2279
 
2280
#endif
2281
 
2282
#ifdef FLOAT128
2283
 
2284
void
2285
 test_a_float128_z_int32(
2286
     int32 trueFunction( float128 ), int32 testFunction( float128 ) )
2287
{
2288
    int16 count;
2289
    int32 trueZ, testZ;
2290
    uint8 trueFlags, testFlags;
2291
 
2292
    errorCount = 0;
2293
    tenthousandsCount = 0;
2294
    count = 10000;
2295
    testCases_initSequence( testCases_sequence_a_float128 );
2296
    writeTestsTotal();
2297
    while ( ! testCases_done || forever ) {
2298
        testCases_next();
2299
        *trueFlagsPtr = 0;
2300
        trueZ = trueFunction( testCases_a_float128 );
2301
        trueFlags = *trueFlagsPtr;
2302
        (void) testFlagsFunctionPtr();
2303
        testZ = testFunction( testCases_a_float128 );
2304
        testFlags = testFlagsFunctionPtr();
2305
        --count;
2306
        if ( count == 0 ) {
2307
            checkEarlyExit();
2308
            count = 10000;
2309
        }
2310
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2311
            if (    ! checkNaNs
2312
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2313
                trueFlags |= float_flag_invalid;
2314
            }
2315
            if (    ( trueZ == 0x7FFFFFFF )
2316
                 && (    ( testZ == 0x7FFFFFFF )
2317
                      || ( testZ == (sbits32) 0x80000000 ) )
2318
                 && ( trueFlags == float_flag_invalid )
2319
                 && ( testFlags == float_flag_invalid )
2320
               ) {
2321
                /* no problem */
2322
            }
2323
            else {
2324
                ++errorCount;
2325
                writeErrorFound( 10000 - count );
2326
                writeInput_a_float128();
2327
                puts( "  "/*, stdout*/ );
2328
                writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
2329
                //fflush( stdout );
2330
                if ( errorCount == maxErrorCount ) goto exit;
2331
            }
2332
        }
2333
    }
2334
 exit:
2335
    writeTestsPerformed( 10000 - count );
2336
 
2337
}
2338
 
2339
#ifdef BITS64
2340
 
2341
void
2342
 test_a_float128_z_int64(
2343
     int64 trueFunction( float128 ), int64 testFunction( float128 ) )
2344
{
2345
    int16 count;
2346
    int64 trueZ, testZ;
2347
    uint8 trueFlags, testFlags;
2348
 
2349
    errorCount = 0;
2350
    tenthousandsCount = 0;
2351
    count = 10000;
2352
    testCases_initSequence( testCases_sequence_a_float128 );
2353
    writeTestsTotal();
2354
    while ( ! testCases_done || forever ) {
2355
        testCases_next();
2356
        *trueFlagsPtr = 0;
2357
        trueZ = trueFunction( testCases_a_float128 );
2358
        trueFlags = *trueFlagsPtr;
2359
        (void) testFlagsFunctionPtr();
2360
        testZ = testFunction( testCases_a_float128 );
2361
        testFlags = testFlagsFunctionPtr();
2362
        --count;
2363
        if ( count == 0 ) {
2364
            checkEarlyExit();
2365
            count = 10000;
2366
        }
2367
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2368
            if (    ! checkNaNs
2369
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2370
                trueFlags |= float_flag_invalid;
2371
            }
2372
            if (    ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
2373
                 && (    ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
2374
                      || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
2375
                 && ( trueFlags == float_flag_invalid )
2376
                 && ( testFlags == float_flag_invalid )
2377
               ) {
2378
                /* no problem */
2379
            }
2380
            else {
2381
                ++errorCount;
2382
                writeErrorFound( 10000 - count );
2383
                writeInput_a_float128();
2384
                puts( "\n\t"/*, stdout*/ );
2385
                writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
2386
                //fflush( stdout );
2387
                if ( errorCount == maxErrorCount ) goto exit;
2388
            }
2389
        }
2390
    }
2391
 exit:
2392
    writeTestsPerformed( 10000 - count );
2393
 
2394
}
2395
 
2396
#endif
2397
 
2398
void
2399
 test_a_float128_z_float32(
2400
     float32 trueFunction( float128 ), float32 testFunction( float128 ) )
2401
{
2402
    int16 count;
2403
    float32 trueZ, testZ;
2404
    uint8 trueFlags, testFlags;
2405
 
2406
    errorCount = 0;
2407
    tenthousandsCount = 0;
2408
    count = 10000;
2409
    testCases_initSequence( testCases_sequence_a_float128 );
2410
    writeTestsTotal();
2411
    while ( ! testCases_done || forever ) {
2412
        testCases_next();
2413
        *trueFlagsPtr = 0;
2414
        trueZ = trueFunction( testCases_a_float128 );
2415
        trueFlags = *trueFlagsPtr;
2416
        (void) testFlagsFunctionPtr();
2417
        testZ = testFunction( testCases_a_float128 );
2418
        testFlags = testFlagsFunctionPtr();
2419
        --count;
2420
        if ( count == 0 ) {
2421
            checkEarlyExit();
2422
            count = 10000;
2423
        }
2424
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2425
            if (    ! checkNaNs
2426
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2427
                trueFlags |= float_flag_invalid;
2428
            }
2429
            if (    ! checkNaNs
2430
                 && float32_isNaN( trueZ )
2431
                 && float32_isNaN( testZ )
2432
                 && ! float32_is_signaling_nan( testZ )
2433
                 && ( trueFlags == testFlags )
2434
               ) {
2435
                /* no problem */
2436
            }
2437
            else {
2438
                ++errorCount;
2439
                writeErrorFound( 10000 - count );
2440
                writeInput_a_float128();
2441
                puts( "  "/*, stdout*/ );
2442
                writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
2443
                //fflush( stdout );
2444
                if ( errorCount == maxErrorCount ) goto exit;
2445
            }
2446
        }
2447
    }
2448
 exit:
2449
    writeTestsPerformed( 10000 - count );
2450
 
2451
}
2452
 
2453
void
2454
 test_a_float128_z_float64(
2455
     float64 trueFunction( float128 ), float64 testFunction( float128 ) )
2456
{
2457
    int16 count;
2458
    float64 trueZ, testZ;
2459
    uint8 trueFlags, testFlags;
2460
 
2461
    errorCount = 0;
2462
    tenthousandsCount = 0;
2463
    count = 10000;
2464
    testCases_initSequence( testCases_sequence_a_float128 );
2465
    writeTestsTotal();
2466
    while ( ! testCases_done || forever ) {
2467
        testCases_next();
2468
        *trueFlagsPtr = 0;
2469
        trueZ = trueFunction( testCases_a_float128 );
2470
        trueFlags = *trueFlagsPtr;
2471
        (void) testFlagsFunctionPtr();
2472
        testZ = testFunction( testCases_a_float128 );
2473
        testFlags = testFlagsFunctionPtr();
2474
        --count;
2475
        if ( count == 0 ) {
2476
            checkEarlyExit();
2477
            count = 10000;
2478
        }
2479
        if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2480
            if (    ! checkNaNs
2481
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2482
                trueFlags |= float_flag_invalid;
2483
            }
2484
            if (    ! checkNaNs
2485
                 && float64_isNaN( trueZ )
2486
                 && float64_isNaN( testZ )
2487
                 && ! float64_is_signaling_nan( testZ )
2488
                 && ( trueFlags == testFlags )
2489
               ) {
2490
                /* no problem */
2491
            }
2492
            else {
2493
                ++errorCount;
2494
                writeErrorFound( 10000 - count );
2495
                writeInput_a_float128();
2496
                puts( "\n\t"/*, stdout*/ );
2497
                writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
2498
                //fflush( stdout );
2499
                if ( errorCount == maxErrorCount ) goto exit;
2500
            }
2501
        }
2502
    }
2503
 exit:
2504
    writeTestsPerformed( 10000 - count );
2505
 
2506
}
2507
 
2508
#ifdef FLOATX80
2509
 
2510
void
2511
 test_a_float128_z_floatx80(
2512
     floatx80 trueFunction( float128 ), floatx80 testFunction( float128 ) )
2513
{
2514
    int16 count;
2515
    floatx80 trueZ, testZ;
2516
    uint8 trueFlags, testFlags;
2517
 
2518
    errorCount = 0;
2519
    tenthousandsCount = 0;
2520
    count = 10000;
2521
    testCases_initSequence( testCases_sequence_a_float128 );
2522
    writeTestsTotal();
2523
    while ( ! testCases_done || forever ) {
2524
        testCases_next();
2525
        *trueFlagsPtr = 0;
2526
        trueZ = trueFunction( testCases_a_float128 );
2527
        trueFlags = *trueFlagsPtr;
2528
        (void) testFlagsFunctionPtr();
2529
        testZ = testFunction( testCases_a_float128 );
2530
        testFlags = testFlagsFunctionPtr();
2531
        --count;
2532
        if ( count == 0 ) {
2533
            checkEarlyExit();
2534
            count = 10000;
2535
        }
2536
        if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2537
            if (    ! checkNaNs
2538
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2539
                trueFlags |= float_flag_invalid;
2540
            }
2541
            if (    ! checkNaNs
2542
                 && floatx80_isNaN( trueZ )
2543
                 && floatx80_isNaN( testZ )
2544
                 && ! floatx80_is_signaling_nan( testZ )
2545
                 && ( trueFlags == testFlags )
2546
               ) {
2547
                /* no problem */
2548
            }
2549
            else {
2550
                ++errorCount;
2551
                writeErrorFound( 10000 - count );
2552
                writeInput_a_float128();
2553
                puts( "\n\t"/*, stdout*/ );
2554
                writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2555
                //fflush( stdout );
2556
                if ( errorCount == maxErrorCount ) goto exit;
2557
            }
2558
        }
2559
    }
2560
 exit:
2561
    writeTestsPerformed( 10000 - count );
2562
 
2563
}
2564
 
2565
#endif
2566
 
2567
void
2568
 test_az_float128(
2569
     float128 trueFunction( float128 ), float128 testFunction( float128 ) )
2570
{
2571
    int16 count;
2572
    float128 trueZ, testZ;
2573
    uint8 trueFlags, testFlags;
2574
 
2575
    errorCount = 0;
2576
    tenthousandsCount = 0;
2577
    count = 10000;
2578
    testCases_initSequence( testCases_sequence_a_float128 );
2579
    writeTestsTotal();
2580
    while ( ! testCases_done || forever ) {
2581
        testCases_next();
2582
        *trueFlagsPtr = 0;
2583
        trueZ = trueFunction( testCases_a_float128 );
2584
        trueFlags = *trueFlagsPtr;
2585
        (void) testFlagsFunctionPtr();
2586
        testZ = testFunction( testCases_a_float128 );
2587
        testFlags = testFlagsFunctionPtr();
2588
        --count;
2589
        if ( count == 0 ) {
2590
            checkEarlyExit();
2591
            count = 10000;
2592
        }
2593
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2594
            if (    ! checkNaNs
2595
                 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2596
                trueFlags |= float_flag_invalid;
2597
            }
2598
            if (    ! checkNaNs
2599
                 && float128_isNaN( trueZ )
2600
                 && float128_isNaN( testZ )
2601
                 && ! float128_is_signaling_nan( testZ )
2602
                 && ( trueFlags == testFlags )
2603
               ) {
2604
                /* no problem */
2605
            }
2606
            else {
2607
                ++errorCount;
2608
                writeErrorFound( 10000 - count );
2609
                writeInput_a_float128();
2610
                puts( "\n\t"/*, stdout*/ );
2611
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2612
                //fflush( stdout );
2613
                if ( errorCount == maxErrorCount ) goto exit;
2614
            }
2615
        }
2616
    }
2617
 exit:
2618
    writeTestsPerformed( 10000 - count );
2619
 
2620
}
2621
 
2622
void
2623
 test_ab_float128_z_flag(
2624
     flag trueFunction( float128, float128 ),
2625
     flag testFunction( float128, float128 )
2626
 )
2627
{
2628
    int16 count;
2629
    flag trueZ, testZ;
2630
    uint8 trueFlags, testFlags;
2631
 
2632
    errorCount = 0;
2633
    tenthousandsCount = 0;
2634
    count = 10000;
2635
    testCases_initSequence( testCases_sequence_ab_float128 );
2636
    writeTestsTotal();
2637
    while ( ! testCases_done || forever ) {
2638
        testCases_next();
2639
        *trueFlagsPtr = 0;
2640
        trueZ = trueFunction( testCases_a_float128, testCases_b_float128 );
2641
        trueFlags = *trueFlagsPtr;
2642
        (void) testFlagsFunctionPtr();
2643
        testZ = testFunction( testCases_a_float128, testCases_b_float128 );
2644
        testFlags = testFlagsFunctionPtr();
2645
        --count;
2646
        if ( count == 0 ) {
2647
            checkEarlyExit();
2648
            count = 10000;
2649
        }
2650
        if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2651
            if (    ! checkNaNs
2652
                 && (    float128_is_signaling_nan( testCases_a_float128 )
2653
                      || float128_is_signaling_nan( testCases_b_float128 ) )
2654
               ) {
2655
                trueFlags |= float_flag_invalid;
2656
            }
2657
            if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2658
                ++errorCount;
2659
                writeErrorFound( 10000 - count );
2660
                writeInputs_ab_float128();
2661
                puts( "\n\t"/*, stdout*/ );
2662
                writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
2663
                //fflush( stdout );
2664
                if ( errorCount == maxErrorCount ) goto exit;
2665
            }
2666
        }
2667
    }
2668
 exit:
2669
    writeTestsPerformed( 10000 - count );
2670
    return;
2671
 
2672
}
2673
 
2674
void
2675
 test_abz_float128(
2676
     float128 trueFunction( float128, float128 ),
2677
     float128 testFunction( float128, float128 )
2678
 )
2679
{
2680
    int16 count;
2681
    float128 trueZ, testZ;
2682
    uint8 trueFlags, testFlags;
2683
 
2684
    errorCount = 0;
2685
    tenthousandsCount = 0;
2686
    count = 10000;
2687
    testCases_initSequence( testCases_sequence_ab_float128 );
2688
    writeTestsTotal();
2689
    while ( ! testCases_done || forever ) {
2690
        testCases_next();
2691
        *trueFlagsPtr = 0;
2692
        trueZ = trueFunction( testCases_a_float128, testCases_b_float128 );
2693
        trueFlags = *trueFlagsPtr;
2694
        (void) testFlagsFunctionPtr();
2695
        testZ = testFunction( testCases_a_float128, testCases_b_float128 );
2696
        testFlags = testFlagsFunctionPtr();
2697
        --count;
2698
        if ( count == 0 ) {
2699
            checkEarlyExit();
2700
            count = 10000;
2701
        }
2702
        if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2703
            if (    ! checkNaNs
2704
                 && (    float128_is_signaling_nan( testCases_a_float128 )
2705
                      || float128_is_signaling_nan( testCases_b_float128 ) )
2706
               ) {
2707
                trueFlags |= float_flag_invalid;
2708
            }
2709
            if (    ! checkNaNs
2710
                 && float128_isNaN( trueZ )
2711
                 && float128_isNaN( testZ )
2712
                 && ! float128_is_signaling_nan( testZ )
2713
                 && ( trueFlags == testFlags )
2714
               ) {
2715
                /* no problem */
2716
            }
2717
            else {
2718
                ++errorCount;
2719
                writeErrorFound( 10000 - count );
2720
                writeInputs_ab_float128();
2721
                puts( "\n\t"/*, stdout*/ );
2722
                writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2723
                //fflush( stdout );
2724
                if ( errorCount == maxErrorCount ) goto exit;
2725
            }
2726
        }
2727
    }
2728
 exit:
2729
    writeTestsPerformed( 10000 - count );
2730
    return;
2731
 
2732
}
2733
 
2734
#endif
2735
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.