Mercurial > ecos-v3_0-branch
annotate packages/language/c/libm/current/src/mathincl/fdlibm.h @ 14:01ce82f3e11a ecos-sw-1999-06-11
Merge from eCos master repository on 1999-06-11-17:05:41-BST
| author | jlarmour |
|---|---|
| date | Fri, 11 Jun 1999 09:36:56 +0000 |
| parents | 443894e2e912 |
| children | c38311975d4f |
| rev | line source |
|---|---|
| 0 | 1 #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 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Cygnus eCos Public License | |
| 14 // Version 1.0 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://sourceware.cygnus.com/ecos | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 24 // September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 2 | 27 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 0 | 28 // ------------------------------------------- |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //=========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 2 | 34 // Author(s): jlarmour |
| 35 // Contributors: jlarmour | |
| 36 // Date: 1999-02-09 | |
| 0 | 37 // Purpose: |
| 2 | 38 // Description: Internal implementation-specific header for math library |
| 39 // based on fdlibm | |
| 40 // Usage: From within this package, #include "mathincl/fdlibm.h" | |
| 0 | 41 // |
| 42 //####DESCRIPTIONEND#### | |
| 43 // | |
| 44 //=========================================================================== | |
| 45 | |
| 46 // CONFIGURATION | |
| 47 | |
| 48 #include <pkgconf/libm.h> // Configuration header | |
| 49 | |
| 50 // Include the Math library? | |
| 51 #ifdef CYGPKG_LIBM | |
| 52 | |
| 53 // INCLUDES | |
| 54 | |
| 55 #include <cyg/infra/cyg_type.h> // Common type definitions and support | |
| 56 #include <math.h> // Main header for math library | |
| 57 #include <float.h> // Properties of FP representation on this | |
| 58 // platform | |
| 59 | |
| 60 // SANITY CHECKS | |
| 61 | |
| 62 // Just check that we support IEEE-style 64-bit doubles. If not, this | |
| 63 // math library will not work | |
| 64 // This check will go away when support for single-precision alternatives are | |
| 65 // provided | |
| 66 | |
| 67 #if DBL_MAX_EXP != 1024 | |
| 68 # error IEEE-style 64-bit doubles are required to use the math library | |
| 69 #endif // if DBL_MAX_EXP == 1024 | |
| 70 | |
| 71 | |
| 72 // MACRO DEFINITIONS | |
| 73 | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
2
diff
changeset
|
74 #define CYG_LIBM_HI(__x) (((Cyg_libm_ieee_double_shape_type *)&__x)->parts.msw) |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
2
diff
changeset
|
75 #define CYG_LIBM_LO(__x) (((Cyg_libm_ieee_double_shape_type *)&__x)->parts.lsw) |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
2
diff
changeset
|
76 #define CYG_LIBM_HIp(__x) (((Cyg_libm_ieee_double_shape_type *)__x)->parts.msw) |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
2
diff
changeset
|
77 #define CYG_LIBM_LOp(__x) (((Cyg_libm_ieee_double_shape_type *)__x)->parts.lsw) |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
2
diff
changeset
|
78 |
| 0 | 79 |
| 80 // REPLACEMENTS FOR STUFF FROM MATH.H DUE TO CONFIG OPTION | |
| 81 | |
| 82 #ifdef CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION | |
| 83 | |
| 84 #define HUGE FLT_MAX // from float.h | |
| 85 #define DOMAIN 1 | |
| 86 #define SING 2 | |
| 87 #define OVERFLOW 3 | |
| 88 #define UNDERFLOW 4 | |
| 89 #define TLOSS 5 | |
| 90 #define PLOSS 6 | |
| 91 | |
| 92 struct exception { | |
| 93 int type; // One of DOMAIN, SING, OVERFLOW, UNDERFLOW, TLOSS, PLOSS | |
| 94 char *name; // Name of the function generating the exception | |
| 95 double arg1; // First argument to the function | |
| 96 double arg2; // Second argument to the function | |
| 97 double retval; // Value to be returned - can be altered by matherr() | |
| 98 }; | |
| 99 | |
| 100 externC int | |
| 101 matherr( struct exception * ); // User-overridable error handling - see | |
| 102 // <pkgconf/libm.h> for a discussion | |
| 103 #endif // ifdef CYGSYM_LIBM_NO_XOPEN_SVID_NAMESPACE_POLLUTION | |
| 104 | |
| 105 | |
| 106 // FUNCTION PROTOTYPES | |
| 107 | |
| 108 // IEEE-754 style elementary functions */ | |
| 109 | |
| 110 externC double | |
| 111 __ieee754_sqrt( double ); | |
| 112 | |
| 113 externC double | |
| 114 __ieee754_acos( double ); | |
| 115 | |
| 116 | |
| 117 externC double | |
| 118 __ieee754_log( double ); | |
| 119 | |
| 120 | |
| 121 externC double | |
| 122 __ieee754_asin( double ); | |
| 123 | |
| 124 externC double | |
| 125 __ieee754_atan2( double, double ); | |
| 126 | |
| 127 externC double | |
| 128 __ieee754_exp( double ); | |
| 129 | |
| 130 externC double | |
| 131 __ieee754_cosh( double ); | |
| 132 | |
| 133 externC double | |
| 134 __ieee754_fmod( double, double ); | |
| 135 | |
| 136 externC double | |
| 137 __ieee754_pow( double, double ); | |
| 138 | |
| 139 | |
| 140 externC double | |
| 141 __ieee754_log10( double ); | |
| 142 | |
| 143 externC double | |
| 144 __ieee754_sinh( double ); | |
| 145 | |
| 146 | |
| 147 externC int | |
| 148 __ieee754_rem_pio2( double, double * ); | |
| 149 | |
| 150 #ifdef CYGFUN_LIBM_SVID3_scalb | |
| 151 externC double | |
| 152 __ieee754_scalb( double, double ); | |
| 153 #else | |
| 154 externC double | |
| 155 __ieee754_scalb( double, int ); | |
| 156 #endif | |
| 157 | |
| 158 // FDLIBM kernel functions | |
| 159 | |
| 160 externC double | |
| 161 __kernel_standard( double, double, int ); | |
| 162 | |
| 163 externC double | |
| 164 __kernel_sin( double, double, int ); | |
| 165 | |
| 166 externC double | |
| 167 __kernel_cos( double, double ); | |
| 168 | |
| 169 externC double | |
| 170 __kernel_tan( double, double, int ); | |
| 171 | |
| 172 externC int | |
| 173 __kernel_rem_pio2( double *, double *, int, int, int, const int * ); | |
| 174 | |
| 175 #endif // ifdef CYGPKG_LIBM | |
| 176 | |
| 177 #endif // CYGONCE_LIBM_MATHINCL_FDLIBM_H multiple inclusion protection | |
| 178 | |
| 179 // EOF fdlibm.h |
