1 |
234 |
jeremybenn |
|
2 |
|
|
/*
|
3 |
|
|
===============================================================================
|
4 |
|
|
|
5 |
|
|
This C header file is part of TestFloat, Release 2a, a package of programs
|
6 |
|
|
for testing the correctness of floating-point arithmetic complying to the
|
7 |
|
|
IEC/IEEE Standard for Floating-Point.
|
8 |
|
|
|
9 |
|
|
Written by John R. Hauser. More information is available through the Web
|
10 |
|
|
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
|
11 |
|
|
|
12 |
|
|
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
|
13 |
|
|
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
|
14 |
|
|
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
|
15 |
|
|
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
|
16 |
|
|
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
17 |
|
|
|
18 |
|
|
Derivative works are acceptable, even for commercial purposes, so long as
|
19 |
|
|
(1) they include prominent notice that the work is derivative, and (2) they
|
20 |
|
|
include prominent notice akin to these four paragraphs for those parts of
|
21 |
|
|
this code that are retained.
|
22 |
|
|
|
23 |
|
|
Modified for use with or1ksim's testsuite.
|
24 |
|
|
|
25 |
|
|
Contributor Julius Baxter <julius.baxter@orsoc.se>
|
26 |
|
|
|
27 |
|
|
===============================================================================
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
//#include <stdio.h>
|
31 |
|
|
|
32 |
|
|
extern volatile flag stop;
|
33 |
|
|
|
34 |
|
|
extern char *trueName, *testName;
|
35 |
|
|
extern flag forever, errorStop;
|
36 |
|
|
extern uint32 maxErrorCount;
|
37 |
|
|
extern flag checkNaNs;
|
38 |
|
|
extern int8 *trueFlagsPtr;
|
39 |
|
|
extern int8 ( *testFlagsFunctionPtr )( void );
|
40 |
|
|
extern char *functionName;
|
41 |
|
|
extern char *roundingPrecisionName, *roundingModeName, *tininessModeName;
|
42 |
|
|
extern flag anyErrors;
|
43 |
|
|
|
44 |
|
|
void writeFunctionName( /*FILE * */ );
|
45 |
|
|
void exitWithStatus( void );
|
46 |
|
|
|
47 |
|
|
void test_a_int32_z_float32( float32 ( int32 ), float32 ( int32 ) );
|
48 |
|
|
void test_a_int32_z_float64( float64 ( int32 ), float64 ( int32 ) );
|
49 |
|
|
#ifdef FLOATX80
|
50 |
|
|
void test_a_int32_z_floatx80( floatx80 ( int32 ), floatx80 ( int32 ) );
|
51 |
|
|
#endif
|
52 |
|
|
#ifdef FLOAT128
|
53 |
|
|
void test_a_int32_z_float128( float128 ( int32 ), float128 ( int32 ) );
|
54 |
|
|
#endif
|
55 |
|
|
#ifdef BITS64
|
56 |
|
|
void test_a_int64_z_float32( float32 ( int64 ), float32 ( int64 ) );
|
57 |
|
|
void test_a_int64_z_float64( float64 ( int64 ), float64 ( int64 ) );
|
58 |
|
|
#ifdef FLOATX80
|
59 |
|
|
void test_a_int64_z_floatx80( floatx80 ( int64 ), floatx80 ( int64 ) );
|
60 |
|
|
#endif
|
61 |
|
|
#ifdef FLOAT128
|
62 |
|
|
void test_a_int64_z_float128( float128 ( int64 ), float128 ( int64 ) );
|
63 |
|
|
#endif
|
64 |
|
|
#endif
|
65 |
|
|
|
66 |
|
|
void test_a_float32_z_int32( int32 ( float32 ), int32 ( float32 ) );
|
67 |
|
|
#ifdef BITS64
|
68 |
|
|
void test_a_float32_z_int64( int64 ( float32 ), int64 ( float32 ) );
|
69 |
|
|
#endif
|
70 |
|
|
void test_a_float32_z_float64( float64 ( float32 ), float64 ( float32 ) );
|
71 |
|
|
#ifdef FLOATX80
|
72 |
|
|
void test_a_float32_z_floatx80( floatx80 ( float32 ), floatx80 ( float32 ) );
|
73 |
|
|
#endif
|
74 |
|
|
#ifdef FLOAT128
|
75 |
|
|
void test_a_float32_z_float128( float128 ( float32 ), float128 ( float32 ) );
|
76 |
|
|
#endif
|
77 |
|
|
void test_az_float32( float32 ( float32 ), float32 ( float32 ) );
|
78 |
|
|
void
|
79 |
|
|
test_ab_float32_z_flag(
|
80 |
|
|
flag ( float32, float32 ), flag ( float32, float32 ) );
|
81 |
|
|
void
|
82 |
|
|
test_abz_float32(
|
83 |
|
|
float32 ( float32, float32 ), float32 ( float32, float32 ) );
|
84 |
|
|
|
85 |
|
|
void test_a_float64_z_int32( int32 ( float64 ), int32 ( float64 ) );
|
86 |
|
|
#ifdef BITS64
|
87 |
|
|
void test_a_float64_z_int64( int64 ( float64 ), int64 ( float64 ) );
|
88 |
|
|
#endif
|
89 |
|
|
void test_a_float64_z_float32( float32 ( float64 ), float32 ( float64 ) );
|
90 |
|
|
#ifdef FLOATX80
|
91 |
|
|
void test_a_float64_z_floatx80( floatx80 ( float64 ), floatx80 ( float64 ) );
|
92 |
|
|
#endif
|
93 |
|
|
#ifdef FLOAT128
|
94 |
|
|
void test_a_float64_z_float128( float128 ( float64 ), float128 ( float64 ) );
|
95 |
|
|
#endif
|
96 |
|
|
void test_az_float64( float64 ( float64 ), float64 ( float64 ) );
|
97 |
|
|
void
|
98 |
|
|
test_ab_float64_z_flag(
|
99 |
|
|
flag ( float64, float64 ), flag ( float64, float64 ) );
|
100 |
|
|
void
|
101 |
|
|
test_abz_float64(
|
102 |
|
|
float64 ( float64, float64 ), float64 ( float64, float64 ) );
|
103 |
|
|
|
104 |
|
|
#ifdef FLOATX80
|
105 |
|
|
|
106 |
|
|
void test_a_floatx80_z_int32( int32 ( floatx80 ), int32 ( floatx80 ) );
|
107 |
|
|
#ifdef BITS64
|
108 |
|
|
void test_a_floatx80_z_int64( int64 ( floatx80 ), int64 ( floatx80 ) );
|
109 |
|
|
#endif
|
110 |
|
|
void test_a_floatx80_z_float32( float32 ( floatx80 ), float32 ( floatx80 ) );
|
111 |
|
|
void test_a_floatx80_z_float64( float64 ( floatx80 ), float64 ( floatx80 ) );
|
112 |
|
|
#ifdef FLOAT128
|
113 |
|
|
void
|
114 |
|
|
test_a_floatx80_z_float128( float128 ( floatx80 ), float128 ( floatx80 ) );
|
115 |
|
|
#endif
|
116 |
|
|
void test_az_floatx80( floatx80 ( floatx80 ), floatx80 ( floatx80 ) );
|
117 |
|
|
void
|
118 |
|
|
test_ab_floatx80_z_flag(
|
119 |
|
|
flag ( floatx80, floatx80 ), flag ( floatx80, floatx80 ) );
|
120 |
|
|
void
|
121 |
|
|
test_abz_floatx80(
|
122 |
|
|
floatx80 ( floatx80, floatx80 ), floatx80 ( floatx80, floatx80 ) );
|
123 |
|
|
|
124 |
|
|
#endif
|
125 |
|
|
|
126 |
|
|
#ifdef FLOAT128
|
127 |
|
|
|
128 |
|
|
void test_a_float128_z_int32( int32 ( float128 ), int32 ( float128 ) );
|
129 |
|
|
#ifdef BITS64
|
130 |
|
|
void test_a_float128_z_int64( int64 ( float128 ), int64 ( float128 ) );
|
131 |
|
|
#endif
|
132 |
|
|
void test_a_float128_z_float32( float32 ( float128 ), float32 ( float128 ) );
|
133 |
|
|
void test_a_float128_z_float64( float64 ( float128 ), float64 ( float128 ) );
|
134 |
|
|
#ifdef FLOATX80
|
135 |
|
|
void
|
136 |
|
|
test_a_float128_z_floatx80( floatx80 ( float128 ), floatx80 ( float128 ) );
|
137 |
|
|
#endif
|
138 |
|
|
void test_az_float128( float128 ( float128 ), float128 ( float128 ) );
|
139 |
|
|
void
|
140 |
|
|
test_ab_float128_z_flag(
|
141 |
|
|
flag ( float128, float128 ), flag ( float128, float128 ) );
|
142 |
|
|
void
|
143 |
|
|
test_abz_float128(
|
144 |
|
|
float128 ( float128, float128 ), float128 ( float128, float128 ) );
|
145 |
|
|
|
146 |
|
|
#endif
|
147 |
|
|
|