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