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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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
)));
99 /* `float' variant of HUGE_VAL. */
102 # define HUGE_VALF HUGE_VALf
104 # define HUGE_VALF HUGE_VAL
108 /* `long double' variant of HUGE_VAL. */
111 # define HUGE_VALL HUGE_VALl
113 # define HUGE_VALL HUGE_VAL
117 /* Make sure that at least HUGE_VAL is defined. */
120 # define HUGE_VAL HUGE
123 # define HUGE_VAL MAXFLOAT
125 # error "We need HUGE_VAL!"
131 # define M_PI 3.14159265358979323846
139 /* signbit is a macro in ISO C99. */
141 extern int __signbitf (float);
142 extern int __signbit (double);
143 extern int __signbitl (long double);
145 # define signbit(x) \
146 (sizeof (x) == sizeof (float) ? \
148 : sizeof (x) == sizeof (double) ? \
149 __signbit (x) : __signbitl (x))
152 #if BYTE_ORDER == BIG_ENDIAN
161 } ieee_double_shape_type
;
163 #if BYTE_ORDER == LITTLE_ENDIAN
172 } ieee_double_shape_type
;
174 /* Get the more significant 32 bit int from a double. */
175 #define GET_HIGH_WORD(i,d) \
177 ieee_double_shape_type gh_u; \
179 (i) = gh_u.parts.msw; \
187 } ieee_float_shape_type
;
188 /* Get a 32 bit int from a float. */
189 #define GET_FLOAT_WORD(i,d) \
191 ieee_float_shape_type gf_u; \
197 #if BYTE_ORDER == BIG_ENDIAN
203 unsigned int sign_exponent
:16;
204 unsigned int empty
:16;
208 } ieee_long_double_shape_type
;
210 #if BYTE_ORDER == LITTLE_ENDIAN
218 unsigned int sign_exponent
:16;
219 unsigned int empty
:16;
221 } ieee_long_double_shape_type
;
223 /* Get int from the exponent of a long double. */
224 #define GET_LDOUBLE_EXP(exp,d) \
226 ieee_long_double_shape_type ge_u; \
228 (exp) = ge_u.parts.sign_exponent; \
231 #if BYTE_ORDER == BIG_ENDIAN
242 U_int32_t w0
, w1
, w2
, w3
;
244 } ieee_quad_double_shape_type
;
246 #if BYTE_ORDER == LITTLE_ENDIAN
257 U_int32_t w3
, w2
, w1
, w0
;
259 } ieee_quad_double_shape_type
;
261 /* Get most significant 64 bit int from a quad long double. */
262 #define GET_LDOUBLE_MSW64(msw,d) \
264 ieee_quad_double_shape_type qw_u; \
266 (msw) = qw_u.parts64.msw; \
270 /* Replacement for non-existing float functions. */
271 #if !defined(HAVE_FABSF) && !defined(HAVE___BUILTIN_FABSF)
272 # define fabsf(x) fabs (x)
274 #if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF)
275 # define cosf(x) cos (x)
278 # define coshf(x) cosh (x)
281 # define expf(x) expf (x)
284 # define logf(x) log(x)
287 # define log10f(x) log10 (x)
290 # define powf(x, y) pow (x, y)
292 #if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF)
293 # define sinf(x) sin (x)
296 # define sinhf(x) sinh (x)
298 #if !defined(HAVE_SQRTF) && !defined(HAVE___BUILTIN_SQRTF)
299 # define sqrtf(x) sqrt (x)
302 # define tanf(x) tan (x)
305 # define tanhf(x) tanh (x)
308 # define strtof(s, e) strtod (s, e)