1 /* $NetBSD: testLoops.c,v 1.4 2002/02/21 07:38:16 itojun Exp $ */
3 /* This is a derivative work. */
6 * Copyright (c) 2001 The NetBSD Foundation, Inc.
9 * This code is derived from software contributed to The NetBSD Foundation
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
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.
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
35 ===============================================================================
37 This C source file is part of TestFloat, Release 2a, a package of programs
38 for testing the correctness of floating-point arithmetic complying to the
39 IEC/IEEE Standard for Floating-Point.
41 Written by John R. Hauser. More information is available through the Web
42 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
44 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
45 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
46 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
47 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
48 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
50 Derivative works are acceptable, even for commercial purposes, so long as
51 (1) they include prominent notice that the work is derivative, and (2) they
52 include prominent notice akin to these four paragraphs for those parts of
53 this code that are retained.
55 ===============================================================================
61 #include "softfloat.h"
62 #include "testCases.h"
64 #include "testLoops.h"
66 volatile flag stop
= FALSE
;
68 const char *trueName
, *testName
;
69 flag forever
, errorStop
;
70 uint32 maxErrorCount
= 0;
71 flag checkNaNs
= FALSE
;
73 int8 ( *testFlagsFunctionPtr
)( void );
74 const char *functionName
;
75 const char *roundingPrecisionName
, *roundingModeName
, *tininessModeName
;
76 flag anyErrors
= FALSE
;
78 void writeFunctionName( FILE *stream
)
81 fputs( functionName
, stream
);
82 if ( roundingModeName
) {
83 if ( roundingPrecisionName
) {
84 fputs( ", precision ", stream
);
85 fputs( roundingPrecisionName
, stream
);
87 fputs( ", rounding ", stream
);
88 fputs( roundingModeName
, stream
);
89 if ( tininessModeName
) {
90 fputs( ", tininess ", stream
);
91 fputs( tininessModeName
, stream
);
92 fputs( " rounding", stream
);
98 void exitWithStatus( void )
101 exit( anyErrors
? EXIT_FAILURE
: EXIT_SUCCESS
);
105 static uint32 tenthousandsCount
, errorCount
= 0;
107 static void writeTestsTotal( void )
111 fputs( "Unbounded tests.\n", stderr
);
114 fprintf( stderr
, "%d tests total.\n", testCases_total
);
119 static void writeTestsPerformed( int16 count
)
122 if ( tenthousandsCount
) {
124 stderr
, "%d%04d tests performed", tenthousandsCount
, count
);
127 fprintf( stderr
, "%d tests performed", count
);
132 "; %d error%s found.\n",
134 ( errorCount
== 1 ) ? "" : "s"
138 fputs( ".\n", stderr
);
139 fputs( "No errors found in ", stdout
);
140 writeFunctionName( stdout
);
141 fputs( ".\n", stdout
);
147 static void checkEarlyExit( void )
152 writeTestsPerformed( 0 );
155 fprintf( stderr
, "%3d0000", tenthousandsCount
);
159 static void writeErrorFound( int16 count
)
162 if ( errorCount
== 1 ) {
163 fputs( "Errors found in ", stdout
);
164 writeFunctionName( stdout
);
165 fputs( ":\n", stdout
);
168 writeTestsPerformed( count
);
175 INLINE
void writeInput_a_int32( void )
178 writeHex_bits32( testCases_a_int32
, stdout
);
184 INLINE
void writeInput_a_int64( void )
187 writeHex_bits64( testCases_a_int64
, stdout
);
193 INLINE
void writeInput_a_float32( void )
196 writeHex_float32( testCases_a_float32
, stdout
);
200 static void writeInputs_ab_float32( void )
203 writeHex_float32( testCases_a_float32
, stdout
);
204 fputs( " ", stdout
);
205 writeHex_float32( testCases_b_float32
, stdout
);
209 INLINE
void writeInput_a_float64( void )
212 writeHex_float64( testCases_a_float64
, stdout
);
216 static void writeInputs_ab_float64( void )
219 writeHex_float64( testCases_a_float64
, stdout
);
220 fputs( " ", stdout
);
221 writeHex_float64( testCases_b_float64
, stdout
);
227 INLINE
void writeInput_a_floatx80( void )
230 writeHex_floatx80( testCases_a_floatx80
, stdout
);
234 static void writeInputs_ab_floatx80( void )
237 writeHex_floatx80( testCases_a_floatx80
, stdout
);
238 fputs( " ", stdout
);
239 writeHex_floatx80( testCases_b_floatx80
, stdout
);
247 INLINE
void writeInput_a_float128( void )
250 writeHex_float128( testCases_a_float128
, stdout
);
254 static void writeInputs_ab_float128( void )
257 writeHex_float128( testCases_a_float128
, stdout
);
258 fputs( " ", stdout
);
259 writeHex_float128( testCases_b_float128
, stdout
);
267 flag trueZ
, uint8 trueFlags
, flag testZ
, uint8 testFlags
)
270 fputs( trueName
, stdout
);
271 fputs( ": ", stdout
);
272 writeHex_flag( trueZ
, stdout
);
273 fputc( ' ', stdout
);
274 writeHex_float_flags( trueFlags
, stdout
);
275 fputs( " ", stdout
);
276 fputs( testName
, stdout
);
277 fputs( ": ", stdout
);
278 writeHex_flag( testZ
, stdout
);
279 fputc( ' ', stdout
);
280 writeHex_float_flags( testFlags
, stdout
);
281 fputc( '\n', stdout
);
286 writeOutputs_z_int32(
287 int32 trueZ
, uint8 trueFlags
, int32 testZ
, uint8 testFlags
)
290 fputs( trueName
, stdout
);
291 fputs( ": ", stdout
);
292 writeHex_bits32( trueZ
, stdout
);
293 fputc( ' ', stdout
);
294 writeHex_float_flags( trueFlags
, stdout
);
295 fputs( " ", stdout
);
296 fputs( testName
, stdout
);
297 fputs( ": ", stdout
);
298 writeHex_bits32( testZ
, stdout
);
299 fputc( ' ', stdout
);
300 writeHex_float_flags( testFlags
, stdout
);
301 fputc( '\n', stdout
);
308 writeOutputs_z_int64(
309 int64 trueZ
, uint8 trueFlags
, int64 testZ
, uint8 testFlags
)
312 fputs( trueName
, stdout
);
313 fputs( ": ", stdout
);
314 writeHex_bits64( trueZ
, stdout
);
315 fputc( ' ', stdout
);
316 writeHex_float_flags( trueFlags
, stdout
);
317 fputs( " ", stdout
);
318 fputs( testName
, stdout
);
319 fputs( ": ", stdout
);
320 writeHex_bits64( testZ
, stdout
);
321 fputc( ' ', stdout
);
322 writeHex_float_flags( testFlags
, stdout
);
323 fputc( '\n', stdout
);
330 writeOutputs_z_float32(
331 float32 trueZ
, uint8 trueFlags
, float32 testZ
, uint8 testFlags
)
334 fputs( trueName
, stdout
);
335 fputs( ": ", stdout
);
336 writeHex_float32( trueZ
, stdout
);
337 fputc( ' ', stdout
);
338 writeHex_float_flags( trueFlags
, stdout
);
339 fputs( " ", stdout
);
340 fputs( testName
, stdout
);
341 fputs( ": ", stdout
);
342 writeHex_float32( testZ
, stdout
);
343 fputc( ' ', stdout
);
344 writeHex_float_flags( testFlags
, stdout
);
345 fputc( '\n', stdout
);
350 writeOutputs_z_float64(
351 float64 trueZ
, uint8 trueFlags
, float64 testZ
, uint8 testFlags
)
354 fputs( trueName
, stdout
);
355 fputs( ": ", stdout
);
356 writeHex_float64( trueZ
, stdout
);
357 fputc( ' ', stdout
);
358 writeHex_float_flags( trueFlags
, stdout
);
359 fputs( " ", stdout
);
360 fputs( testName
, stdout
);
361 fputs( ": ", stdout
);
362 writeHex_float64( testZ
, stdout
);
363 fputc( ' ', stdout
);
364 writeHex_float_flags( testFlags
, stdout
);
365 fputc( '\n', stdout
);
372 writeOutputs_z_floatx80(
373 floatx80 trueZ
, uint8 trueFlags
, floatx80 testZ
, uint8 testFlags
)
376 fputs( trueName
, stdout
);
377 fputs( ": ", stdout
);
378 writeHex_floatx80( trueZ
, stdout
);
379 fputc( ' ', stdout
);
380 writeHex_float_flags( trueFlags
, stdout
);
381 fputs( " ", stdout
);
382 fputs( testName
, stdout
);
383 fputs( ": ", stdout
);
384 writeHex_floatx80( testZ
, stdout
);
385 fputc( ' ', stdout
);
386 writeHex_float_flags( testFlags
, stdout
);
387 fputc( '\n', stdout
);
396 writeOutputs_z_float128(
397 float128 trueZ
, uint8 trueFlags
, float128 testZ
, uint8 testFlags
)
400 fputs( trueName
, stdout
);
401 fputs( ": ", stdout
);
402 writeHex_float128( trueZ
, stdout
);
403 fputc( ' ', stdout
);
404 writeHex_float_flags( trueFlags
, stdout
);
405 fputs( "\n\t", stdout
);
406 fputs( testName
, stdout
);
407 fputs( ": ", stdout
);
408 writeHex_float128( testZ
, stdout
);
409 fputc( ' ', stdout
);
410 writeHex_float_flags( testFlags
, stdout
);
411 fputc( '\n', stdout
);
417 INLINE flag
float32_isNaN( float32 a
)
420 return 0x7F800000 < ( a
& 0x7FFFFFFF );
426 INLINE flag
float64_same( float64 a
, float64 b
)
433 INLINE flag
float64_isNaN( float64 a
)
436 return LIT64( 0x7FF0000000000000 ) < ( a
& LIT64( 0x7FFFFFFFFFFFFFFF ) );
442 INLINE flag
float64_same( float64 a
, float64 b
)
445 return ( a
.high
== b
.high
) && ( a
.low
== b
.low
);
449 INLINE flag
float64_isNaN( float64 a
)
453 absAHigh
= a
.high
& 0x7FFFFFFF;
455 ( 0x7FF00000 < absAHigh
) || ( ( absAHigh
== 0x7FF00000 ) && a
.low
);
463 INLINE flag
floatx80_same( floatx80 a
, floatx80 b
)
466 return ( a
.high
== b
.high
) && ( a
.low
== b
.low
);
470 INLINE flag
floatx80_isNaN( floatx80 a
)
473 return ( ( a
.high
& 0x7FFF ) == 0x7FFF ) && a
.low
;
481 INLINE flag
float128_same( float128 a
, float128 b
)
484 return ( a
.high
== b
.high
) && ( a
.low
== b
.low
);
488 INLINE flag
float128_isNaN( float128 a
)
492 absAHigh
= a
.high
& LIT64( 0x7FFFFFFFFFFFFFFF );
494 ( LIT64( 0x7FFF000000000000 ) < absAHigh
)
495 || ( ( absAHigh
== LIT64( 0x7FFF000000000000 ) ) && a
.low
);
502 test_a_int32_z_float32(
503 float32
trueFunction( int32
), float32
testFunction( int32
) )
506 float32 trueZ
, testZ
;
507 uint8 trueFlags
, testFlags
;
510 tenthousandsCount
= 0;
512 testCases_initSequence( testCases_sequence_a_int32
);
514 while ( ! testCases_done
|| forever
) {
517 trueZ
= trueFunction( testCases_a_int32
);
518 trueFlags
= *trueFlagsPtr
;
519 (void) testFlagsFunctionPtr();
520 testZ
= testFunction( testCases_a_int32
);
521 testFlags
= testFlagsFunctionPtr();
527 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
529 && float32_isNaN( trueZ
)
530 && float32_isNaN( testZ
)
531 && ! float32_is_signaling_nan( testZ
)
532 && ( trueFlags
== testFlags
)
538 writeErrorFound( 10000 - count
);
539 writeInput_a_int32();
540 fputs( " ", stdout
);
541 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
543 if ( errorCount
== maxErrorCount
) goto exit
;
548 writeTestsPerformed( 10000 - count
);
553 test_a_int32_z_float64(
554 float64
trueFunction( int32
), float64
testFunction( int32
) )
557 float64 trueZ
, testZ
;
558 uint8 trueFlags
, testFlags
;
561 tenthousandsCount
= 0;
563 testCases_initSequence( testCases_sequence_a_int32
);
565 while ( ! testCases_done
|| forever
) {
568 trueZ
= trueFunction( testCases_a_int32
);
569 trueFlags
= *trueFlagsPtr
;
570 (void) testFlagsFunctionPtr();
571 testZ
= testFunction( testCases_a_int32
);
572 testFlags
= testFlagsFunctionPtr();
578 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
580 && float64_isNaN( trueZ
)
581 && float64_isNaN( testZ
)
582 && ! float64_is_signaling_nan( testZ
)
583 && ( trueFlags
== testFlags
)
589 writeErrorFound( 10000 - count
);
590 writeInput_a_int32();
591 fputs( " ", stdout
);
592 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
594 if ( errorCount
== maxErrorCount
) goto exit
;
599 writeTestsPerformed( 10000 - count
);
606 test_a_int32_z_floatx80(
607 floatx80
trueFunction( int32
), floatx80
testFunction( int32
) )
610 floatx80 trueZ
, testZ
;
611 uint8 trueFlags
, testFlags
;
614 tenthousandsCount
= 0;
616 testCases_initSequence( testCases_sequence_a_int32
);
618 while ( ! testCases_done
|| forever
) {
621 trueZ
= trueFunction( testCases_a_int32
);
622 trueFlags
= *trueFlagsPtr
;
623 (void) testFlagsFunctionPtr();
624 testZ
= testFunction( testCases_a_int32
);
625 testFlags
= testFlagsFunctionPtr();
631 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
633 && floatx80_isNaN( trueZ
)
634 && floatx80_isNaN( testZ
)
635 && ! floatx80_is_signaling_nan( testZ
)
636 && ( trueFlags
== testFlags
)
642 writeErrorFound( 10000 - count
);
643 writeInput_a_int32();
644 fputs( " ", stdout
);
645 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
647 if ( errorCount
== maxErrorCount
) goto exit
;
652 writeTestsPerformed( 10000 - count
);
661 test_a_int32_z_float128(
662 float128
trueFunction( int32
), float128
testFunction( int32
) )
665 float128 trueZ
, testZ
;
666 uint8 trueFlags
, testFlags
;
669 tenthousandsCount
= 0;
671 testCases_initSequence( testCases_sequence_a_int32
);
673 while ( ! testCases_done
|| forever
) {
676 trueZ
= trueFunction( testCases_a_int32
);
677 trueFlags
= *trueFlagsPtr
;
678 (void) testFlagsFunctionPtr();
679 testZ
= testFunction( testCases_a_int32
);
680 testFlags
= testFlagsFunctionPtr();
686 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
688 && float128_isNaN( trueZ
)
689 && float128_isNaN( testZ
)
690 && ! float128_is_signaling_nan( testZ
)
691 && ( trueFlags
== testFlags
)
697 writeErrorFound( 10000 - count
);
698 writeInput_a_int32();
699 fputs( "\n\t", stdout
);
700 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
702 if ( errorCount
== maxErrorCount
) goto exit
;
707 writeTestsPerformed( 10000 - count
);
716 test_a_int64_z_float32(
717 float32
trueFunction( int64
), float32
testFunction( int64
) )
720 float32 trueZ
, testZ
;
721 uint8 trueFlags
, testFlags
;
724 tenthousandsCount
= 0;
726 testCases_initSequence( testCases_sequence_a_int64
);
728 while ( ! testCases_done
|| forever
) {
731 trueZ
= trueFunction( testCases_a_int64
);
732 trueFlags
= *trueFlagsPtr
;
733 (void) testFlagsFunctionPtr();
734 testZ
= testFunction( testCases_a_int64
);
735 testFlags
= testFlagsFunctionPtr();
741 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
743 && float32_isNaN( trueZ
)
744 && float32_isNaN( testZ
)
745 && ! float32_is_signaling_nan( testZ
)
746 && ( trueFlags
== testFlags
)
752 writeErrorFound( 10000 - count
);
753 writeInput_a_int64();
754 fputs( " ", stdout
);
755 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
757 if ( errorCount
== maxErrorCount
) goto exit
;
762 writeTestsPerformed( 10000 - count
);
767 test_a_int64_z_float64(
768 float64
trueFunction( int64
), float64
testFunction( int64
) )
771 float64 trueZ
, testZ
;
772 uint8 trueFlags
, testFlags
;
775 tenthousandsCount
= 0;
777 testCases_initSequence( testCases_sequence_a_int64
);
779 while ( ! testCases_done
|| forever
) {
782 trueZ
= trueFunction( testCases_a_int64
);
783 trueFlags
= *trueFlagsPtr
;
784 (void) testFlagsFunctionPtr();
785 testZ
= testFunction( testCases_a_int64
);
786 testFlags
= testFlagsFunctionPtr();
792 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
794 && float64_isNaN( trueZ
)
795 && float64_isNaN( testZ
)
796 && ! float64_is_signaling_nan( testZ
)
797 && ( trueFlags
== testFlags
)
803 writeErrorFound( 10000 - count
);
804 writeInput_a_int64();
805 fputs( " ", stdout
);
806 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
808 if ( errorCount
== maxErrorCount
) goto exit
;
813 writeTestsPerformed( 10000 - count
);
820 test_a_int64_z_floatx80(
821 floatx80
trueFunction( int64
), floatx80
testFunction( int64
) )
824 floatx80 trueZ
, testZ
;
825 uint8 trueFlags
, testFlags
;
828 tenthousandsCount
= 0;
830 testCases_initSequence( testCases_sequence_a_int64
);
832 while ( ! testCases_done
|| forever
) {
835 trueZ
= trueFunction( testCases_a_int64
);
836 trueFlags
= *trueFlagsPtr
;
837 (void) testFlagsFunctionPtr();
838 testZ
= testFunction( testCases_a_int64
);
839 testFlags
= testFlagsFunctionPtr();
845 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
847 && floatx80_isNaN( trueZ
)
848 && floatx80_isNaN( testZ
)
849 && ! floatx80_is_signaling_nan( testZ
)
850 && ( trueFlags
== testFlags
)
856 writeErrorFound( 10000 - count
);
857 writeInput_a_int64();
858 fputs( " ", stdout
);
859 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
861 if ( errorCount
== maxErrorCount
) goto exit
;
866 writeTestsPerformed( 10000 - count
);
875 test_a_int64_z_float128(
876 float128
trueFunction( int64
), float128
testFunction( int64
) )
879 float128 trueZ
, testZ
;
880 uint8 trueFlags
, testFlags
;
883 tenthousandsCount
= 0;
885 testCases_initSequence( testCases_sequence_a_int64
);
887 while ( ! testCases_done
|| forever
) {
890 trueZ
= trueFunction( testCases_a_int64
);
891 trueFlags
= *trueFlagsPtr
;
892 (void) testFlagsFunctionPtr();
893 testZ
= testFunction( testCases_a_int64
);
894 testFlags
= testFlagsFunctionPtr();
900 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
902 && float128_isNaN( trueZ
)
903 && float128_isNaN( testZ
)
904 && ! float128_is_signaling_nan( testZ
)
905 && ( trueFlags
== testFlags
)
911 writeErrorFound( 10000 - count
);
912 writeInput_a_int64();
913 fputs( "\n\t", stdout
);
914 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
916 if ( errorCount
== maxErrorCount
) goto exit
;
921 writeTestsPerformed( 10000 - count
);
930 test_a_float32_z_int32(
931 int32
trueFunction( float32
), int32
testFunction( float32
) )
935 uint8 trueFlags
, testFlags
;
938 tenthousandsCount
= 0;
940 testCases_initSequence( testCases_sequence_a_float32
);
942 while ( ! testCases_done
|| forever
) {
945 trueZ
= trueFunction( testCases_a_float32
);
946 trueFlags
= *trueFlagsPtr
;
947 (void) testFlagsFunctionPtr();
948 testZ
= testFunction( testCases_a_float32
);
949 testFlags
= testFlagsFunctionPtr();
955 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
957 && float32_is_signaling_nan( testCases_a_float32
) ) {
958 trueFlags
|= float_flag_invalid
;
960 if ( ( trueZ
== 0x7FFFFFFF )
961 && ( ( testZ
== 0x7FFFFFFF )
962 || ( testZ
== (sbits32
) 0x80000000 ) )
963 && ( trueFlags
== float_flag_invalid
)
964 && ( testFlags
== float_flag_invalid
)
970 writeErrorFound( 10000 - count
);
971 writeInput_a_float32();
972 fputs( " ", stdout
);
973 writeOutputs_z_int32( trueZ
, trueFlags
, testZ
, testFlags
);
975 if ( errorCount
== maxErrorCount
) goto exit
;
980 writeTestsPerformed( 10000 - count
);
987 test_a_float32_z_int64(
988 int64
trueFunction( float32
), int64
testFunction( float32
) )
992 uint8 trueFlags
, testFlags
;
995 tenthousandsCount
= 0;
997 testCases_initSequence( testCases_sequence_a_float32
);
999 while ( ! testCases_done
|| forever
) {
1002 trueZ
= trueFunction( testCases_a_float32
);
1003 trueFlags
= *trueFlagsPtr
;
1004 (void) testFlagsFunctionPtr();
1005 testZ
= testFunction( testCases_a_float32
);
1006 testFlags
= testFlagsFunctionPtr();
1012 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1014 && float32_is_signaling_nan( testCases_a_float32
) ) {
1015 trueFlags
|= float_flag_invalid
;
1017 if ( ( trueZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1018 && ( ( testZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1019 || ( testZ
== (sbits64
) LIT64( 0x8000000000000000 ) ) )
1020 && ( trueFlags
== float_flag_invalid
)
1021 && ( testFlags
== float_flag_invalid
)
1027 writeErrorFound( 10000 - count
);
1028 writeInput_a_float32();
1029 fputs( " ", stdout
);
1030 writeOutputs_z_int64( trueZ
, trueFlags
, testZ
, testFlags
);
1032 if ( errorCount
== maxErrorCount
) goto exit
;
1037 writeTestsPerformed( 10000 - count
);
1044 test_a_float32_z_float64(
1045 float64
trueFunction( float32
), float64
testFunction( float32
) )
1048 float64 trueZ
, testZ
;
1049 uint8 trueFlags
, testFlags
;
1052 tenthousandsCount
= 0;
1054 testCases_initSequence( testCases_sequence_a_float32
);
1056 while ( ! testCases_done
|| forever
) {
1059 trueZ
= trueFunction( testCases_a_float32
);
1060 trueFlags
= *trueFlagsPtr
;
1061 (void) testFlagsFunctionPtr();
1062 testZ
= testFunction( testCases_a_float32
);
1063 testFlags
= testFlagsFunctionPtr();
1069 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1071 && float32_is_signaling_nan( testCases_a_float32
) ) {
1072 trueFlags
|= float_flag_invalid
;
1075 && float64_isNaN( trueZ
)
1076 && float64_isNaN( testZ
)
1077 && ! float64_is_signaling_nan( testZ
)
1078 && ( trueFlags
== testFlags
)
1084 writeErrorFound( 10000 - count
);
1085 writeInput_a_float32();
1086 fputs( " ", stdout
);
1087 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
1089 if ( errorCount
== maxErrorCount
) goto exit
;
1094 writeTestsPerformed( 10000 - count
);
1101 test_a_float32_z_floatx80(
1102 floatx80
trueFunction( float32
), floatx80
testFunction( float32
) )
1105 floatx80 trueZ
, testZ
;
1106 uint8 trueFlags
, testFlags
;
1109 tenthousandsCount
= 0;
1111 testCases_initSequence( testCases_sequence_a_float32
);
1113 while ( ! testCases_done
|| forever
) {
1116 trueZ
= trueFunction( testCases_a_float32
);
1117 trueFlags
= *trueFlagsPtr
;
1118 (void) testFlagsFunctionPtr();
1119 testZ
= testFunction( testCases_a_float32
);
1120 testFlags
= testFlagsFunctionPtr();
1126 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1128 && float32_is_signaling_nan( testCases_a_float32
) ) {
1129 trueFlags
|= float_flag_invalid
;
1132 && floatx80_isNaN( trueZ
)
1133 && floatx80_isNaN( testZ
)
1134 && ! floatx80_is_signaling_nan( testZ
)
1135 && ( trueFlags
== testFlags
)
1141 writeErrorFound( 10000 - count
);
1142 writeInput_a_float32();
1143 fputs( "\n\t", stdout
);
1144 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
1146 if ( errorCount
== maxErrorCount
) goto exit
;
1151 writeTestsPerformed( 10000 - count
);
1160 test_a_float32_z_float128(
1161 float128
trueFunction( float32
), float128
testFunction( float32
) )
1164 float128 trueZ
, testZ
;
1165 uint8 trueFlags
, testFlags
;
1168 tenthousandsCount
= 0;
1170 testCases_initSequence( testCases_sequence_a_float32
);
1172 while ( ! testCases_done
|| forever
) {
1175 trueZ
= trueFunction( testCases_a_float32
);
1176 trueFlags
= *trueFlagsPtr
;
1177 (void) testFlagsFunctionPtr();
1178 testZ
= testFunction( testCases_a_float32
);
1179 testFlags
= testFlagsFunctionPtr();
1185 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1187 && float32_is_signaling_nan( testCases_a_float32
) ) {
1188 trueFlags
|= float_flag_invalid
;
1191 && float128_isNaN( trueZ
)
1192 && float128_isNaN( testZ
)
1193 && ! float128_is_signaling_nan( testZ
)
1194 && ( trueFlags
== testFlags
)
1200 writeErrorFound( 10000 - count
);
1201 writeInput_a_float32();
1202 fputs( "\n\t", stdout
);
1203 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
1205 if ( errorCount
== maxErrorCount
) goto exit
;
1210 writeTestsPerformed( 10000 - count
);
1218 float32
trueFunction( float32
), float32
testFunction( float32
) )
1221 float32 trueZ
, testZ
;
1222 uint8 trueFlags
, testFlags
;
1225 tenthousandsCount
= 0;
1227 testCases_initSequence( testCases_sequence_a_float32
);
1229 while ( ! testCases_done
|| forever
) {
1232 trueZ
= trueFunction( testCases_a_float32
);
1233 trueFlags
= *trueFlagsPtr
;
1234 (void) testFlagsFunctionPtr();
1235 testZ
= testFunction( testCases_a_float32
);
1236 testFlags
= testFlagsFunctionPtr();
1242 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1244 && float32_is_signaling_nan( testCases_a_float32
) ) {
1245 trueFlags
|= float_flag_invalid
;
1248 && float32_isNaN( trueZ
)
1249 && float32_isNaN( testZ
)
1250 && ! float32_is_signaling_nan( testZ
)
1251 && ( trueFlags
== testFlags
)
1257 writeErrorFound( 10000 - count
);
1258 writeInput_a_float32();
1259 fputs( " ", stdout
);
1260 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
1262 if ( errorCount
== maxErrorCount
) goto exit
;
1267 writeTestsPerformed( 10000 - count
);
1272 test_ab_float32_z_flag(
1273 flag
trueFunction( float32
, float32
),
1274 flag
testFunction( float32
, float32
)
1279 uint8 trueFlags
, testFlags
;
1282 tenthousandsCount
= 0;
1284 testCases_initSequence( testCases_sequence_ab_float32
);
1286 while ( ! testCases_done
|| forever
) {
1289 trueZ
= trueFunction( testCases_a_float32
, testCases_b_float32
);
1290 trueFlags
= *trueFlagsPtr
;
1291 (void) testFlagsFunctionPtr();
1292 testZ
= testFunction( testCases_a_float32
, testCases_b_float32
);
1293 testFlags
= testFlagsFunctionPtr();
1299 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1301 && ( float32_is_signaling_nan( testCases_a_float32
)
1302 || float32_is_signaling_nan( testCases_b_float32
) )
1304 trueFlags
|= float_flag_invalid
;
1306 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1308 writeErrorFound( 10000 - count
);
1309 writeInputs_ab_float32();
1310 fputs( " ", stdout
);
1311 writeOutputs_z_flag( trueZ
, trueFlags
, testZ
, testFlags
);
1313 if ( errorCount
== maxErrorCount
) goto exit
;
1318 writeTestsPerformed( 10000 - count
);
1325 float32
trueFunction( float32
, float32
),
1326 float32
testFunction( float32
, float32
)
1330 float32 trueZ
, testZ
;
1331 uint8 trueFlags
, testFlags
;
1334 tenthousandsCount
= 0;
1336 testCases_initSequence( testCases_sequence_ab_float32
);
1338 while ( ! testCases_done
|| forever
) {
1341 trueZ
= trueFunction( testCases_a_float32
, testCases_b_float32
);
1342 trueFlags
= *trueFlagsPtr
;
1343 (void) testFlagsFunctionPtr();
1344 testZ
= testFunction( testCases_a_float32
, testCases_b_float32
);
1345 testFlags
= testFlagsFunctionPtr();
1351 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1353 && ( float32_is_signaling_nan( testCases_a_float32
)
1354 || float32_is_signaling_nan( testCases_b_float32
) )
1356 trueFlags
|= float_flag_invalid
;
1359 && float32_isNaN( trueZ
)
1360 && float32_isNaN( testZ
)
1361 && ! float32_is_signaling_nan( testZ
)
1362 && ( trueFlags
== testFlags
)
1368 writeErrorFound( 10000 - count
);
1369 writeInputs_ab_float32();
1370 fputs( " ", stdout
);
1371 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
1373 if ( errorCount
== maxErrorCount
) goto exit
;
1378 writeTestsPerformed( 10000 - count
);
1384 test_a_float64_z_int32(
1385 int32
trueFunction( float64
), int32
testFunction( float64
) )
1389 uint8 trueFlags
, testFlags
;
1392 tenthousandsCount
= 0;
1394 testCases_initSequence( testCases_sequence_a_float64
);
1396 while ( ! testCases_done
|| forever
) {
1399 trueZ
= trueFunction( testCases_a_float64
);
1400 trueFlags
= *trueFlagsPtr
;
1401 (void) testFlagsFunctionPtr();
1402 testZ
= testFunction( testCases_a_float64
);
1403 testFlags
= testFlagsFunctionPtr();
1409 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1411 && float64_is_signaling_nan( testCases_a_float64
) ) {
1412 trueFlags
|= float_flag_invalid
;
1414 if ( ( trueZ
== 0x7FFFFFFF )
1415 && ( ( testZ
== 0x7FFFFFFF )
1416 || ( testZ
== (sbits32
) 0x80000000 ) )
1417 && ( trueFlags
== float_flag_invalid
)
1418 && ( testFlags
== float_flag_invalid
)
1424 writeErrorFound( 10000 - count
);
1425 writeInput_a_float64();
1426 fputs( " ", stdout
);
1427 writeOutputs_z_int32( trueZ
, trueFlags
, testZ
, testFlags
);
1429 if ( errorCount
== maxErrorCount
) goto exit
;
1434 writeTestsPerformed( 10000 - count
);
1441 test_a_float64_z_int64(
1442 int64
trueFunction( float64
), int64
testFunction( float64
) )
1446 uint8 trueFlags
, testFlags
;
1449 tenthousandsCount
= 0;
1451 testCases_initSequence( testCases_sequence_a_float64
);
1453 while ( ! testCases_done
|| forever
) {
1456 trueZ
= trueFunction( testCases_a_float64
);
1457 trueFlags
= *trueFlagsPtr
;
1458 (void) testFlagsFunctionPtr();
1459 testZ
= testFunction( testCases_a_float64
);
1460 testFlags
= testFlagsFunctionPtr();
1466 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1468 && float64_is_signaling_nan( testCases_a_float64
) ) {
1469 trueFlags
|= float_flag_invalid
;
1471 if ( ( trueZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1472 && ( ( testZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1473 || ( testZ
== (sbits64
) LIT64( 0x8000000000000000 ) ) )
1474 && ( trueFlags
== float_flag_invalid
)
1475 && ( testFlags
== float_flag_invalid
)
1481 writeErrorFound( 10000 - count
);
1482 writeInput_a_float64();
1483 fputs( " ", stdout
);
1484 writeOutputs_z_int64( trueZ
, trueFlags
, testZ
, testFlags
);
1486 if ( errorCount
== maxErrorCount
) goto exit
;
1491 writeTestsPerformed( 10000 - count
);
1498 test_a_float64_z_float32(
1499 float32
trueFunction( float64
), float32
testFunction( float64
) )
1502 float32 trueZ
, testZ
;
1503 uint8 trueFlags
, testFlags
;
1506 tenthousandsCount
= 0;
1508 testCases_initSequence( testCases_sequence_a_float64
);
1510 while ( ! testCases_done
|| forever
) {
1513 trueZ
= trueFunction( testCases_a_float64
);
1514 trueFlags
= *trueFlagsPtr
;
1515 (void) testFlagsFunctionPtr();
1516 testZ
= testFunction( testCases_a_float64
);
1517 testFlags
= testFlagsFunctionPtr();
1523 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1525 && float64_is_signaling_nan( testCases_a_float64
) ) {
1526 trueFlags
|= float_flag_invalid
;
1529 && float32_isNaN( trueZ
)
1530 && float32_isNaN( testZ
)
1531 && ! float32_is_signaling_nan( testZ
)
1532 && ( trueFlags
== testFlags
)
1538 writeErrorFound( 10000 - count
);
1539 writeInput_a_float64();
1540 fputs( " ", stdout
);
1541 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
1543 if ( errorCount
== maxErrorCount
) goto exit
;
1548 writeTestsPerformed( 10000 - count
);
1555 test_a_float64_z_floatx80(
1556 floatx80
trueFunction( float64
), floatx80
testFunction( float64
) )
1559 floatx80 trueZ
, testZ
;
1560 uint8 trueFlags
, testFlags
;
1563 tenthousandsCount
= 0;
1565 testCases_initSequence( testCases_sequence_a_float64
);
1567 while ( ! testCases_done
|| forever
) {
1570 trueZ
= trueFunction( testCases_a_float64
);
1571 trueFlags
= *trueFlagsPtr
;
1572 (void) testFlagsFunctionPtr();
1573 testZ
= testFunction( testCases_a_float64
);
1574 testFlags
= testFlagsFunctionPtr();
1580 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1582 && float64_is_signaling_nan( testCases_a_float64
) ) {
1583 trueFlags
|= float_flag_invalid
;
1586 && floatx80_isNaN( trueZ
)
1587 && floatx80_isNaN( testZ
)
1588 && ! floatx80_is_signaling_nan( testZ
)
1589 && ( trueFlags
== testFlags
)
1595 writeErrorFound( 10000 - count
);
1596 writeInput_a_float64();
1597 fputs( "\n\t", stdout
);
1598 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
1600 if ( errorCount
== maxErrorCount
) goto exit
;
1605 writeTestsPerformed( 10000 - count
);
1614 test_a_float64_z_float128(
1615 float128
trueFunction( float64
), float128
testFunction( float64
) )
1618 float128 trueZ
, testZ
;
1619 uint8 trueFlags
, testFlags
;
1622 tenthousandsCount
= 0;
1624 testCases_initSequence( testCases_sequence_a_float64
);
1626 while ( ! testCases_done
|| forever
) {
1629 trueZ
= trueFunction( testCases_a_float64
);
1630 trueFlags
= *trueFlagsPtr
;
1631 (void) testFlagsFunctionPtr();
1632 testZ
= testFunction( testCases_a_float64
);
1633 testFlags
= testFlagsFunctionPtr();
1639 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1641 && float64_is_signaling_nan( testCases_a_float64
) ) {
1642 trueFlags
|= float_flag_invalid
;
1645 && float128_isNaN( trueZ
)
1646 && float128_isNaN( testZ
)
1647 && ! float128_is_signaling_nan( testZ
)
1648 && ( trueFlags
== testFlags
)
1654 writeErrorFound( 10000 - count
);
1655 writeInput_a_float64();
1656 fputs( "\n\t", stdout
);
1657 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
1659 if ( errorCount
== maxErrorCount
) goto exit
;
1664 writeTestsPerformed( 10000 - count
);
1672 float64
trueFunction( float64
), float64
testFunction( float64
) )
1675 float64 trueZ
, testZ
;
1676 uint8 trueFlags
, testFlags
;
1679 tenthousandsCount
= 0;
1681 testCases_initSequence( testCases_sequence_a_float64
);
1683 while ( ! testCases_done
|| forever
) {
1686 trueZ
= trueFunction( testCases_a_float64
);
1687 trueFlags
= *trueFlagsPtr
;
1688 (void) testFlagsFunctionPtr();
1689 testZ
= testFunction( testCases_a_float64
);
1690 testFlags
= testFlagsFunctionPtr();
1696 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1698 && float64_is_signaling_nan( testCases_a_float64
) ) {
1699 trueFlags
|= float_flag_invalid
;
1702 && float64_isNaN( trueZ
)
1703 && float64_isNaN( testZ
)
1704 && ! float64_is_signaling_nan( testZ
)
1705 && ( trueFlags
== testFlags
)
1711 writeErrorFound( 10000 - count
);
1712 writeInput_a_float64();
1713 fputs( " ", stdout
);
1714 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
1716 if ( errorCount
== maxErrorCount
) goto exit
;
1721 writeTestsPerformed( 10000 - count
);
1726 test_ab_float64_z_flag(
1727 flag
trueFunction( float64
, float64
),
1728 flag
testFunction( float64
, float64
)
1733 uint8 trueFlags
, testFlags
;
1736 tenthousandsCount
= 0;
1738 testCases_initSequence( testCases_sequence_ab_float64
);
1740 while ( ! testCases_done
|| forever
) {
1743 trueZ
= trueFunction( testCases_a_float64
, testCases_b_float64
);
1744 trueFlags
= *trueFlagsPtr
;
1745 (void) testFlagsFunctionPtr();
1746 testZ
= testFunction( testCases_a_float64
, testCases_b_float64
);
1747 testFlags
= testFlagsFunctionPtr();
1753 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1755 && ( float64_is_signaling_nan( testCases_a_float64
)
1756 || float64_is_signaling_nan( testCases_b_float64
) )
1758 trueFlags
|= float_flag_invalid
;
1760 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1762 writeErrorFound( 10000 - count
);
1763 writeInputs_ab_float64();
1764 fputs( " ", stdout
);
1765 writeOutputs_z_flag( trueZ
, trueFlags
, testZ
, testFlags
);
1767 if ( errorCount
== maxErrorCount
) goto exit
;
1772 writeTestsPerformed( 10000 - count
);
1779 float64
trueFunction( float64
, float64
),
1780 float64
testFunction( float64
, float64
)
1784 float64 trueZ
, testZ
;
1785 uint8 trueFlags
, testFlags
;
1788 tenthousandsCount
= 0;
1790 testCases_initSequence( testCases_sequence_ab_float64
);
1792 while ( ! testCases_done
|| forever
) {
1795 trueZ
= trueFunction( testCases_a_float64
, testCases_b_float64
);
1796 trueFlags
= *trueFlagsPtr
;
1797 (void) testFlagsFunctionPtr();
1798 testZ
= testFunction( testCases_a_float64
, testCases_b_float64
);
1799 testFlags
= testFlagsFunctionPtr();
1805 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
1807 && ( float64_is_signaling_nan( testCases_a_float64
)
1808 || float64_is_signaling_nan( testCases_b_float64
) )
1810 trueFlags
|= float_flag_invalid
;
1813 && float64_isNaN( trueZ
)
1814 && float64_isNaN( testZ
)
1815 && ! float64_is_signaling_nan( testZ
)
1816 && ( trueFlags
== testFlags
)
1822 writeErrorFound( 10000 - count
);
1823 writeInputs_ab_float64();
1824 fputs( "\n\t", stdout
);
1825 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
1827 if ( errorCount
== maxErrorCount
) goto exit
;
1832 writeTestsPerformed( 10000 - count
);
1840 test_a_floatx80_z_int32(
1841 int32
trueFunction( floatx80
), int32
testFunction( floatx80
) )
1845 uint8 trueFlags
, testFlags
;
1848 tenthousandsCount
= 0;
1850 testCases_initSequence( testCases_sequence_a_floatx80
);
1852 while ( ! testCases_done
|| forever
) {
1855 trueZ
= trueFunction( testCases_a_floatx80
);
1856 trueFlags
= *trueFlagsPtr
;
1857 (void) testFlagsFunctionPtr();
1858 testZ
= testFunction( testCases_a_floatx80
);
1859 testFlags
= testFlagsFunctionPtr();
1865 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1867 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
1868 trueFlags
|= float_flag_invalid
;
1870 if ( ( trueZ
== 0x7FFFFFFF )
1871 && ( ( testZ
== 0x7FFFFFFF )
1872 || ( testZ
== (sbits32
) 0x80000000 ) )
1873 && ( trueFlags
== float_flag_invalid
)
1874 && ( testFlags
== float_flag_invalid
)
1880 writeErrorFound( 10000 - count
);
1881 writeInput_a_floatx80();
1882 fputs( " ", stdout
);
1883 writeOutputs_z_int32( trueZ
, trueFlags
, testZ
, testFlags
);
1885 if ( errorCount
== maxErrorCount
) goto exit
;
1890 writeTestsPerformed( 10000 - count
);
1897 test_a_floatx80_z_int64(
1898 int64
trueFunction( floatx80
), int64
testFunction( floatx80
) )
1902 uint8 trueFlags
, testFlags
;
1905 tenthousandsCount
= 0;
1907 testCases_initSequence( testCases_sequence_a_floatx80
);
1909 while ( ! testCases_done
|| forever
) {
1912 trueZ
= trueFunction( testCases_a_floatx80
);
1913 trueFlags
= *trueFlagsPtr
;
1914 (void) testFlagsFunctionPtr();
1915 testZ
= testFunction( testCases_a_floatx80
);
1916 testFlags
= testFlagsFunctionPtr();
1922 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1924 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
1925 trueFlags
|= float_flag_invalid
;
1927 if ( ( trueZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1928 && ( ( testZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
1929 || ( testZ
== (sbits64
) LIT64( 0x8000000000000000 ) ) )
1930 && ( trueFlags
== float_flag_invalid
)
1931 && ( testFlags
== float_flag_invalid
)
1937 writeErrorFound( 10000 - count
);
1938 writeInput_a_floatx80();
1939 fputs( " ", stdout
);
1940 writeOutputs_z_int64( trueZ
, trueFlags
, testZ
, testFlags
);
1942 if ( errorCount
== maxErrorCount
) goto exit
;
1947 writeTestsPerformed( 10000 - count
);
1954 test_a_floatx80_z_float32(
1955 float32
trueFunction( floatx80
), float32
testFunction( floatx80
) )
1958 float32 trueZ
, testZ
;
1959 uint8 trueFlags
, testFlags
;
1962 tenthousandsCount
= 0;
1964 testCases_initSequence( testCases_sequence_a_floatx80
);
1966 while ( ! testCases_done
|| forever
) {
1969 trueZ
= trueFunction( testCases_a_floatx80
);
1970 trueFlags
= *trueFlagsPtr
;
1971 (void) testFlagsFunctionPtr();
1972 testZ
= testFunction( testCases_a_floatx80
);
1973 testFlags
= testFlagsFunctionPtr();
1979 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
1981 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
1982 trueFlags
|= float_flag_invalid
;
1985 && float32_isNaN( trueZ
)
1986 && float32_isNaN( testZ
)
1987 && ! float32_is_signaling_nan( testZ
)
1988 && ( trueFlags
== testFlags
)
1994 writeErrorFound( 10000 - count
);
1995 writeInput_a_floatx80();
1996 fputs( " ", stdout
);
1997 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
1999 if ( errorCount
== maxErrorCount
) goto exit
;
2004 writeTestsPerformed( 10000 - count
);
2009 test_a_floatx80_z_float64(
2010 float64
trueFunction( floatx80
), float64
testFunction( floatx80
) )
2013 float64 trueZ
, testZ
;
2014 uint8 trueFlags
, testFlags
;
2017 tenthousandsCount
= 0;
2019 testCases_initSequence( testCases_sequence_a_floatx80
);
2021 while ( ! testCases_done
|| forever
) {
2024 trueZ
= trueFunction( testCases_a_floatx80
);
2025 trueFlags
= *trueFlagsPtr
;
2026 (void) testFlagsFunctionPtr();
2027 testZ
= testFunction( testCases_a_floatx80
);
2028 testFlags
= testFlagsFunctionPtr();
2034 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2036 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
2037 trueFlags
|= float_flag_invalid
;
2040 && float64_isNaN( trueZ
)
2041 && float64_isNaN( testZ
)
2042 && ! float64_is_signaling_nan( testZ
)
2043 && ( trueFlags
== testFlags
)
2049 writeErrorFound( 10000 - count
);
2050 writeInput_a_floatx80();
2051 fputs( "\n\t", stdout
);
2052 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
2054 if ( errorCount
== maxErrorCount
) goto exit
;
2059 writeTestsPerformed( 10000 - count
);
2066 test_a_floatx80_z_float128(
2067 float128
trueFunction( floatx80
), float128
testFunction( floatx80
) )
2070 float128 trueZ
, testZ
;
2071 uint8 trueFlags
, testFlags
;
2074 tenthousandsCount
= 0;
2076 testCases_initSequence( testCases_sequence_a_floatx80
);
2078 while ( ! testCases_done
|| forever
) {
2081 trueZ
= trueFunction( testCases_a_floatx80
);
2082 trueFlags
= *trueFlagsPtr
;
2083 (void) testFlagsFunctionPtr();
2084 testZ
= testFunction( testCases_a_floatx80
);
2085 testFlags
= testFlagsFunctionPtr();
2091 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2093 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
2094 trueFlags
|= float_flag_invalid
;
2097 && float128_isNaN( trueZ
)
2098 && float128_isNaN( testZ
)
2099 && ! float128_is_signaling_nan( testZ
)
2100 && ( trueFlags
== testFlags
)
2106 writeErrorFound( 10000 - count
);
2107 writeInput_a_floatx80();
2108 fputs( "\n\t", stdout
);
2109 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
2111 if ( errorCount
== maxErrorCount
) goto exit
;
2116 writeTestsPerformed( 10000 - count
);
2124 floatx80
trueFunction( floatx80
), floatx80
testFunction( floatx80
) )
2127 floatx80 trueZ
, testZ
;
2128 uint8 trueFlags
, testFlags
;
2131 tenthousandsCount
= 0;
2133 testCases_initSequence( testCases_sequence_a_floatx80
);
2135 while ( ! testCases_done
|| forever
) {
2138 trueZ
= trueFunction( testCases_a_floatx80
);
2139 trueFlags
= *trueFlagsPtr
;
2140 (void) testFlagsFunctionPtr();
2141 testZ
= testFunction( testCases_a_floatx80
);
2142 testFlags
= testFlagsFunctionPtr();
2148 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2150 && floatx80_is_signaling_nan( testCases_a_floatx80
) ) {
2151 trueFlags
|= float_flag_invalid
;
2154 && floatx80_isNaN( trueZ
)
2155 && floatx80_isNaN( testZ
)
2156 && ! floatx80_is_signaling_nan( testZ
)
2157 && ( trueFlags
== testFlags
)
2163 writeErrorFound( 10000 - count
);
2164 writeInput_a_floatx80();
2165 fputs( "\n\t", stdout
);
2166 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
2168 if ( errorCount
== maxErrorCount
) goto exit
;
2173 writeTestsPerformed( 10000 - count
);
2178 test_ab_floatx80_z_flag(
2179 flag
trueFunction( floatx80
, floatx80
),
2180 flag
testFunction( floatx80
, floatx80
)
2185 uint8 trueFlags
, testFlags
;
2188 tenthousandsCount
= 0;
2190 testCases_initSequence( testCases_sequence_ab_floatx80
);
2192 while ( ! testCases_done
|| forever
) {
2195 trueZ
= trueFunction( testCases_a_floatx80
, testCases_b_floatx80
);
2196 trueFlags
= *trueFlagsPtr
;
2197 (void) testFlagsFunctionPtr();
2198 testZ
= testFunction( testCases_a_floatx80
, testCases_b_floatx80
);
2199 testFlags
= testFlagsFunctionPtr();
2205 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2207 && ( floatx80_is_signaling_nan( testCases_a_floatx80
)
2208 || floatx80_is_signaling_nan( testCases_b_floatx80
) )
2210 trueFlags
|= float_flag_invalid
;
2212 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2214 writeErrorFound( 10000 - count
);
2215 writeInputs_ab_floatx80();
2216 fputs( " ", stdout
);
2217 writeOutputs_z_flag( trueZ
, trueFlags
, testZ
, testFlags
);
2219 if ( errorCount
== maxErrorCount
) goto exit
;
2224 writeTestsPerformed( 10000 - count
);
2231 floatx80
trueFunction( floatx80
, floatx80
),
2232 floatx80
testFunction( floatx80
, floatx80
)
2236 floatx80 trueZ
, testZ
;
2237 uint8 trueFlags
, testFlags
;
2240 tenthousandsCount
= 0;
2242 testCases_initSequence( testCases_sequence_ab_floatx80
);
2244 while ( ! testCases_done
|| forever
) {
2247 trueZ
= trueFunction( testCases_a_floatx80
, testCases_b_floatx80
);
2248 trueFlags
= *trueFlagsPtr
;
2249 (void) testFlagsFunctionPtr();
2250 testZ
= testFunction( testCases_a_floatx80
, testCases_b_floatx80
);
2251 testFlags
= testFlagsFunctionPtr();
2257 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2259 && ( floatx80_is_signaling_nan( testCases_a_floatx80
)
2260 || floatx80_is_signaling_nan( testCases_b_floatx80
) )
2262 trueFlags
|= float_flag_invalid
;
2265 && floatx80_isNaN( trueZ
)
2266 && floatx80_isNaN( testZ
)
2267 && ! floatx80_is_signaling_nan( testZ
)
2268 && ( trueFlags
== testFlags
)
2274 writeErrorFound( 10000 - count
);
2275 writeInputs_ab_floatx80();
2276 fputs( "\n\t", stdout
);
2277 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
2279 if ( errorCount
== maxErrorCount
) goto exit
;
2284 writeTestsPerformed( 10000 - count
);
2294 test_a_float128_z_int32(
2295 int32
trueFunction( float128
), int32
testFunction( float128
) )
2299 uint8 trueFlags
, testFlags
;
2302 tenthousandsCount
= 0;
2304 testCases_initSequence( testCases_sequence_a_float128
);
2306 while ( ! testCases_done
|| forever
) {
2309 trueZ
= trueFunction( testCases_a_float128
);
2310 trueFlags
= *trueFlagsPtr
;
2311 (void) testFlagsFunctionPtr();
2312 testZ
= testFunction( testCases_a_float128
);
2313 testFlags
= testFlagsFunctionPtr();
2319 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2321 && float128_is_signaling_nan( testCases_a_float128
) ) {
2322 trueFlags
|= float_flag_invalid
;
2324 if ( ( trueZ
== 0x7FFFFFFF )
2325 && ( ( testZ
== 0x7FFFFFFF )
2326 || ( testZ
== (sbits32
) 0x80000000 ) )
2327 && ( trueFlags
== float_flag_invalid
)
2328 && ( testFlags
== float_flag_invalid
)
2334 writeErrorFound( 10000 - count
);
2335 writeInput_a_float128();
2336 fputs( " ", stdout
);
2337 writeOutputs_z_int32( trueZ
, trueFlags
, testZ
, testFlags
);
2339 if ( errorCount
== maxErrorCount
) goto exit
;
2344 writeTestsPerformed( 10000 - count
);
2351 test_a_float128_z_int64(
2352 int64
trueFunction( float128
), int64
testFunction( float128
) )
2356 uint8 trueFlags
, testFlags
;
2359 tenthousandsCount
= 0;
2361 testCases_initSequence( testCases_sequence_a_float128
);
2363 while ( ! testCases_done
|| forever
) {
2366 trueZ
= trueFunction( testCases_a_float128
);
2367 trueFlags
= *trueFlagsPtr
;
2368 (void) testFlagsFunctionPtr();
2369 testZ
= testFunction( testCases_a_float128
);
2370 testFlags
= testFlagsFunctionPtr();
2376 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2378 && float128_is_signaling_nan( testCases_a_float128
) ) {
2379 trueFlags
|= float_flag_invalid
;
2381 if ( ( trueZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
2382 && ( ( testZ
== LIT64( 0x7FFFFFFFFFFFFFFF ) )
2383 || ( testZ
== (sbits64
) LIT64( 0x8000000000000000 ) ) )
2384 && ( trueFlags
== float_flag_invalid
)
2385 && ( testFlags
== float_flag_invalid
)
2391 writeErrorFound( 10000 - count
);
2392 writeInput_a_float128();
2393 fputs( "\n\t", stdout
);
2394 writeOutputs_z_int64( trueZ
, trueFlags
, testZ
, testFlags
);
2396 if ( errorCount
== maxErrorCount
) goto exit
;
2401 writeTestsPerformed( 10000 - count
);
2408 test_a_float128_z_float32(
2409 float32
trueFunction( float128
), float32
testFunction( float128
) )
2412 float32 trueZ
, testZ
;
2413 uint8 trueFlags
, testFlags
;
2416 tenthousandsCount
= 0;
2418 testCases_initSequence( testCases_sequence_a_float128
);
2420 while ( ! testCases_done
|| forever
) {
2423 trueZ
= trueFunction( testCases_a_float128
);
2424 trueFlags
= *trueFlagsPtr
;
2425 (void) testFlagsFunctionPtr();
2426 testZ
= testFunction( testCases_a_float128
);
2427 testFlags
= testFlagsFunctionPtr();
2433 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2435 && float128_is_signaling_nan( testCases_a_float128
) ) {
2436 trueFlags
|= float_flag_invalid
;
2439 && float32_isNaN( trueZ
)
2440 && float32_isNaN( testZ
)
2441 && ! float32_is_signaling_nan( testZ
)
2442 && ( trueFlags
== testFlags
)
2448 writeErrorFound( 10000 - count
);
2449 writeInput_a_float128();
2450 fputs( " ", stdout
);
2451 writeOutputs_z_float32( trueZ
, trueFlags
, testZ
, testFlags
);
2453 if ( errorCount
== maxErrorCount
) goto exit
;
2458 writeTestsPerformed( 10000 - count
);
2463 test_a_float128_z_float64(
2464 float64
trueFunction( float128
), float64
testFunction( float128
) )
2467 float64 trueZ
, testZ
;
2468 uint8 trueFlags
, testFlags
;
2471 tenthousandsCount
= 0;
2473 testCases_initSequence( testCases_sequence_a_float128
);
2475 while ( ! testCases_done
|| forever
) {
2478 trueZ
= trueFunction( testCases_a_float128
);
2479 trueFlags
= *trueFlagsPtr
;
2480 (void) testFlagsFunctionPtr();
2481 testZ
= testFunction( testCases_a_float128
);
2482 testFlags
= testFlagsFunctionPtr();
2488 if ( ! float64_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2490 && float128_is_signaling_nan( testCases_a_float128
) ) {
2491 trueFlags
|= float_flag_invalid
;
2494 && float64_isNaN( trueZ
)
2495 && float64_isNaN( testZ
)
2496 && ! float64_is_signaling_nan( testZ
)
2497 && ( trueFlags
== testFlags
)
2503 writeErrorFound( 10000 - count
);
2504 writeInput_a_float128();
2505 fputs( "\n\t", stdout
);
2506 writeOutputs_z_float64( trueZ
, trueFlags
, testZ
, testFlags
);
2508 if ( errorCount
== maxErrorCount
) goto exit
;
2513 writeTestsPerformed( 10000 - count
);
2520 test_a_float128_z_floatx80(
2521 floatx80
trueFunction( float128
), floatx80
testFunction( float128
) )
2524 floatx80 trueZ
, testZ
;
2525 uint8 trueFlags
, testFlags
;
2528 tenthousandsCount
= 0;
2530 testCases_initSequence( testCases_sequence_a_float128
);
2532 while ( ! testCases_done
|| forever
) {
2535 trueZ
= trueFunction( testCases_a_float128
);
2536 trueFlags
= *trueFlagsPtr
;
2537 (void) testFlagsFunctionPtr();
2538 testZ
= testFunction( testCases_a_float128
);
2539 testFlags
= testFlagsFunctionPtr();
2545 if ( ! floatx80_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2547 && float128_is_signaling_nan( testCases_a_float128
) ) {
2548 trueFlags
|= float_flag_invalid
;
2551 && floatx80_isNaN( trueZ
)
2552 && floatx80_isNaN( testZ
)
2553 && ! floatx80_is_signaling_nan( testZ
)
2554 && ( trueFlags
== testFlags
)
2560 writeErrorFound( 10000 - count
);
2561 writeInput_a_float128();
2562 fputs( "\n\t", stdout
);
2563 writeOutputs_z_floatx80( trueZ
, trueFlags
, testZ
, testFlags
);
2565 if ( errorCount
== maxErrorCount
) goto exit
;
2570 writeTestsPerformed( 10000 - count
);
2578 float128
trueFunction( float128
), float128
testFunction( float128
) )
2581 float128 trueZ
, testZ
;
2582 uint8 trueFlags
, testFlags
;
2585 tenthousandsCount
= 0;
2587 testCases_initSequence( testCases_sequence_a_float128
);
2589 while ( ! testCases_done
|| forever
) {
2592 trueZ
= trueFunction( testCases_a_float128
);
2593 trueFlags
= *trueFlagsPtr
;
2594 (void) testFlagsFunctionPtr();
2595 testZ
= testFunction( testCases_a_float128
);
2596 testFlags
= testFlagsFunctionPtr();
2602 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2604 && float128_is_signaling_nan( testCases_a_float128
) ) {
2605 trueFlags
|= float_flag_invalid
;
2608 && float128_isNaN( trueZ
)
2609 && float128_isNaN( testZ
)
2610 && ! float128_is_signaling_nan( testZ
)
2611 && ( trueFlags
== testFlags
)
2617 writeErrorFound( 10000 - count
);
2618 writeInput_a_float128();
2619 fputs( "\n\t", stdout
);
2620 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
2622 if ( errorCount
== maxErrorCount
) goto exit
;
2627 writeTestsPerformed( 10000 - count
);
2632 test_ab_float128_z_flag(
2633 flag
trueFunction( float128
, float128
),
2634 flag
testFunction( float128
, float128
)
2639 uint8 trueFlags
, testFlags
;
2642 tenthousandsCount
= 0;
2644 testCases_initSequence( testCases_sequence_ab_float128
);
2646 while ( ! testCases_done
|| forever
) {
2649 trueZ
= trueFunction( testCases_a_float128
, testCases_b_float128
);
2650 trueFlags
= *trueFlagsPtr
;
2651 (void) testFlagsFunctionPtr();
2652 testZ
= testFunction( testCases_a_float128
, testCases_b_float128
);
2653 testFlags
= testFlagsFunctionPtr();
2659 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2661 && ( float128_is_signaling_nan( testCases_a_float128
)
2662 || float128_is_signaling_nan( testCases_b_float128
) )
2664 trueFlags
|= float_flag_invalid
;
2666 if ( ( trueZ
!= testZ
) || ( trueFlags
!= testFlags
) ) {
2668 writeErrorFound( 10000 - count
);
2669 writeInputs_ab_float128();
2670 fputs( "\n\t", stdout
);
2671 writeOutputs_z_flag( trueZ
, trueFlags
, testZ
, testFlags
);
2673 if ( errorCount
== maxErrorCount
) goto exit
;
2678 writeTestsPerformed( 10000 - count
);
2685 float128
trueFunction( float128
, float128
),
2686 float128
testFunction( float128
, float128
)
2690 float128 trueZ
, testZ
;
2691 uint8 trueFlags
, testFlags
;
2694 tenthousandsCount
= 0;
2696 testCases_initSequence( testCases_sequence_ab_float128
);
2698 while ( ! testCases_done
|| forever
) {
2701 trueZ
= trueFunction( testCases_a_float128
, testCases_b_float128
);
2702 trueFlags
= *trueFlagsPtr
;
2703 (void) testFlagsFunctionPtr();
2704 testZ
= testFunction( testCases_a_float128
, testCases_b_float128
);
2705 testFlags
= testFlagsFunctionPtr();
2711 if ( ! float128_same( trueZ
, testZ
) || ( trueFlags
!= testFlags
) ) {
2713 && ( float128_is_signaling_nan( testCases_a_float128
)
2714 || float128_is_signaling_nan( testCases_b_float128
) )
2716 trueFlags
|= float_flag_invalid
;
2719 && float128_isNaN( trueZ
)
2720 && float128_isNaN( testZ
)
2721 && ! float128_is_signaling_nan( testZ
)
2722 && ( trueFlags
== testFlags
)
2728 writeErrorFound( 10000 - count
);
2729 writeInputs_ab_float128();
2730 fputs( "\n\t", stdout
);
2731 writeOutputs_z_float128( trueZ
, trueFlags
, testZ
, testFlags
);
2733 if ( errorCount
== maxErrorCount
) goto exit
;
2738 writeTestsPerformed( 10000 - count
);