systfloat.h revision 1.1 1
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 ===============================================================================
24 */
25
26 /*
27 -------------------------------------------------------------------------------
28 The following macros are defined to indicate that the corresponding
29 functions exist.
30 -------------------------------------------------------------------------------
31 */
32 #define SYST_INT32_TO_FLOAT32
33 #define SYST_INT32_TO_FLOAT64
34 #ifdef BITS64
35 #define SYST_INT64_TO_FLOAT32
36 #define SYST_INT64_TO_FLOAT64
37 #endif
38 #define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
39 #ifdef BITS64
40 #define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
41 #endif
42 #define SYST_FLOAT32_TO_FLOAT64
43 #define SYST_FLOAT32_ADD
44 #define SYST_FLOAT32_SUB
45 #define SYST_FLOAT32_MUL
46 #define SYST_FLOAT32_DIV
47 #define SYST_FLOAT32_EQ
48 #define SYST_FLOAT32_LE
49 #define SYST_FLOAT32_LT
50 #define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
51 #ifdef BITS64
52 #define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
53 #endif
54 #define SYST_FLOAT64_TO_FLOAT32
55 #define SYST_FLOAT64_ADD
56 #define SYST_FLOAT64_SUB
57 #define SYST_FLOAT64_MUL
58 #define SYST_FLOAT64_DIV
59 #define SYST_FLOAT64_SQRT
60 #define SYST_FLOAT64_EQ
61 #define SYST_FLOAT64_LE
62 #define SYST_FLOAT64_LT
63 #if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 )
64 #define SYST_INT32_TO_FLOATX80
65 #ifdef BITS64
66 #define SYST_INT64_TO_FLOATX80
67 #endif
68 #define SYST_FLOAT32_TO_FLOATX80
69 #define SYST_FLOAT64_TO_FLOATX80
70 #define SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
71 #ifdef BITS64
72 #define SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
73 #endif
74 #define SYST_FLOATX80_TO_FLOAT32
75 #define SYST_FLOATX80_TO_FLOAT64
76 #define SYST_FLOATX80_ADD
77 #define SYST_FLOATX80_SUB
78 #define SYST_FLOATX80_MUL
79 #define SYST_FLOATX80_DIV
80 #define SYST_FLOATX80_EQ
81 #define SYST_FLOATX80_LE
82 #define SYST_FLOATX80_LT
83 #endif
84 #if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 )
85 #define SYST_INT32_TO_FLOAT128
86 #ifdef BITS64
87 #define SYST_INT64_TO_FLOAT128
88 #endif
89 #define SYST_FLOAT32_TO_FLOAT128
90 #define SYST_FLOAT64_TO_FLOAT128
91 #define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
92 #ifdef BITS64
93 #define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
94 #endif
95 #define SYST_FLOAT128_TO_FLOAT32
96 #define SYST_FLOAT128_TO_FLOAT64
97 #define SYST_FLOAT128_ADD
98 #define SYST_FLOAT128_SUB
99 #define SYST_FLOAT128_MUL
100 #define SYST_FLOAT128_DIV
101 #define SYST_FLOAT128_EQ
102 #define SYST_FLOAT128_LE
103 #define SYST_FLOAT128_LT
104 #endif
105
106 /*
107 -------------------------------------------------------------------------------
108 System function declarations. (Some of these functions may not exist.)
109 -------------------------------------------------------------------------------
110 */
111 float32 syst_int32_to_float32( int32 );
112 float64 syst_int32_to_float64( int32 );
113 #ifdef FLOATX80
114 floatx80 syst_int32_to_floatx80( int32 );
115 #endif
116 #ifdef FLOAT128
117 float128 syst_int32_to_float128( int32 );
118 #endif
119 #ifdef BITS64
120 float32 syst_int64_to_float32( int64 );
121 float64 syst_int64_to_float64( int64 );
122 #ifdef FLOATX80
123 floatx80 syst_int64_to_floatx80( int64 );
124 #endif
125 #ifdef FLOAT128
126 float128 syst_int64_to_float128( int64 );
127 #endif
128 #endif
129 int32 syst_float32_to_int32( float32 );
130 int32 syst_float32_to_int32_round_to_zero( float32 );
131 #ifdef BITS64
132 int64 syst_float32_to_int64( float32 );
133 int64 syst_float32_to_int64_round_to_zero( float32 );
134 #endif
135 float64 syst_float32_to_float64( float32 );
136 #ifdef FLOATX80
137 floatx80 syst_float32_to_floatx80( float32 );
138 #endif
139 #ifdef FLOAT128
140 float128 syst_float32_to_float128( float32 );
141 #endif
142 float32 syst_float32_round_to_int( float32 );
143 float32 syst_float32_add( float32, float32 );
144 float32 syst_float32_sub( float32, float32 );
145 float32 syst_float32_mul( float32, float32 );
146 float32 syst_float32_div( float32, float32 );
147 float32 syst_float32_rem( float32, float32 );
148 float32 syst_float32_sqrt( float32 );
149 flag syst_float32_eq( float32, float32 );
150 flag syst_float32_le( float32, float32 );
151 flag syst_float32_lt( float32, float32 );
152 flag syst_float32_eq_signaling( float32, float32 );
153 flag syst_float32_le_quiet( float32, float32 );
154 flag syst_float32_lt_quiet( float32, float32 );
155 int32 syst_float64_to_int32( float64 );
156 int32 syst_float64_to_int32_round_to_zero( float64 );
157 #ifdef BITS64
158 int64 syst_float64_to_int64( float64 );
159 int64 syst_float64_to_int64_round_to_zero( float64 );
160 #endif
161 float32 syst_float64_to_float32( float64 );
162 #ifdef FLOATX80
163 floatx80 syst_float64_to_floatx80( float64 );
164 #endif
165 #ifdef FLOAT128
166 float128 syst_float64_to_float128( float64 );
167 #endif
168 float64 syst_float64_round_to_int( float64 );
169 float64 syst_float64_add( float64, float64 );
170 float64 syst_float64_sub( float64, float64 );
171 float64 syst_float64_mul( float64, float64 );
172 float64 syst_float64_div( float64, float64 );
173 float64 syst_float64_rem( float64, float64 );
174 float64 syst_float64_sqrt( float64 );
175 flag syst_float64_eq( float64, float64 );
176 flag syst_float64_le( float64, float64 );
177 flag syst_float64_lt( float64, float64 );
178 flag syst_float64_eq_signaling( float64, float64 );
179 flag syst_float64_le_quiet( float64, float64 );
180 flag syst_float64_lt_quiet( float64, float64 );
181 #ifdef FLOATX80
182 int32 syst_floatx80_to_int32( floatx80 );
183 int32 syst_floatx80_to_int32_round_to_zero( floatx80 );
184 #ifdef BITS64
185 int64 syst_floatx80_to_int64( floatx80 );
186 int64 syst_floatx80_to_int64_round_to_zero( floatx80 );
187 #endif
188 float32 syst_floatx80_to_float32( floatx80 );
189 float64 syst_floatx80_to_float64( floatx80 );
190 #ifdef FLOAT128
191 float128 syst_floatx80_to_float128( floatx80 );
192 #endif
193 floatx80 syst_floatx80_round_to_int( floatx80 );
194 floatx80 syst_floatx80_add( floatx80, floatx80 );
195 floatx80 syst_floatx80_sub( floatx80, floatx80 );
196 floatx80 syst_floatx80_mul( floatx80, floatx80 );
197 floatx80 syst_floatx80_div( floatx80, floatx80 );
198 floatx80 syst_floatx80_rem( floatx80, floatx80 );
199 floatx80 syst_floatx80_sqrt( floatx80 );
200 flag syst_floatx80_eq( floatx80, floatx80 );
201 flag syst_floatx80_le( floatx80, floatx80 );
202 flag syst_floatx80_lt( floatx80, floatx80 );
203 flag syst_floatx80_eq_signaling( floatx80, floatx80 );
204 flag syst_floatx80_le_quiet( floatx80, floatx80 );
205 flag syst_floatx80_lt_quiet( floatx80, floatx80 );
206 #endif
207 #ifdef FLOAT128
208 int32 syst_float128_to_int32( float128 );
209 int32 syst_float128_to_int32_round_to_zero( float128 );
210 #ifdef BITS64
211 int64 syst_float128_to_int64( float128 );
212 int64 syst_float128_to_int64_round_to_zero( float128 );
213 #endif
214 float32 syst_float128_to_float32( float128 );
215 float64 syst_float128_to_float64( float128 );
216 #ifdef FLOATX80
217 floatx80 syst_float128_to_floatx80( float128 );
218 #endif
219 float128 syst_float128_round_to_int( float128 );
220 float128 syst_float128_add( float128, float128 );
221 float128 syst_float128_sub( float128, float128 );
222 float128 syst_float128_mul( float128, float128 );
223 float128 syst_float128_div( float128, float128 );
224 float128 syst_float128_rem( float128, float128 );
225 float128 syst_float128_sqrt( float128 );
226 flag syst_float128_eq( float128, float128 );
227 flag syst_float128_le( float128, float128 );
228 flag syst_float128_lt( float128, float128 );
229 flag syst_float128_eq_signaling( float128, float128 );
230 flag syst_float128_le_quiet( float128, float128 );
231 flag syst_float128_lt_quiet( float128, float128 );
232 #endif
233
234