3 ===============================================================================
5 This C source file is part of TestFloat, Release 2a, a package of programs
6 for testing the correctness of floating-point arithmetic complying to the
7 IEC/IEEE Standard for Floating-Point.
9 Written by John R. Hauser. More information is available through the Web
10 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
12 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
13 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
15 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
18 Derivative works are acceptable, even for commercial purposes, so long as
19 (1) they include prominent notice that the work is derivative, and (2) they
20 include prominent notice akin to these four paragraphs for those parts of
21 this code that are retained.
23 ===============================================================================
29 #include "softfloat.h"
30 #include "testCases.h"
32 #include "testLoops.h"
34 volatile flag stop = FALSE;
36 char *trueName, *testName;
37 flag forever, errorStop;
38 uint32 maxErrorCount = 0;
39 flag checkNaNs = FALSE;
41 int8 ( *testFlagsFunctionPtr )( void );
43 char *roundingPrecisionName, *roundingModeName, *tininessModeName;
44 flag anyErrors = FALSE;
46 void writeFunctionName( FILE *stream )
49 fputs( functionName, stream );
50 if ( roundingModeName ) {
51 if ( roundingPrecisionName ) {
52 fputs( ", precision ", stream );
53 fputs( roundingPrecisionName, stream );
55 fputs( ", rounding ", stream );
56 fputs( roundingModeName, stream );
57 if ( tininessModeName ) {
58 fputs( ", tininess ", stream );
59 fputs( tininessModeName, stream );
60 fputs( " rounding", stream );
66 void exitWithStatus( void )
69 exit( anyErrors ? EXIT_FAILURE : EXIT_SUCCESS );
73 static uint32 tenthousandsCount, errorCount = 0;
75 static void writeTestsTotal( void )
79 fputs( "Unbounded tests.\n", stderr );
82 fprintf( stderr, "\r%d tests total.\n", testCases_total );
87 static void writeTestsPerformed( int16 count )
90 if ( tenthousandsCount ) {
92 stderr, "\r%d%04d tests performed", tenthousandsCount, count );
95 fprintf( stderr, "\r%d tests performed", count );
100 "; %d error%s found.\n",
102 ( errorCount == 1 ) ? "" : "s"
106 fputs( ".\n", stderr );
107 fputs( "No errors found in ", stdout );
108 writeFunctionName( stdout );
109 fputs( ".\n", stdout );
115 static void checkEarlyExit( void )
120 writeTestsPerformed( 0 );
123 fprintf( stderr, "\r%3d0000", tenthousandsCount );
127 static void writeErrorFound( int16 count )
130 fputc( '\r', stderr );
131 if ( errorCount == 1 ) {
132 fputs( "Errors found in ", stdout );
133 writeFunctionName( stdout );
134 fputs( ":\n", stdout );
137 writeTestsPerformed( count );
144 INLINE void writeInput_a_int32( void )
147 writeHex_bits32( testCases_a_int32, stdout );
153 INLINE void writeInput_a_int64( void )
156 writeHex_bits64( testCases_a_int64, stdout );
162 INLINE void writeInput_a_float32( void )
165 writeHex_float32( testCases_a_float32, stdout );
169 static void writeInputs_ab_float32( void )
172 writeHex_float32( testCases_a_float32, stdout );
173 fputs( " ", stdout );
174 writeHex_float32( testCases_b_float32, stdout );
178 INLINE void writeInput_a_float64( void )
181 writeHex_float64( testCases_a_float64, stdout );
185 static void writeInputs_ab_float64( void )
188 writeHex_float64( testCases_a_float64, stdout );
189 fputs( " ", stdout );
190 writeHex_float64( testCases_b_float64, stdout );
196 INLINE void writeInput_a_floatx80( void )
199 writeHex_floatx80( testCases_a_floatx80, stdout );
203 static void writeInputs_ab_floatx80( void )
206 writeHex_floatx80( testCases_a_floatx80, stdout );
207 fputs( " ", stdout );
208 writeHex_floatx80( testCases_b_floatx80, stdout );
216 INLINE void writeInput_a_float128( void )
219 writeHex_float128( testCases_a_float128, stdout );
223 static void writeInputs_ab_float128( void )
226 writeHex_float128( testCases_a_float128, stdout );
227 fputs( " ", stdout );
228 writeHex_float128( testCases_b_float128, stdout );
236 flag trueZ, uint8 trueFlags, flag testZ, uint8 testFlags )
239 fputs( trueName, stdout );
240 fputs( ": ", stdout );
241 writeHex_flag( trueZ, stdout );
242 fputc( ' ', stdout );
243 writeHex_float_flags( trueFlags, stdout );
244 fputs( " ", stdout );
245 fputs( testName, stdout );
246 fputs( ": ", stdout );
247 writeHex_flag( testZ, stdout );
248 fputc( ' ', stdout );
249 writeHex_float_flags( testFlags, stdout );
250 fputc( '\n', stdout );
255 writeOutputs_z_int32(
256 int32 trueZ, uint8 trueFlags, int32 testZ, uint8 testFlags )
259 fputs( trueName, stdout );
260 fputs( ": ", stdout );
261 writeHex_bits32( trueZ, stdout );
262 fputc( ' ', stdout );
263 writeHex_float_flags( trueFlags, stdout );
264 fputs( " ", stdout );
265 fputs( testName, stdout );
266 fputs( ": ", stdout );
267 writeHex_bits32( testZ, stdout );
268 fputc( ' ', stdout );
269 writeHex_float_flags( testFlags, stdout );
270 fputc( '\n', stdout );
277 writeOutputs_z_int64(
278 int64 trueZ, uint8 trueFlags, int64 testZ, uint8 testFlags )
281 fputs( trueName, stdout );
282 fputs( ": ", stdout );
283 writeHex_bits64( trueZ, stdout );
284 fputc( ' ', stdout );
285 writeHex_float_flags( trueFlags, stdout );
286 fputs( " ", stdout );
287 fputs( testName, stdout );
288 fputs( ": ", stdout );
289 writeHex_bits64( testZ, stdout );
290 fputc( ' ', stdout );
291 writeHex_float_flags( testFlags, stdout );
292 fputc( '\n', stdout );
299 writeOutputs_z_float32(
300 float32 trueZ, uint8 trueFlags, float32 testZ, uint8 testFlags )
303 fputs( trueName, stdout );
304 fputs( ": ", stdout );
305 writeHex_float32( trueZ, stdout );
306 fputc( ' ', stdout );
307 writeHex_float_flags( trueFlags, stdout );
308 fputs( " ", stdout );
309 fputs( testName, stdout );
310 fputs( ": ", stdout );
311 writeHex_float32( testZ, stdout );
312 fputc( ' ', stdout );
313 writeHex_float_flags( testFlags, stdout );
314 fputc( '\n', stdout );
319 writeOutputs_z_float64(
320 float64 trueZ, uint8 trueFlags, float64 testZ, uint8 testFlags )
323 fputs( trueName, stdout );
324 fputs( ": ", stdout );
325 writeHex_float64( trueZ, stdout );
326 fputc( ' ', stdout );
327 writeHex_float_flags( trueFlags, stdout );
328 fputs( " ", stdout );
329 fputs( testName, stdout );
330 fputs( ": ", stdout );
331 writeHex_float64( testZ, stdout );
332 fputc( ' ', stdout );
333 writeHex_float_flags( testFlags, stdout );
334 fputc( '\n', stdout );
341 writeOutputs_z_floatx80(
342 floatx80 trueZ, uint8 trueFlags, floatx80 testZ, uint8 testFlags )
345 fputs( trueName, stdout );
346 fputs( ": ", stdout );
347 writeHex_floatx80( trueZ, stdout );
348 fputc( ' ', stdout );
349 writeHex_float_flags( trueFlags, stdout );
350 fputs( " ", stdout );
351 fputs( testName, stdout );
352 fputs( ": ", stdout );
353 writeHex_floatx80( testZ, stdout );
354 fputc( ' ', stdout );
355 writeHex_float_flags( testFlags, stdout );
356 fputc( '\n', stdout );
365 writeOutputs_z_float128(
366 float128 trueZ, uint8 trueFlags, float128 testZ, uint8 testFlags )
369 fputs( trueName, stdout );
370 fputs( ": ", stdout );
371 writeHex_float128( trueZ, stdout );
372 fputc( ' ', stdout );
373 writeHex_float_flags( trueFlags, stdout );
374 fputs( "\n\t", stdout );
375 fputs( testName, stdout );
376 fputs( ": ", stdout );
377 writeHex_float128( testZ, stdout );
378 fputc( ' ', stdout );
379 writeHex_float_flags( testFlags, stdout );
380 fputc( '\n', stdout );
386 INLINE flag float32_isNaN( float32 a )
389 return 0x7F800000 < ( a & 0x7FFFFFFF );
395 INLINE flag float64_same( float64 a, float64 b )
402 INLINE flag float64_isNaN( float64 a )
405 return LIT64( 0x7FF0000000000000 ) < ( a & LIT64( 0x7FFFFFFFFFFFFFFF ) );
411 INLINE flag float64_same( float64 a, float64 b )
414 return ( a.high == b.high ) && ( a.low == b.low );
418 INLINE flag float64_isNaN( float64 a )
422 absAHigh = a.high & 0x7FFFFFFF;
424 ( 0x7FF00000 < absAHigh ) || ( ( absAHigh == 0x7FF00000 ) && a.low );
432 INLINE flag floatx80_same( floatx80 a, floatx80 b )
435 return ( a.high == b.high ) && ( a.low == b.low );
439 INLINE flag floatx80_isNaN( floatx80 a )
442 return ( ( a.high & 0x7FFF ) == 0x7FFF ) && a.low;
450 INLINE flag float128_same( float128 a, float128 b )
453 return ( a.high == b.high ) && ( a.low == b.low );
457 INLINE flag float128_isNaN( float128 a )
461 absAHigh = a.high & LIT64( 0x7FFFFFFFFFFFFFFF );
463 ( LIT64( 0x7FFF000000000000 ) < absAHigh )
464 || ( ( absAHigh == LIT64( 0x7FFF000000000000 ) ) && a.low );
471 test_a_int32_z_float32(
472 float32 trueFunction( int32 ), float32 testFunction( int32 ) )
475 float32 trueZ, testZ;
476 uint8 trueFlags, testFlags;
479 tenthousandsCount = 0;
481 testCases_initSequence( testCases_sequence_a_int32 );
483 while ( ! testCases_done || forever ) {
486 trueZ = trueFunction( testCases_a_int32 );
487 trueFlags = *trueFlagsPtr;
488 (void) testFlagsFunctionPtr();
489 testZ = testFunction( testCases_a_int32 );
490 testFlags = testFlagsFunctionPtr();
496 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
498 && float32_isNaN( trueZ )
499 && float32_isNaN( testZ )
500 && ! float32_is_signaling_nan( testZ )
501 && ( trueFlags == testFlags )
507 writeErrorFound( 10000 - count );
508 writeInput_a_int32();
509 fputs( " ", stdout );
510 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
512 if ( errorCount == maxErrorCount ) goto exit;
517 writeTestsPerformed( 10000 - count );
522 test_a_int32_z_float64(
523 float64 trueFunction( int32 ), float64 testFunction( int32 ) )
526 float64 trueZ, testZ;
527 uint8 trueFlags, testFlags;
530 tenthousandsCount = 0;
532 testCases_initSequence( testCases_sequence_a_int32 );
534 while ( ! testCases_done || forever ) {
537 trueZ = trueFunction( testCases_a_int32 );
538 trueFlags = *trueFlagsPtr;
539 (void) testFlagsFunctionPtr();
540 testZ = testFunction( testCases_a_int32 );
541 testFlags = testFlagsFunctionPtr();
547 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
549 && float64_isNaN( trueZ )
550 && float64_isNaN( testZ )
551 && ! float64_is_signaling_nan( testZ )
552 && ( trueFlags == testFlags )
558 writeErrorFound( 10000 - count );
559 writeInput_a_int32();
560 fputs( " ", stdout );
561 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
563 if ( errorCount == maxErrorCount ) goto exit;
568 writeTestsPerformed( 10000 - count );
575 test_a_int32_z_floatx80(
576 floatx80 trueFunction( int32 ), floatx80 testFunction( int32 ) )
579 floatx80 trueZ, testZ;
580 uint8 trueFlags, testFlags;
583 tenthousandsCount = 0;
585 testCases_initSequence( testCases_sequence_a_int32 );
587 while ( ! testCases_done || forever ) {
590 trueZ = trueFunction( testCases_a_int32 );
591 trueFlags = *trueFlagsPtr;
592 (void) testFlagsFunctionPtr();
593 testZ = testFunction( testCases_a_int32 );
594 testFlags = testFlagsFunctionPtr();
600 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
602 && floatx80_isNaN( trueZ )
603 && floatx80_isNaN( testZ )
604 && ! floatx80_is_signaling_nan( testZ )
605 && ( trueFlags == testFlags )
611 writeErrorFound( 10000 - count );
612 writeInput_a_int32();
613 fputs( " ", stdout );
614 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
616 if ( errorCount == maxErrorCount ) goto exit;
621 writeTestsPerformed( 10000 - count );
630 test_a_int32_z_float128(
631 float128 trueFunction( int32 ), float128 testFunction( int32 ) )
634 float128 trueZ, testZ;
635 uint8 trueFlags, testFlags;
638 tenthousandsCount = 0;
640 testCases_initSequence( testCases_sequence_a_int32 );
642 while ( ! testCases_done || forever ) {
645 trueZ = trueFunction( testCases_a_int32 );
646 trueFlags = *trueFlagsPtr;
647 (void) testFlagsFunctionPtr();
648 testZ = testFunction( testCases_a_int32 );
649 testFlags = testFlagsFunctionPtr();
655 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
657 && float128_isNaN( trueZ )
658 && float128_isNaN( testZ )
659 && ! float128_is_signaling_nan( testZ )
660 && ( trueFlags == testFlags )
666 writeErrorFound( 10000 - count );
667 writeInput_a_int32();
668 fputs( "\n\t", stdout );
669 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
671 if ( errorCount == maxErrorCount ) goto exit;
676 writeTestsPerformed( 10000 - count );
685 test_a_int64_z_float32(
686 float32 trueFunction( int64 ), float32 testFunction( int64 ) )
689 float32 trueZ, testZ;
690 uint8 trueFlags, testFlags;
693 tenthousandsCount = 0;
695 testCases_initSequence( testCases_sequence_a_int64 );
697 while ( ! testCases_done || forever ) {
700 trueZ = trueFunction( testCases_a_int64 );
701 trueFlags = *trueFlagsPtr;
702 (void) testFlagsFunctionPtr();
703 testZ = testFunction( testCases_a_int64 );
704 testFlags = testFlagsFunctionPtr();
710 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
712 && float32_isNaN( trueZ )
713 && float32_isNaN( testZ )
714 && ! float32_is_signaling_nan( testZ )
715 && ( trueFlags == testFlags )
721 writeErrorFound( 10000 - count );
722 writeInput_a_int64();
723 fputs( " ", stdout );
724 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
726 if ( errorCount == maxErrorCount ) goto exit;
731 writeTestsPerformed( 10000 - count );
736 test_a_int64_z_float64(
737 float64 trueFunction( int64 ), float64 testFunction( int64 ) )
740 float64 trueZ, testZ;
741 uint8 trueFlags, testFlags;
744 tenthousandsCount = 0;
746 testCases_initSequence( testCases_sequence_a_int64 );
748 while ( ! testCases_done || forever ) {
751 trueZ = trueFunction( testCases_a_int64 );
752 trueFlags = *trueFlagsPtr;
753 (void) testFlagsFunctionPtr();
754 testZ = testFunction( testCases_a_int64 );
755 testFlags = testFlagsFunctionPtr();
761 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
763 && float64_isNaN( trueZ )
764 && float64_isNaN( testZ )
765 && ! float64_is_signaling_nan( testZ )
766 && ( trueFlags == testFlags )
772 writeErrorFound( 10000 - count );
773 writeInput_a_int64();
774 fputs( " ", stdout );
775 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
777 if ( errorCount == maxErrorCount ) goto exit;
782 writeTestsPerformed( 10000 - count );
789 test_a_int64_z_floatx80(
790 floatx80 trueFunction( int64 ), floatx80 testFunction( int64 ) )
793 floatx80 trueZ, testZ;
794 uint8 trueFlags, testFlags;
797 tenthousandsCount = 0;
799 testCases_initSequence( testCases_sequence_a_int64 );
801 while ( ! testCases_done || forever ) {
804 trueZ = trueFunction( testCases_a_int64 );
805 trueFlags = *trueFlagsPtr;
806 (void) testFlagsFunctionPtr();
807 testZ = testFunction( testCases_a_int64 );
808 testFlags = testFlagsFunctionPtr();
814 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
816 && floatx80_isNaN( trueZ )
817 && floatx80_isNaN( testZ )
818 && ! floatx80_is_signaling_nan( testZ )
819 && ( trueFlags == testFlags )
825 writeErrorFound( 10000 - count );
826 writeInput_a_int64();
827 fputs( " ", stdout );
828 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
830 if ( errorCount == maxErrorCount ) goto exit;
835 writeTestsPerformed( 10000 - count );
844 test_a_int64_z_float128(
845 float128 trueFunction( int64 ), float128 testFunction( int64 ) )
848 float128 trueZ, testZ;
849 uint8 trueFlags, testFlags;
852 tenthousandsCount = 0;
854 testCases_initSequence( testCases_sequence_a_int64 );
856 while ( ! testCases_done || forever ) {
859 trueZ = trueFunction( testCases_a_int64 );
860 trueFlags = *trueFlagsPtr;
861 (void) testFlagsFunctionPtr();
862 testZ = testFunction( testCases_a_int64 );
863 testFlags = testFlagsFunctionPtr();
869 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
871 && float128_isNaN( trueZ )
872 && float128_isNaN( testZ )
873 && ! float128_is_signaling_nan( testZ )
874 && ( trueFlags == testFlags )
880 writeErrorFound( 10000 - count );
881 writeInput_a_int64();
882 fputs( "\n\t", stdout );
883 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
885 if ( errorCount == maxErrorCount ) goto exit;
890 writeTestsPerformed( 10000 - count );
899 test_a_float32_z_int32(
900 int32 trueFunction( float32 ), int32 testFunction( float32 ) )
904 uint8 trueFlags, testFlags;
907 tenthousandsCount = 0;
909 testCases_initSequence( testCases_sequence_a_float32 );
911 while ( ! testCases_done || forever ) {
914 trueZ = trueFunction( testCases_a_float32 );
915 trueFlags = *trueFlagsPtr;
916 (void) testFlagsFunctionPtr();
917 testZ = testFunction( testCases_a_float32 );
918 testFlags = testFlagsFunctionPtr();
924 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
926 && float32_is_signaling_nan( testCases_a_float32 ) ) {
927 trueFlags |= float_flag_invalid;
929 if ( ( trueZ == 0x7FFFFFFF )
930 && ( ( testZ == 0x7FFFFFFF )
931 || ( testZ == (sbits32) 0x80000000 ) )
932 && ( trueFlags == float_flag_invalid )
933 && ( testFlags == float_flag_invalid )
939 writeErrorFound( 10000 - count );
940 writeInput_a_float32();
941 fputs( " ", stdout );
942 writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
944 if ( errorCount == maxErrorCount ) goto exit;
949 writeTestsPerformed( 10000 - count );
956 test_a_float32_z_int64(
957 int64 trueFunction( float32 ), int64 testFunction( float32 ) )
961 uint8 trueFlags, testFlags;
964 tenthousandsCount = 0;
966 testCases_initSequence( testCases_sequence_a_float32 );
968 while ( ! testCases_done || forever ) {
971 trueZ = trueFunction( testCases_a_float32 );
972 trueFlags = *trueFlagsPtr;
973 (void) testFlagsFunctionPtr();
974 testZ = testFunction( testCases_a_float32 );
975 testFlags = testFlagsFunctionPtr();
981 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
983 && float32_is_signaling_nan( testCases_a_float32 ) ) {
984 trueFlags |= float_flag_invalid;
986 if ( ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
987 && ( ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
988 || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
989 && ( trueFlags == float_flag_invalid )
990 && ( testFlags == float_flag_invalid )
996 writeErrorFound( 10000 - count );
997 writeInput_a_float32();
998 fputs( " ", stdout );
999 writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1001 if ( errorCount == maxErrorCount ) goto exit;
1006 writeTestsPerformed( 10000 - count );
1013 test_a_float32_z_float64(
1014 float64 trueFunction( float32 ), float64 testFunction( float32 ) )
1017 float64 trueZ, testZ;
1018 uint8 trueFlags, testFlags;
1021 tenthousandsCount = 0;
1023 testCases_initSequence( testCases_sequence_a_float32 );
1025 while ( ! testCases_done || forever ) {
1028 trueZ = trueFunction( testCases_a_float32 );
1029 trueFlags = *trueFlagsPtr;
1030 (void) testFlagsFunctionPtr();
1031 testZ = testFunction( testCases_a_float32 );
1032 testFlags = testFlagsFunctionPtr();
1038 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1040 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1041 trueFlags |= float_flag_invalid;
1044 && float64_isNaN( trueZ )
1045 && float64_isNaN( testZ )
1046 && ! float64_is_signaling_nan( testZ )
1047 && ( trueFlags == testFlags )
1053 writeErrorFound( 10000 - count );
1054 writeInput_a_float32();
1055 fputs( " ", stdout );
1056 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1058 if ( errorCount == maxErrorCount ) goto exit;
1063 writeTestsPerformed( 10000 - count );
1070 test_a_float32_z_floatx80(
1071 floatx80 trueFunction( float32 ), floatx80 testFunction( float32 ) )
1074 floatx80 trueZ, testZ;
1075 uint8 trueFlags, testFlags;
1078 tenthousandsCount = 0;
1080 testCases_initSequence( testCases_sequence_a_float32 );
1082 while ( ! testCases_done || forever ) {
1085 trueZ = trueFunction( testCases_a_float32 );
1086 trueFlags = *trueFlagsPtr;
1087 (void) testFlagsFunctionPtr();
1088 testZ = testFunction( testCases_a_float32 );
1089 testFlags = testFlagsFunctionPtr();
1095 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1097 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1098 trueFlags |= float_flag_invalid;
1101 && floatx80_isNaN( trueZ )
1102 && floatx80_isNaN( testZ )
1103 && ! floatx80_is_signaling_nan( testZ )
1104 && ( trueFlags == testFlags )
1110 writeErrorFound( 10000 - count );
1111 writeInput_a_float32();
1112 fputs( "\n\t", stdout );
1113 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
1115 if ( errorCount == maxErrorCount ) goto exit;
1120 writeTestsPerformed( 10000 - count );
1129 test_a_float32_z_float128(
1130 float128 trueFunction( float32 ), float128 testFunction( float32 ) )
1133 float128 trueZ, testZ;
1134 uint8 trueFlags, testFlags;
1137 tenthousandsCount = 0;
1139 testCases_initSequence( testCases_sequence_a_float32 );
1141 while ( ! testCases_done || forever ) {
1144 trueZ = trueFunction( testCases_a_float32 );
1145 trueFlags = *trueFlagsPtr;
1146 (void) testFlagsFunctionPtr();
1147 testZ = testFunction( testCases_a_float32 );
1148 testFlags = testFlagsFunctionPtr();
1154 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1156 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1157 trueFlags |= float_flag_invalid;
1160 && float128_isNaN( trueZ )
1161 && float128_isNaN( testZ )
1162 && ! float128_is_signaling_nan( testZ )
1163 && ( trueFlags == testFlags )
1169 writeErrorFound( 10000 - count );
1170 writeInput_a_float32();
1171 fputs( "\n\t", stdout );
1172 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
1174 if ( errorCount == maxErrorCount ) goto exit;
1179 writeTestsPerformed( 10000 - count );
1187 float32 trueFunction( float32 ), float32 testFunction( float32 ) )
1190 float32 trueZ, testZ;
1191 uint8 trueFlags, testFlags;
1194 tenthousandsCount = 0;
1196 testCases_initSequence( testCases_sequence_a_float32 );
1198 while ( ! testCases_done || forever ) {
1201 trueZ = trueFunction( testCases_a_float32 );
1202 trueFlags = *trueFlagsPtr;
1203 (void) testFlagsFunctionPtr();
1204 testZ = testFunction( testCases_a_float32 );
1205 testFlags = testFlagsFunctionPtr();
1211 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1213 && float32_is_signaling_nan( testCases_a_float32 ) ) {
1214 trueFlags |= float_flag_invalid;
1217 && float32_isNaN( trueZ )
1218 && float32_isNaN( testZ )
1219 && ! float32_is_signaling_nan( testZ )
1220 && ( trueFlags == testFlags )
1226 writeErrorFound( 10000 - count );
1227 writeInput_a_float32();
1228 fputs( " ", stdout );
1229 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1231 if ( errorCount == maxErrorCount ) goto exit;
1236 writeTestsPerformed( 10000 - count );
1241 test_ab_float32_z_flag(
1242 flag trueFunction( float32, float32 ),
1243 flag testFunction( float32, float32 )
1248 uint8 trueFlags, testFlags;
1251 tenthousandsCount = 0;
1253 testCases_initSequence( testCases_sequence_ab_float32 );
1255 while ( ! testCases_done || forever ) {
1258 trueZ = trueFunction( testCases_a_float32, testCases_b_float32 );
1259 trueFlags = *trueFlagsPtr;
1260 (void) testFlagsFunctionPtr();
1261 testZ = testFunction( testCases_a_float32, testCases_b_float32 );
1262 testFlags = testFlagsFunctionPtr();
1268 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1270 && ( float32_is_signaling_nan( testCases_a_float32 )
1271 || float32_is_signaling_nan( testCases_b_float32 ) )
1273 trueFlags |= float_flag_invalid;
1275 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1277 writeErrorFound( 10000 - count );
1278 writeInputs_ab_float32();
1279 fputs( " ", stdout );
1280 writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
1282 if ( errorCount == maxErrorCount ) goto exit;
1287 writeTestsPerformed( 10000 - count );
1294 float32 trueFunction( float32, float32 ),
1295 float32 testFunction( float32, float32 )
1299 float32 trueZ, testZ;
1300 uint8 trueFlags, testFlags;
1303 tenthousandsCount = 0;
1305 testCases_initSequence( testCases_sequence_ab_float32 );
1307 while ( ! testCases_done || forever ) {
1310 trueZ = trueFunction( testCases_a_float32, testCases_b_float32 );
1311 trueFlags = *trueFlagsPtr;
1312 (void) testFlagsFunctionPtr();
1313 testZ = testFunction( testCases_a_float32, testCases_b_float32 );
1314 testFlags = testFlagsFunctionPtr();
1320 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1322 && ( float32_is_signaling_nan( testCases_a_float32 )
1323 || float32_is_signaling_nan( testCases_b_float32 ) )
1325 trueFlags |= float_flag_invalid;
1328 && float32_isNaN( trueZ )
1329 && float32_isNaN( testZ )
1330 && ! float32_is_signaling_nan( testZ )
1331 && ( trueFlags == testFlags )
1337 writeErrorFound( 10000 - count );
1338 writeInputs_ab_float32();
1339 fputs( " ", stdout );
1340 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1342 if ( errorCount == maxErrorCount ) goto exit;
1347 writeTestsPerformed( 10000 - count );
1353 test_a_float64_z_int32(
1354 int32 trueFunction( float64 ), int32 testFunction( float64 ) )
1358 uint8 trueFlags, testFlags;
1361 tenthousandsCount = 0;
1363 testCases_initSequence( testCases_sequence_a_float64 );
1365 while ( ! testCases_done || forever ) {
1368 trueZ = trueFunction( testCases_a_float64 );
1369 trueFlags = *trueFlagsPtr;
1370 (void) testFlagsFunctionPtr();
1371 testZ = testFunction( testCases_a_float64 );
1372 testFlags = testFlagsFunctionPtr();
1378 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1380 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1381 trueFlags |= float_flag_invalid;
1383 if ( ( trueZ == 0x7FFFFFFF )
1384 && ( ( testZ == 0x7FFFFFFF )
1385 || ( testZ == (sbits32) 0x80000000 ) )
1386 && ( trueFlags == float_flag_invalid )
1387 && ( testFlags == float_flag_invalid )
1393 writeErrorFound( 10000 - count );
1394 writeInput_a_float64();
1395 fputs( " ", stdout );
1396 writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
1398 if ( errorCount == maxErrorCount ) goto exit;
1403 writeTestsPerformed( 10000 - count );
1410 test_a_float64_z_int64(
1411 int64 trueFunction( float64 ), int64 testFunction( float64 ) )
1415 uint8 trueFlags, testFlags;
1418 tenthousandsCount = 0;
1420 testCases_initSequence( testCases_sequence_a_float64 );
1422 while ( ! testCases_done || forever ) {
1425 trueZ = trueFunction( testCases_a_float64 );
1426 trueFlags = *trueFlagsPtr;
1427 (void) testFlagsFunctionPtr();
1428 testZ = testFunction( testCases_a_float64 );
1429 testFlags = testFlagsFunctionPtr();
1435 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1437 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1438 trueFlags |= float_flag_invalid;
1440 if ( ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1441 && ( ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1442 || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
1443 && ( trueFlags == float_flag_invalid )
1444 && ( testFlags == float_flag_invalid )
1450 writeErrorFound( 10000 - count );
1451 writeInput_a_float64();
1452 fputs( " ", stdout );
1453 writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1455 if ( errorCount == maxErrorCount ) goto exit;
1460 writeTestsPerformed( 10000 - count );
1467 test_a_float64_z_float32(
1468 float32 trueFunction( float64 ), float32 testFunction( float64 ) )
1471 float32 trueZ, testZ;
1472 uint8 trueFlags, testFlags;
1475 tenthousandsCount = 0;
1477 testCases_initSequence( testCases_sequence_a_float64 );
1479 while ( ! testCases_done || forever ) {
1482 trueZ = trueFunction( testCases_a_float64 );
1483 trueFlags = *trueFlagsPtr;
1484 (void) testFlagsFunctionPtr();
1485 testZ = testFunction( testCases_a_float64 );
1486 testFlags = testFlagsFunctionPtr();
1492 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1494 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1495 trueFlags |= float_flag_invalid;
1498 && float32_isNaN( trueZ )
1499 && float32_isNaN( testZ )
1500 && ! float32_is_signaling_nan( testZ )
1501 && ( trueFlags == testFlags )
1507 writeErrorFound( 10000 - count );
1508 writeInput_a_float64();
1509 fputs( " ", stdout );
1510 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1512 if ( errorCount == maxErrorCount ) goto exit;
1517 writeTestsPerformed( 10000 - count );
1524 test_a_float64_z_floatx80(
1525 floatx80 trueFunction( float64 ), floatx80 testFunction( float64 ) )
1528 floatx80 trueZ, testZ;
1529 uint8 trueFlags, testFlags;
1532 tenthousandsCount = 0;
1534 testCases_initSequence( testCases_sequence_a_float64 );
1536 while ( ! testCases_done || forever ) {
1539 trueZ = trueFunction( testCases_a_float64 );
1540 trueFlags = *trueFlagsPtr;
1541 (void) testFlagsFunctionPtr();
1542 testZ = testFunction( testCases_a_float64 );
1543 testFlags = testFlagsFunctionPtr();
1549 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1551 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1552 trueFlags |= float_flag_invalid;
1555 && floatx80_isNaN( trueZ )
1556 && floatx80_isNaN( testZ )
1557 && ! floatx80_is_signaling_nan( testZ )
1558 && ( trueFlags == testFlags )
1564 writeErrorFound( 10000 - count );
1565 writeInput_a_float64();
1566 fputs( "\n\t", stdout );
1567 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
1569 if ( errorCount == maxErrorCount ) goto exit;
1574 writeTestsPerformed( 10000 - count );
1583 test_a_float64_z_float128(
1584 float128 trueFunction( float64 ), float128 testFunction( float64 ) )
1587 float128 trueZ, testZ;
1588 uint8 trueFlags, testFlags;
1591 tenthousandsCount = 0;
1593 testCases_initSequence( testCases_sequence_a_float64 );
1595 while ( ! testCases_done || forever ) {
1598 trueZ = trueFunction( testCases_a_float64 );
1599 trueFlags = *trueFlagsPtr;
1600 (void) testFlagsFunctionPtr();
1601 testZ = testFunction( testCases_a_float64 );
1602 testFlags = testFlagsFunctionPtr();
1608 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1610 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1611 trueFlags |= float_flag_invalid;
1614 && float128_isNaN( trueZ )
1615 && float128_isNaN( testZ )
1616 && ! float128_is_signaling_nan( testZ )
1617 && ( trueFlags == testFlags )
1623 writeErrorFound( 10000 - count );
1624 writeInput_a_float64();
1625 fputs( "\n\t", stdout );
1626 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
1628 if ( errorCount == maxErrorCount ) goto exit;
1633 writeTestsPerformed( 10000 - count );
1641 float64 trueFunction( float64 ), float64 testFunction( float64 ) )
1644 float64 trueZ, testZ;
1645 uint8 trueFlags, testFlags;
1648 tenthousandsCount = 0;
1650 testCases_initSequence( testCases_sequence_a_float64 );
1652 while ( ! testCases_done || forever ) {
1655 trueZ = trueFunction( testCases_a_float64 );
1656 trueFlags = *trueFlagsPtr;
1657 (void) testFlagsFunctionPtr();
1658 testZ = testFunction( testCases_a_float64 );
1659 testFlags = testFlagsFunctionPtr();
1665 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1667 && float64_is_signaling_nan( testCases_a_float64 ) ) {
1668 trueFlags |= float_flag_invalid;
1671 && float64_isNaN( trueZ )
1672 && float64_isNaN( testZ )
1673 && ! float64_is_signaling_nan( testZ )
1674 && ( trueFlags == testFlags )
1680 writeErrorFound( 10000 - count );
1681 writeInput_a_float64();
1682 fputs( " ", stdout );
1683 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1685 if ( errorCount == maxErrorCount ) goto exit;
1690 writeTestsPerformed( 10000 - count );
1695 test_ab_float64_z_flag(
1696 flag trueFunction( float64, float64 ),
1697 flag testFunction( float64, float64 )
1702 uint8 trueFlags, testFlags;
1705 tenthousandsCount = 0;
1707 testCases_initSequence( testCases_sequence_ab_float64 );
1709 while ( ! testCases_done || forever ) {
1712 trueZ = trueFunction( testCases_a_float64, testCases_b_float64 );
1713 trueFlags = *trueFlagsPtr;
1714 (void) testFlagsFunctionPtr();
1715 testZ = testFunction( testCases_a_float64, testCases_b_float64 );
1716 testFlags = testFlagsFunctionPtr();
1722 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1724 && ( float64_is_signaling_nan( testCases_a_float64 )
1725 || float64_is_signaling_nan( testCases_b_float64 ) )
1727 trueFlags |= float_flag_invalid;
1729 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1731 writeErrorFound( 10000 - count );
1732 writeInputs_ab_float64();
1733 fputs( " ", stdout );
1734 writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
1736 if ( errorCount == maxErrorCount ) goto exit;
1741 writeTestsPerformed( 10000 - count );
1748 float64 trueFunction( float64, float64 ),
1749 float64 testFunction( float64, float64 )
1753 float64 trueZ, testZ;
1754 uint8 trueFlags, testFlags;
1757 tenthousandsCount = 0;
1759 testCases_initSequence( testCases_sequence_ab_float64 );
1761 while ( ! testCases_done || forever ) {
1764 trueZ = trueFunction( testCases_a_float64, testCases_b_float64 );
1765 trueFlags = *trueFlagsPtr;
1766 (void) testFlagsFunctionPtr();
1767 testZ = testFunction( testCases_a_float64, testCases_b_float64 );
1768 testFlags = testFlagsFunctionPtr();
1774 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
1776 && ( float64_is_signaling_nan( testCases_a_float64 )
1777 || float64_is_signaling_nan( testCases_b_float64 ) )
1779 trueFlags |= float_flag_invalid;
1782 && float64_isNaN( trueZ )
1783 && float64_isNaN( testZ )
1784 && ! float64_is_signaling_nan( testZ )
1785 && ( trueFlags == testFlags )
1791 writeErrorFound( 10000 - count );
1792 writeInputs_ab_float64();
1793 fputs( "\n\t", stdout );
1794 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
1796 if ( errorCount == maxErrorCount ) goto exit;
1801 writeTestsPerformed( 10000 - count );
1809 test_a_floatx80_z_int32(
1810 int32 trueFunction( floatx80 ), int32 testFunction( floatx80 ) )
1814 uint8 trueFlags, testFlags;
1817 tenthousandsCount = 0;
1819 testCases_initSequence( testCases_sequence_a_floatx80 );
1821 while ( ! testCases_done || forever ) {
1824 trueZ = trueFunction( testCases_a_floatx80 );
1825 trueFlags = *trueFlagsPtr;
1826 (void) testFlagsFunctionPtr();
1827 testZ = testFunction( testCases_a_floatx80 );
1828 testFlags = testFlagsFunctionPtr();
1834 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1836 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1837 trueFlags |= float_flag_invalid;
1839 if ( ( trueZ == 0x7FFFFFFF )
1840 && ( ( testZ == 0x7FFFFFFF )
1841 || ( testZ == (sbits32) 0x80000000 ) )
1842 && ( trueFlags == float_flag_invalid )
1843 && ( testFlags == float_flag_invalid )
1849 writeErrorFound( 10000 - count );
1850 writeInput_a_floatx80();
1851 fputs( " ", stdout );
1852 writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
1854 if ( errorCount == maxErrorCount ) goto exit;
1859 writeTestsPerformed( 10000 - count );
1866 test_a_floatx80_z_int64(
1867 int64 trueFunction( floatx80 ), int64 testFunction( floatx80 ) )
1871 uint8 trueFlags, testFlags;
1874 tenthousandsCount = 0;
1876 testCases_initSequence( testCases_sequence_a_floatx80 );
1878 while ( ! testCases_done || forever ) {
1881 trueZ = trueFunction( testCases_a_floatx80 );
1882 trueFlags = *trueFlagsPtr;
1883 (void) testFlagsFunctionPtr();
1884 testZ = testFunction( testCases_a_floatx80 );
1885 testFlags = testFlagsFunctionPtr();
1891 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1893 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1894 trueFlags |= float_flag_invalid;
1896 if ( ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1897 && ( ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
1898 || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
1899 && ( trueFlags == float_flag_invalid )
1900 && ( testFlags == float_flag_invalid )
1906 writeErrorFound( 10000 - count );
1907 writeInput_a_floatx80();
1908 fputs( " ", stdout );
1909 writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
1911 if ( errorCount == maxErrorCount ) goto exit;
1916 writeTestsPerformed( 10000 - count );
1923 test_a_floatx80_z_float32(
1924 float32 trueFunction( floatx80 ), float32 testFunction( floatx80 ) )
1927 float32 trueZ, testZ;
1928 uint8 trueFlags, testFlags;
1931 tenthousandsCount = 0;
1933 testCases_initSequence( testCases_sequence_a_floatx80 );
1935 while ( ! testCases_done || forever ) {
1938 trueZ = trueFunction( testCases_a_floatx80 );
1939 trueFlags = *trueFlagsPtr;
1940 (void) testFlagsFunctionPtr();
1941 testZ = testFunction( testCases_a_floatx80 );
1942 testFlags = testFlagsFunctionPtr();
1948 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
1950 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
1951 trueFlags |= float_flag_invalid;
1954 && float32_isNaN( trueZ )
1955 && float32_isNaN( testZ )
1956 && ! float32_is_signaling_nan( testZ )
1957 && ( trueFlags == testFlags )
1963 writeErrorFound( 10000 - count );
1964 writeInput_a_floatx80();
1965 fputs( " ", stdout );
1966 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
1968 if ( errorCount == maxErrorCount ) goto exit;
1973 writeTestsPerformed( 10000 - count );
1978 test_a_floatx80_z_float64(
1979 float64 trueFunction( floatx80 ), float64 testFunction( floatx80 ) )
1982 float64 trueZ, testZ;
1983 uint8 trueFlags, testFlags;
1986 tenthousandsCount = 0;
1988 testCases_initSequence( testCases_sequence_a_floatx80 );
1990 while ( ! testCases_done || forever ) {
1993 trueZ = trueFunction( testCases_a_floatx80 );
1994 trueFlags = *trueFlagsPtr;
1995 (void) testFlagsFunctionPtr();
1996 testZ = testFunction( testCases_a_floatx80 );
1997 testFlags = testFlagsFunctionPtr();
2003 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2005 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2006 trueFlags |= float_flag_invalid;
2009 && float64_isNaN( trueZ )
2010 && float64_isNaN( testZ )
2011 && ! float64_is_signaling_nan( testZ )
2012 && ( trueFlags == testFlags )
2018 writeErrorFound( 10000 - count );
2019 writeInput_a_floatx80();
2020 fputs( "\n\t", stdout );
2021 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
2023 if ( errorCount == maxErrorCount ) goto exit;
2028 writeTestsPerformed( 10000 - count );
2035 test_a_floatx80_z_float128(
2036 float128 trueFunction( floatx80 ), float128 testFunction( floatx80 ) )
2039 float128 trueZ, testZ;
2040 uint8 trueFlags, testFlags;
2043 tenthousandsCount = 0;
2045 testCases_initSequence( testCases_sequence_a_floatx80 );
2047 while ( ! testCases_done || forever ) {
2050 trueZ = trueFunction( testCases_a_floatx80 );
2051 trueFlags = *trueFlagsPtr;
2052 (void) testFlagsFunctionPtr();
2053 testZ = testFunction( testCases_a_floatx80 );
2054 testFlags = testFlagsFunctionPtr();
2060 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2062 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2063 trueFlags |= float_flag_invalid;
2066 && float128_isNaN( trueZ )
2067 && float128_isNaN( testZ )
2068 && ! float128_is_signaling_nan( testZ )
2069 && ( trueFlags == testFlags )
2075 writeErrorFound( 10000 - count );
2076 writeInput_a_floatx80();
2077 fputs( "\n\t", stdout );
2078 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2080 if ( errorCount == maxErrorCount ) goto exit;
2085 writeTestsPerformed( 10000 - count );
2093 floatx80 trueFunction( floatx80 ), floatx80 testFunction( floatx80 ) )
2096 floatx80 trueZ, testZ;
2097 uint8 trueFlags, testFlags;
2100 tenthousandsCount = 0;
2102 testCases_initSequence( testCases_sequence_a_floatx80 );
2104 while ( ! testCases_done || forever ) {
2107 trueZ = trueFunction( testCases_a_floatx80 );
2108 trueFlags = *trueFlagsPtr;
2109 (void) testFlagsFunctionPtr();
2110 testZ = testFunction( testCases_a_floatx80 );
2111 testFlags = testFlagsFunctionPtr();
2117 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2119 && floatx80_is_signaling_nan( testCases_a_floatx80 ) ) {
2120 trueFlags |= float_flag_invalid;
2123 && floatx80_isNaN( trueZ )
2124 && floatx80_isNaN( testZ )
2125 && ! floatx80_is_signaling_nan( testZ )
2126 && ( trueFlags == testFlags )
2132 writeErrorFound( 10000 - count );
2133 writeInput_a_floatx80();
2134 fputs( "\n\t", stdout );
2135 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2137 if ( errorCount == maxErrorCount ) goto exit;
2142 writeTestsPerformed( 10000 - count );
2147 test_ab_floatx80_z_flag(
2148 flag trueFunction( floatx80, floatx80 ),
2149 flag testFunction( floatx80, floatx80 )
2154 uint8 trueFlags, testFlags;
2157 tenthousandsCount = 0;
2159 testCases_initSequence( testCases_sequence_ab_floatx80 );
2161 while ( ! testCases_done || forever ) {
2164 trueZ = trueFunction( testCases_a_floatx80, testCases_b_floatx80 );
2165 trueFlags = *trueFlagsPtr;
2166 (void) testFlagsFunctionPtr();
2167 testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 );
2168 testFlags = testFlagsFunctionPtr();
2174 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2176 && ( floatx80_is_signaling_nan( testCases_a_floatx80 )
2177 || floatx80_is_signaling_nan( testCases_b_floatx80 ) )
2179 trueFlags |= float_flag_invalid;
2181 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2183 writeErrorFound( 10000 - count );
2184 writeInputs_ab_floatx80();
2185 fputs( " ", stdout );
2186 writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
2188 if ( errorCount == maxErrorCount ) goto exit;
2193 writeTestsPerformed( 10000 - count );
2200 floatx80 trueFunction( floatx80, floatx80 ),
2201 floatx80 testFunction( floatx80, floatx80 )
2205 floatx80 trueZ, testZ;
2206 uint8 trueFlags, testFlags;
2209 tenthousandsCount = 0;
2211 testCases_initSequence( testCases_sequence_ab_floatx80 );
2213 while ( ! testCases_done || forever ) {
2216 trueZ = trueFunction( testCases_a_floatx80, testCases_b_floatx80 );
2217 trueFlags = *trueFlagsPtr;
2218 (void) testFlagsFunctionPtr();
2219 testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 );
2220 testFlags = testFlagsFunctionPtr();
2226 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2228 && ( floatx80_is_signaling_nan( testCases_a_floatx80 )
2229 || floatx80_is_signaling_nan( testCases_b_floatx80 ) )
2231 trueFlags |= float_flag_invalid;
2234 && floatx80_isNaN( trueZ )
2235 && floatx80_isNaN( testZ )
2236 && ! floatx80_is_signaling_nan( testZ )
2237 && ( trueFlags == testFlags )
2243 writeErrorFound( 10000 - count );
2244 writeInputs_ab_floatx80();
2245 fputs( "\n\t", stdout );
2246 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2248 if ( errorCount == maxErrorCount ) goto exit;
2253 writeTestsPerformed( 10000 - count );
2263 test_a_float128_z_int32(
2264 int32 trueFunction( float128 ), int32 testFunction( float128 ) )
2268 uint8 trueFlags, testFlags;
2271 tenthousandsCount = 0;
2273 testCases_initSequence( testCases_sequence_a_float128 );
2275 while ( ! testCases_done || forever ) {
2278 trueZ = trueFunction( testCases_a_float128 );
2279 trueFlags = *trueFlagsPtr;
2280 (void) testFlagsFunctionPtr();
2281 testZ = testFunction( testCases_a_float128 );
2282 testFlags = testFlagsFunctionPtr();
2288 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2290 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2291 trueFlags |= float_flag_invalid;
2293 if ( ( trueZ == 0x7FFFFFFF )
2294 && ( ( testZ == 0x7FFFFFFF )
2295 || ( testZ == (sbits32) 0x80000000 ) )
2296 && ( trueFlags == float_flag_invalid )
2297 && ( testFlags == float_flag_invalid )
2303 writeErrorFound( 10000 - count );
2304 writeInput_a_float128();
2305 fputs( " ", stdout );
2306 writeOutputs_z_int32( trueZ, trueFlags, testZ, testFlags );
2308 if ( errorCount == maxErrorCount ) goto exit;
2313 writeTestsPerformed( 10000 - count );
2320 test_a_float128_z_int64(
2321 int64 trueFunction( float128 ), int64 testFunction( float128 ) )
2325 uint8 trueFlags, testFlags;
2328 tenthousandsCount = 0;
2330 testCases_initSequence( testCases_sequence_a_float128 );
2332 while ( ! testCases_done || forever ) {
2335 trueZ = trueFunction( testCases_a_float128 );
2336 trueFlags = *trueFlagsPtr;
2337 (void) testFlagsFunctionPtr();
2338 testZ = testFunction( testCases_a_float128 );
2339 testFlags = testFlagsFunctionPtr();
2345 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2347 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2348 trueFlags |= float_flag_invalid;
2350 if ( ( trueZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
2351 && ( ( testZ == LIT64( 0x7FFFFFFFFFFFFFFF ) )
2352 || ( testZ == (sbits64) LIT64( 0x8000000000000000 ) ) )
2353 && ( trueFlags == float_flag_invalid )
2354 && ( testFlags == float_flag_invalid )
2360 writeErrorFound( 10000 - count );
2361 writeInput_a_float128();
2362 fputs( "\n\t", stdout );
2363 writeOutputs_z_int64( trueZ, trueFlags, testZ, testFlags );
2365 if ( errorCount == maxErrorCount ) goto exit;
2370 writeTestsPerformed( 10000 - count );
2377 test_a_float128_z_float32(
2378 float32 trueFunction( float128 ), float32 testFunction( float128 ) )
2381 float32 trueZ, testZ;
2382 uint8 trueFlags, testFlags;
2385 tenthousandsCount = 0;
2387 testCases_initSequence( testCases_sequence_a_float128 );
2389 while ( ! testCases_done || forever ) {
2392 trueZ = trueFunction( testCases_a_float128 );
2393 trueFlags = *trueFlagsPtr;
2394 (void) testFlagsFunctionPtr();
2395 testZ = testFunction( testCases_a_float128 );
2396 testFlags = testFlagsFunctionPtr();
2402 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2404 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2405 trueFlags |= float_flag_invalid;
2408 && float32_isNaN( trueZ )
2409 && float32_isNaN( testZ )
2410 && ! float32_is_signaling_nan( testZ )
2411 && ( trueFlags == testFlags )
2417 writeErrorFound( 10000 - count );
2418 writeInput_a_float128();
2419 fputs( " ", stdout );
2420 writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags );
2422 if ( errorCount == maxErrorCount ) goto exit;
2427 writeTestsPerformed( 10000 - count );
2432 test_a_float128_z_float64(
2433 float64 trueFunction( float128 ), float64 testFunction( float128 ) )
2436 float64 trueZ, testZ;
2437 uint8 trueFlags, testFlags;
2440 tenthousandsCount = 0;
2442 testCases_initSequence( testCases_sequence_a_float128 );
2444 while ( ! testCases_done || forever ) {
2447 trueZ = trueFunction( testCases_a_float128 );
2448 trueFlags = *trueFlagsPtr;
2449 (void) testFlagsFunctionPtr();
2450 testZ = testFunction( testCases_a_float128 );
2451 testFlags = testFlagsFunctionPtr();
2457 if ( ! float64_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2459 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2460 trueFlags |= float_flag_invalid;
2463 && float64_isNaN( trueZ )
2464 && float64_isNaN( testZ )
2465 && ! float64_is_signaling_nan( testZ )
2466 && ( trueFlags == testFlags )
2472 writeErrorFound( 10000 - count );
2473 writeInput_a_float128();
2474 fputs( "\n\t", stdout );
2475 writeOutputs_z_float64( trueZ, trueFlags, testZ, testFlags );
2477 if ( errorCount == maxErrorCount ) goto exit;
2482 writeTestsPerformed( 10000 - count );
2489 test_a_float128_z_floatx80(
2490 floatx80 trueFunction( float128 ), floatx80 testFunction( float128 ) )
2493 floatx80 trueZ, testZ;
2494 uint8 trueFlags, testFlags;
2497 tenthousandsCount = 0;
2499 testCases_initSequence( testCases_sequence_a_float128 );
2501 while ( ! testCases_done || forever ) {
2504 trueZ = trueFunction( testCases_a_float128 );
2505 trueFlags = *trueFlagsPtr;
2506 (void) testFlagsFunctionPtr();
2507 testZ = testFunction( testCases_a_float128 );
2508 testFlags = testFlagsFunctionPtr();
2514 if ( ! floatx80_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2516 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2517 trueFlags |= float_flag_invalid;
2520 && floatx80_isNaN( trueZ )
2521 && floatx80_isNaN( testZ )
2522 && ! floatx80_is_signaling_nan( testZ )
2523 && ( trueFlags == testFlags )
2529 writeErrorFound( 10000 - count );
2530 writeInput_a_float128();
2531 fputs( "\n\t", stdout );
2532 writeOutputs_z_floatx80( trueZ, trueFlags, testZ, testFlags );
2534 if ( errorCount == maxErrorCount ) goto exit;
2539 writeTestsPerformed( 10000 - count );
2547 float128 trueFunction( float128 ), float128 testFunction( float128 ) )
2550 float128 trueZ, testZ;
2551 uint8 trueFlags, testFlags;
2554 tenthousandsCount = 0;
2556 testCases_initSequence( testCases_sequence_a_float128 );
2558 while ( ! testCases_done || forever ) {
2561 trueZ = trueFunction( testCases_a_float128 );
2562 trueFlags = *trueFlagsPtr;
2563 (void) testFlagsFunctionPtr();
2564 testZ = testFunction( testCases_a_float128 );
2565 testFlags = testFlagsFunctionPtr();
2571 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2573 && float128_is_signaling_nan( testCases_a_float128 ) ) {
2574 trueFlags |= float_flag_invalid;
2577 && float128_isNaN( trueZ )
2578 && float128_isNaN( testZ )
2579 && ! float128_is_signaling_nan( testZ )
2580 && ( trueFlags == testFlags )
2586 writeErrorFound( 10000 - count );
2587 writeInput_a_float128();
2588 fputs( "\n\t", stdout );
2589 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2591 if ( errorCount == maxErrorCount ) goto exit;
2596 writeTestsPerformed( 10000 - count );
2601 test_ab_float128_z_flag(
2602 flag trueFunction( float128, float128 ),
2603 flag testFunction( float128, float128 )
2608 uint8 trueFlags, testFlags;
2611 tenthousandsCount = 0;
2613 testCases_initSequence( testCases_sequence_ab_float128 );
2615 while ( ! testCases_done || forever ) {
2618 trueZ = trueFunction( testCases_a_float128, testCases_b_float128 );
2619 trueFlags = *trueFlagsPtr;
2620 (void) testFlagsFunctionPtr();
2621 testZ = testFunction( testCases_a_float128, testCases_b_float128 );
2622 testFlags = testFlagsFunctionPtr();
2628 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2630 && ( float128_is_signaling_nan( testCases_a_float128 )
2631 || float128_is_signaling_nan( testCases_b_float128 ) )
2633 trueFlags |= float_flag_invalid;
2635 if ( ( trueZ != testZ ) || ( trueFlags != testFlags ) ) {
2637 writeErrorFound( 10000 - count );
2638 writeInputs_ab_float128();
2639 fputs( "\n\t", stdout );
2640 writeOutputs_z_flag( trueZ, trueFlags, testZ, testFlags );
2642 if ( errorCount == maxErrorCount ) goto exit;
2647 writeTestsPerformed( 10000 - count );
2654 float128 trueFunction( float128, float128 ),
2655 float128 testFunction( float128, float128 )
2659 float128 trueZ, testZ;
2660 uint8 trueFlags, testFlags;
2663 tenthousandsCount = 0;
2665 testCases_initSequence( testCases_sequence_ab_float128 );
2667 while ( ! testCases_done || forever ) {
2670 trueZ = trueFunction( testCases_a_float128, testCases_b_float128 );
2671 trueFlags = *trueFlagsPtr;
2672 (void) testFlagsFunctionPtr();
2673 testZ = testFunction( testCases_a_float128, testCases_b_float128 );
2674 testFlags = testFlagsFunctionPtr();
2680 if ( ! float128_same( trueZ, testZ ) || ( trueFlags != testFlags ) ) {
2682 && ( float128_is_signaling_nan( testCases_a_float128 )
2683 || float128_is_signaling_nan( testCases_b_float128 ) )
2685 trueFlags |= float_flag_invalid;
2688 && float128_isNaN( trueZ )
2689 && float128_isNaN( testZ )
2690 && ! float128_is_signaling_nan( testZ )
2691 && ( trueFlags == testFlags )
2697 writeErrorFound( 10000 - count );
2698 writeInputs_ab_float128();
2699 fputs( "\n\t", stdout );
2700 writeOutputs_z_float128( trueZ, trueFlags, testZ, testFlags );
2702 if ( errorCount == maxErrorCount ) goto exit;
2707 writeTestsPerformed( 10000 - count );