1 /* Configuration data for libmath subpart of libstdc++. */
3 /* Copyright (C) 1997-1999, 2000, 2001 Free Software Foundation, Inc.
5 This file is part of the GNU ISO C++ Library. This library is free
6 software; you can redistribute it and/or modify it under the
7 terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option)
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this library; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 As a special exception, you may use this file as part of a free software
22 library without restriction. Specifically, if other files instantiate
23 templates or use macros or inline functions from this file, or you compile
24 this file and link it with other files to produce an executable, this
25 file does not by itself cause the resulting executable to be covered by
26 the GNU General Public License. This exception does not however
27 invalidate any other reasons why the executable file might be covered by
28 the GNU General Public License. */
36 # ifdef HAVE_MACHINE_ENDIAN_H
37 # ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
40 # include <machine/endian.h>
42 # ifdef HAVE_SYS_MACHINE_H
43 # include <sys/machine.h>
45 # if defined HAVE_SYS_ISA_DEFS_H || defined HAVE_MACHINE_PARAM_H
46 /* This is on Solaris. */
47 # ifdef HAVE_SYS_ISA_DEFS_H
48 # include <sys/isa_defs.h>
50 # ifdef HAVE_MACHINE_PARAM_H
51 # include <machine/param.h>
53 # ifdef _LITTLE_ENDIAN
54 # define LITTLE_ENDIAN 1
61 /* We have to rely on the AC_C_BIGENDIAN test. */
62 # ifdef WORDS_BIGENDIAN
65 # define LITTLE_ENDIAN 1
73 typedef unsigned int U_int32_t
__attribute ((mode (SI
)));
74 typedef int Int32_t
__attribute ((mode (SI
)));
75 typedef unsigned int U_int64_t
__attribute ((mode (DI
)));
76 typedef int Int64_t
__attribute ((mode (DI
)));
94 /* `float' variant of HUGE_VAL. */
97 # define HUGE_VALF HUGE_VALf
99 # define HUGE_VALF HUGE_VAL
103 /* `long double' variant of HUGE_VAL. */
106 # define HUGE_VALL HUGE_VALl
108 # define HUGE_VALL HUGE_VAL
112 /* Make sure that at least HUGE_VAL is defined. */
115 # define HUGE_VAL HUGE
118 # define HUGE_VAL MAXFLOAT
120 # error "We need HUGE_VAL!"
126 # define M_PI 3.14159265358979323846
134 /* signbit is a macro in ISO C99. */
136 extern int __signbitf (float);
137 extern int __signbit (double);
138 extern int __signbitl (long double);
140 # define signbit(x) \
141 (sizeof (x) == sizeof (float) ? \
143 : sizeof (x) == sizeof (double) ? \
144 __signbit (x) : __signbitl (x))
147 #if BYTE_ORDER == BIG_ENDIAN
156 } ieee_double_shape_type
;
158 #if BYTE_ORDER == LITTLE_ENDIAN
167 } ieee_double_shape_type
;
169 /* Get the more significant 32 bit int from a double. */
170 #define GET_HIGH_WORD(i,d) \
172 ieee_double_shape_type gh_u; \
174 (i) = gh_u.parts.msw; \
182 } ieee_float_shape_type
;
183 /* Get a 32 bit int from a float. */
184 #define GET_FLOAT_WORD(i,d) \
186 ieee_float_shape_type gf_u; \
192 #if BYTE_ORDER == BIG_ENDIAN
198 unsigned int sign_exponent
:16;
199 unsigned int empty
:16;
203 } ieee_long_double_shape_type
;
205 #if BYTE_ORDER == LITTLE_ENDIAN
213 unsigned int sign_exponent
:16;
214 unsigned int empty
:16;
216 } ieee_long_double_shape_type
;
218 /* Get int from the exponent of a long double. */
219 #define GET_LDOUBLE_EXP(exp,d) \
221 ieee_long_double_shape_type ge_u; \
223 (exp) = ge_u.parts.sign_exponent; \
226 #if BYTE_ORDER == BIG_ENDIAN
237 U_int32_t w0
, w1
, w2
, w3
;
239 } ieee_quad_double_shape_type
;
241 #if BYTE_ORDER == LITTLE_ENDIAN
252 U_int32_t w3
, w2
, w1
, w0
;
254 } ieee_quad_double_shape_type
;
256 /* Get most significant 64 bit int from a quad long double. */
257 #define GET_LDOUBLE_MSW64(msw,d) \
259 ieee_quad_double_shape_type qw_u; \
261 (msw) = qw_u.parts64.msw; \
265 /* Replacement for non-existing float functions. */
266 #if !defined(HAVE_FABSF) && !defined(HAVE___BUILTIN_FABSF)
267 # define fabsf(x) fabs (x)
269 #if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF)
270 # define cosf(x) cos (x)
273 # define coshf(x) cosh (x)
276 # define expf(x) expf (x)
279 # define logf(x) log(x)
282 # define log10f(x) log10 (x)
285 # define powf(x, y) pow (x, y)
287 #if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF)
288 # define sinf(x) sin (x)
291 # define sinhf(x) sinh (x)
293 #if !defined(HAVE_SQRTF) && !defined(HAVE___BUILTIN_SQRTF)
294 # define sqrtf(x) sqrt (x)
297 # define tanf(x) tan (x)
300 # define tanhf(x) tanh (x)
303 # define strtof(s, e) strtod (s, e)