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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [c/] [libm/] [current/] [src/] [mathincl/] [fdlibm.h] - Blame information for rev 810

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

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

powered by: WebSVN 2.1.0

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