1 /* $NetBSD: systfloat.h,v 1.3 2002/02/21 07:38:17 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 header 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 ===============================================================================
59 -------------------------------------------------------------------------------
60 The following macros are defined to indicate that the corresponding
62 -------------------------------------------------------------------------------
64 #define SYST_INT32_TO_FLOAT32
65 #define SYST_INT32_TO_FLOAT64
67 #define SYST_INT64_TO_FLOAT32
68 #define SYST_INT64_TO_FLOAT64
70 #define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
72 #define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
74 #define SYST_FLOAT32_TO_FLOAT64
75 #define SYST_FLOAT32_ADD
76 #define SYST_FLOAT32_SUB
77 #define SYST_FLOAT32_MUL
78 #define SYST_FLOAT32_DIV
79 #define SYST_FLOAT32_EQ
80 #define SYST_FLOAT32_LE
81 #define SYST_FLOAT32_LT
82 #define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
84 #define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
86 #define SYST_FLOAT64_TO_FLOAT32
87 #define SYST_FLOAT64_ADD
88 #define SYST_FLOAT64_SUB
89 #define SYST_FLOAT64_MUL
90 #define SYST_FLOAT64_DIV
91 #define SYST_FLOAT64_SQRT
92 #define SYST_FLOAT64_EQ
93 #define SYST_FLOAT64_LE
94 #define SYST_FLOAT64_LT
95 #if defined( FLOATX80 )
96 #define SYST_INT32_TO_FLOATX80
98 #define SYST_INT64_TO_FLOATX80
100 #define SYST_FLOAT32_TO_FLOATX80
101 #define SYST_FLOAT64_TO_FLOATX80
102 #define SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
104 #define SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
106 #define SYST_FLOATX80_TO_FLOAT32
107 #define SYST_FLOATX80_TO_FLOAT64
108 #define SYST_FLOATX80_ADD
109 #define SYST_FLOATX80_SUB
110 #define SYST_FLOATX80_MUL
111 #define SYST_FLOATX80_DIV
112 #define SYST_FLOATX80_EQ
113 #define SYST_FLOATX80_LE
114 #define SYST_FLOATX80_LT
116 #if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 )
117 #define SYST_INT32_TO_FLOAT128
119 #define SYST_INT64_TO_FLOAT128
121 #define SYST_FLOAT32_TO_FLOAT128
122 #define SYST_FLOAT64_TO_FLOAT128
123 #define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
125 #define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
127 #define SYST_FLOAT128_TO_FLOAT32
128 #define SYST_FLOAT128_TO_FLOAT64
129 #define SYST_FLOAT128_ADD
130 #define SYST_FLOAT128_SUB
131 #define SYST_FLOAT128_MUL
132 #define SYST_FLOAT128_DIV
133 #define SYST_FLOAT128_EQ
134 #define SYST_FLOAT128_LE
135 #define SYST_FLOAT128_LT
139 -------------------------------------------------------------------------------
140 System function declarations. (Some of these functions may not exist.)
141 -------------------------------------------------------------------------------
143 float32
syst_int32_to_float32( int32
);
144 float64
syst_int32_to_float64( int32
);
146 floatx80
syst_int32_to_floatx80( int32
);
149 float128
syst_int32_to_float128( int32
);
152 float32
syst_int64_to_float32( int64
);
153 float64
syst_int64_to_float64( int64
);
155 floatx80
syst_int64_to_floatx80( int64
);
158 float128
syst_int64_to_float128( int64
);
161 int32
syst_float32_to_int32( float32
);
162 int32
syst_float32_to_int32_round_to_zero( float32
);
164 int64
syst_float32_to_int64( float32
);
165 int64
syst_float32_to_int64_round_to_zero( float32
);
167 float64
syst_float32_to_float64( float32
);
169 floatx80
syst_float32_to_floatx80( float32
);
172 float128
syst_float32_to_float128( float32
);
174 float32
syst_float32_round_to_int( float32
);
175 float32
syst_float32_add( float32
, float32
);
176 float32
syst_float32_sub( float32
, float32
);
177 float32
syst_float32_mul( float32
, float32
);
178 float32
syst_float32_div( float32
, float32
);
179 float32
syst_float32_rem( float32
, float32
);
180 float32
syst_float32_sqrt( float32
);
181 flag
syst_float32_eq( float32
, float32
);
182 flag
syst_float32_le( float32
, float32
);
183 flag
syst_float32_lt( float32
, float32
);
184 flag
syst_float32_eq_signaling( float32
, float32
);
185 flag
syst_float32_le_quiet( float32
, float32
);
186 flag
syst_float32_lt_quiet( float32
, float32
);
187 int32
syst_float64_to_int32( float64
);
188 int32
syst_float64_to_int32_round_to_zero( float64
);
190 int64
syst_float64_to_int64( float64
);
191 int64
syst_float64_to_int64_round_to_zero( float64
);
193 float32
syst_float64_to_float32( float64
);
195 floatx80
syst_float64_to_floatx80( float64
);
198 float128
syst_float64_to_float128( float64
);
200 float64
syst_float64_round_to_int( float64
);
201 float64
syst_float64_add( float64
, float64
);
202 float64
syst_float64_sub( float64
, float64
);
203 float64
syst_float64_mul( float64
, float64
);
204 float64
syst_float64_div( float64
, float64
);
205 float64
syst_float64_rem( float64
, float64
);
206 float64
syst_float64_sqrt( float64
);
207 flag
syst_float64_eq( float64
, float64
);
208 flag
syst_float64_le( float64
, float64
);
209 flag
syst_float64_lt( float64
, float64
);
210 flag
syst_float64_eq_signaling( float64
, float64
);
211 flag
syst_float64_le_quiet( float64
, float64
);
212 flag
syst_float64_lt_quiet( float64
, float64
);
214 int32
syst_floatx80_to_int32( floatx80
);
215 int32
syst_floatx80_to_int32_round_to_zero( floatx80
);
217 int64
syst_floatx80_to_int64( floatx80
);
218 int64
syst_floatx80_to_int64_round_to_zero( floatx80
);
220 float32
syst_floatx80_to_float32( floatx80
);
221 float64
syst_floatx80_to_float64( floatx80
);
223 float128
syst_floatx80_to_float128( floatx80
);
225 floatx80
syst_floatx80_round_to_int( floatx80
);
226 floatx80
syst_floatx80_add( floatx80
, floatx80
);
227 floatx80
syst_floatx80_sub( floatx80
, floatx80
);
228 floatx80
syst_floatx80_mul( floatx80
, floatx80
);
229 floatx80
syst_floatx80_div( floatx80
, floatx80
);
230 floatx80
syst_floatx80_rem( floatx80
, floatx80
);
231 floatx80
syst_floatx80_sqrt( floatx80
);
232 flag
syst_floatx80_eq( floatx80
, floatx80
);
233 flag
syst_floatx80_le( floatx80
, floatx80
);
234 flag
syst_floatx80_lt( floatx80
, floatx80
);
235 flag
syst_floatx80_eq_signaling( floatx80
, floatx80
);
236 flag
syst_floatx80_le_quiet( floatx80
, floatx80
);
237 flag
syst_floatx80_lt_quiet( floatx80
, floatx80
);
240 int32
syst_float128_to_int32( float128
);
241 int32
syst_float128_to_int32_round_to_zero( float128
);
243 int64
syst_float128_to_int64( float128
);
244 int64
syst_float128_to_int64_round_to_zero( float128
);
246 float32
syst_float128_to_float32( float128
);
247 float64
syst_float128_to_float64( float128
);
249 floatx80
syst_float128_to_floatx80( float128
);
251 float128
syst_float128_round_to_int( float128
);
252 float128
syst_float128_add( float128
, float128
);
253 float128
syst_float128_sub( float128
, float128
);
254 float128
syst_float128_mul( float128
, float128
);
255 float128
syst_float128_div( float128
, float128
);
256 float128
syst_float128_rem( float128
, float128
);
257 float128
syst_float128_sqrt( float128
);
258 flag
syst_float128_eq( float128
, float128
);
259 flag
syst_float128_le( float128
, float128
);
260 flag
syst_float128_lt( float128
, float128
);
261 flag
syst_float128_eq_signaling( float128
, float128
);
262 flag
syst_float128_le_quiet( float128
, float128
);
263 flag
syst_float128_lt_quiet( float128
, float128
);