OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [language/] [c/] [libm/] [v2_0/] [src/] [mathincl/] [fdlibm.h] - Blame information for rev 565

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_LIBM_MATHINCL_FDLIBM_H
2
#define CYGONCE_LIBM_MATHINCL_FDLIBM_H
3
//===========================================================================
4
//
5
//      fdlibm.h
6
//
7
//      Internal definitions for math library implementation based on fdlibm
8
//
9
//===========================================================================
10
//####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later version.
18
//
19
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
// for more details.
23
//
24
// You should have received a copy of the GNU General Public License along
25
// with eCos; if not, write to the Free Software Foundation, Inc.,
26
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
//
28
// As a special exception, if other files instantiate templates or use macros
29
// or inline functions from this file, or you compile this file and link it
30
// with other works to produce a work based on this file, this file does not
31
// by itself cause the resulting work to be covered by the GNU General Public
32
// License. However the source code for this file must still be made available
33
// in accordance with section (3) of the GNU General Public License.
34
//
35
// This exception does not invalidate any other reasons why a work based on
36
// this file might be covered by the GNU General Public License.
37
//
38
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
// at http://sources.redhat.com/ecos/ecos-license/
40
// -------------------------------------------
41
//####ECOSGPLCOPYRIGHTEND####
42
//===========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):     jlarmour
46
// Contributors:  jlarmour
47
// Date:          1999-02-09
48
// Purpose:     
49
// Description:   Internal implementation-specific header for math library
50
//                based on fdlibm
51
// Usage:         From within this package, #include "mathincl/fdlibm.h"
52
//
53
//####DESCRIPTIONEND####
54
//
55
//===========================================================================
56
 
57
// CONFIGURATION
58
 
59
#include <pkgconf/libm.h>   // Configuration header
60
 
61
// Include the Math library?
62
#ifdef CYGPKG_LIBM     
63
 
64
// INCLUDES
65
 
66
#include <cyg/infra/cyg_type.h>    // Common type definitions and support
67
#include <math.h>                  // Main header for math library
68
#include <float.h>                 // Properties of FP representation on this
69
                                   // platform
70
 
71
// SANITY CHECKS
72
 
73
// Just check that we support IEEE-style 64-bit doubles. If not, this
74
// math library will not work
75
// This check will go away when support for single-precision alternatives are
76
// provided
77
 
78
#if DBL_MAX_EXP != 1024
79
# error IEEE-style 64-bit doubles are required to use the math library
80
#endif // if DBL_MAX_EXP == 1024
81
 
82
 
83
// TYPES
84
 
85
typedef cyg_int32   __int32_t;
86
typedef cyg_uint32  __uint32_t;
87
typedef Cyg_libm_ieee_double_shape_type ieee_double_shape_type;
88
 
89
// MACRO DEFINITIONS
90
 
91
#ifndef __STDC__
92
# define __STDC__ 1
93
#endif
94
#define CYG_LIBM_HI(__x)  (((Cyg_libm_ieee_double_shape_type *)&__x)->parts.msw)
95
#define CYG_LIBM_LO(__x)  (((Cyg_libm_ieee_double_shape_type *)&__x)->parts.lsw)
96
#define CYG_LIBM_HIp(__x) (((Cyg_libm_ieee_double_shape_type *)__x)->parts.msw)
97
#define CYG_LIBM_LOp(__x) (((Cyg_libm_ieee_double_shape_type *)__x)->parts.lsw)
98
 
99
 
100
 
101
/* Get two 32 bit ints from a double.  */
102
 
103
#define EXTRACT_WORDS(ix0,ix1,d)                                \
104
do {                                                            \
105
  Cyg_libm_ieee_double_shape_type ew_u;                         \
106
  ew_u.value = (d);                                             \
107
  (ix0) = ew_u.parts.msw;                                       \
108
  (ix1) = ew_u.parts.lsw;                                       \
109
} while (0)
110
 
111
/* Get the more significant 32 bit int from a double.  */
112
 
113
#define GET_HIGH_WORD(i,d)                                      \
114
do {                                                            \
115
  Cyg_libm_ieee_double_shape_type gh_u;                         \
116
  gh_u.value = (d);                                             \
117
  (i) = gh_u.parts.msw;                                         \
118
} while (0)
119
 
120
/* Get the less significant 32 bit int from a double.  */
121
 
122
#define GET_LOW_WORD(i,d)                                       \
123
do {                                                            \
124
  Cyg_libm_ieee_double_shape_type gl_u;                         \
125
  gl_u.value = (d);                                             \
126
  (i) = gl_u.parts.lsw;                                         \
127
} while (0)
128
 
129
/* Set a double from two 32 bit ints.  */
130
 
