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