131
#define INSERT_WORDS(d,ix0,ix1)                                 \
132
do {                                                            \
133
  Cyg_libm_ieee_double_shape_type iw_u;                         \
134
  iw_u.parts.msw = (ix0);                                       \
135
  iw_u.parts.lsw = (ix1);                                       \
136
  (d) = iw_u.value;                                             \
137
} while (0)
138
 
139
/* Set the more significant 32 bits of a double from an int.  */
140
 
141
#define SET_HIGH_WORD(d,v)                                      \
142
do {                                                            \
143
  Cyg_libm_ieee_double_shape_type sh_u;                         \
144
  sh_u.value = (d);                                             \
145
  sh_u.parts.msw = (v);                                         \
146
  (d) = sh_u.value;                                             \
147
} while (0)
148
 
149
/* Set the less significant 32 bits of a double from an int.  */
150
 
151
#define SET_LOW_WORD(d,v)                                       \
152
do {                                                            \
153
  Cyg_libm_ieee_double_shape_type sl_u;                         \
154
  sl_u.value = (d);                                             \
155
  sl_u.parts.lsw = (v);                                         \
156
  (d) = sl_u.value;                                             \
157
} while (0)
158
 
159
 
160
// REPLACEMENTS FOR STUFF FROM MATH.H DUE TO CONFIG OPTION
161
 
162
#ifdef CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION
163
 
164
#define HUGE            FLT_MAX    // from float.h
165
#define DOMAIN          1
166
#define SING            2
167
#define OVERFLOW        3
168
#define UNDERFLOW       4
169
#define TLOSS           5
170
#define PLOSS           6
171
 
172
struct exception {
173
    int type;       // One of DOMAIN, SING, OVERFLOW, UNDERFLOW, TLOSS, PLOSS
174
    char *name;     // Name of the function generating the exception
175
    double arg1;    // First argument to the function
176
    double arg2;    // Second argument to the function
177
    double retval;  // Value to be returned - can be altered by matherr()
178
};
179
 
180
externC int
181
matherr( struct exception * );    // User-overridable error handling - see
182
                                  // <pkgconf/libm.h> for a discussion
183
#endif // ifdef CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION
184
 
185
 
186
// FUNCTION PROTOTYPES
187
 
188
// IEEE-754 style elementary functions */
189
 
190
externC double
191
__ieee754_sqrt( double );
192
 
193
externC double
194
__ieee754_acos( double );
195
 
196
externC double
197
__ieee754_acosh( double );
198
 
199
externC double
200
__ieee754_log( double );
201
 
202
externC double
203
__ieee754_atanh( double );
204
 
205
externC double
206
__ieee754_asin( double );
207
 
208
externC double
209
__ieee754_atan2( double, double );
210
 
211
externC double
212
__ieee754_exp( double );
213
 
214
externC double
215
__ieee754_cosh( double );
216
 
217
externC double
218
__ieee754_fmod( double, double );
219
 
220
externC double
221
__ieee754_pow( double, double );
222
 
223
externC double
224
__ieee754_lgamma_r( double, int * );
225
 
226
externC double
227
__ieee754_gamma_r( double, int * );
228
 
229
externC double
230
__ieee754_lgamma( double );
231
 
232
externC double
233
__ieee754_gamma( double );
234
 
235
externC double
236
__ieee754_log10( double );
237
 
238
externC double
239
__ieee754_sinh( double );
240
 
241
externC double
242
__ieee754_hypot( double, double );
243
 
244
externC double
245
__ieee754_j0( double );
246
 
247
externC double
248
__ieee754_j1( double );
249
 
250
externC double
251
__ieee754_y0( double );
252
 
253
externC double
254
__ieee754_y1( double );
255
 
256
externC double
257
__ieee754_jn( int, double );
258
 
259
externC double
260
__ieee754_yn( int, double );
261
 
262
externC double
263
__ieee754_remainder( double, double );
264
 
265
externC int
266
__ieee754_rem_pio2( double, double * );
267
 
268
#ifdef CYGFUN_LIBM_SVID3_scalb
269
externC double
270
__ieee754_scalb( double, double );
271
#else
272
externC double
273
__ieee754_scalb( double, int );
274
#endif
275
 
276
// FDLIBM kernel functions
277
 
278
externC double
279
__kernel_standard( double, double, int );
280
 
281
externC double
282
__kernel_sin( double, double, int );
283
 
284
externC double
285
__kernel_cos( double, double );
286
 
287
externC double
288
__kernel_tan( double, double, int );
289
 
290
externC int
291
__kernel_rem_pio2( double *, double *, int, int, int, const int * );
292
 
293
#endif // ifdef CYGPKG_LIBM     
294
 
295
#endif // CYGONCE_LIBM_MATHINCL_FDLIBM_H multiple inclusion protection
296
 
297
// EOF fdlibm.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.