| 1 | /* | 
|---|
| 2 |     This file is part of MutekP. | 
|---|
| 3 |  | 
|---|
| 4 |     MutekP is free software; you can redistribute it and/or modify it | 
|---|
| 5 |     under the terms of the GNU General Public License as published by | 
|---|
| 6 |     the Free Software Foundation; either version 2 of the License, or | 
|---|
| 7 |     (at your option) any later version. | 
|---|
| 8 |  | 
|---|
| 9 |     MutekP is distributed in the hope that it will be useful, but | 
|---|
| 10 |     WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 12 |     General Public License for more details. | 
|---|
| 13 |  | 
|---|
| 14 |     You should have received a copy of the GNU General Public License | 
|---|
| 15 |     along with MutekP; if not, write to the Free Software Foundation, | 
|---|
| 16 |     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 
|---|
| 17 |  | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | #ifndef _MATH_H | 
|---|
| 21 | #define _MATH_H | 
|---|
| 22 |  | 
|---|
| 23 | /////////////////////////////////////////// | 
|---|
| 24 | //  Use fdlibm (fdlibm.h 5.1 93/09/24)   // | 
|---|
| 25 | /////////////////////////////////////////// | 
|---|
| 26 | # include "libm/fdlibm.h" | 
|---|
| 27 | ////////////////////////////////////////// | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 | /////////////////////////////////////////// | 
|---|
| 31 | // Use constants from math.h of dietlibc // | 
|---|
| 32 | /////////////////////////////////////////// | 
|---|
| 33 | #define M_E             2.7182818284590452354   /* e */ | 
|---|
| 34 | #define M_LOG2E         1.4426950408889634074   /* log_2 e */ | 
|---|
| 35 | #define M_LOG10E        0.43429448190325182765  /* log_10 e */ | 
|---|
| 36 | #define M_LN2           0.69314718055994530942  /* log_e 2 */ | 
|---|
| 37 | #define M_LN10          2.30258509299404568402  /* log_e 10 */ | 
|---|
| 38 | #define M_PI            3.14159265358979323846  /* pi */ | 
|---|
| 39 | #define M_PI_2          1.57079632679489661923  /* pi/2 */ | 
|---|
| 40 | #define M_PI_4          0.78539816339744830962  /* pi/4 */ | 
|---|
| 41 | #define M_1_PI          0.31830988618379067154  /* 1/pi */ | 
|---|
| 42 | #define M_2_PI          0.63661977236758134308  /* 2/pi */ | 
|---|
| 43 | #define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */ | 
|---|
| 44 | #define M_SQRT2         1.41421356237309504880  /* sqrt(2) */ | 
|---|
| 45 | #define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */ | 
|---|
| 46 |  | 
|---|
| 47 | #define M_El            2.7182818284590452353602874713526625L  /* e */ | 
|---|
| 48 | #define M_LOG2El        1.4426950408889634073599246810018922L  /* log_2 e */ | 
|---|
| 49 | #define M_LOG10El       0.4342944819032518276511289189166051L  /* log_10 e */ | 
|---|
| 50 | #define M_LN2l          0.6931471805599453094172321214581766L  /* log_e 2 */ | 
|---|
| 51 | #define M_LN10l         2.3025850929940456840179914546843642L  /* log_e 10 */ | 
|---|
| 52 | #define M_PIl           3.1415926535897932384626433832795029L  /* pi */ | 
|---|
| 53 | #define M_PI_2l         1.5707963267948966192313216916397514L  /* pi/2 */ | 
|---|
| 54 | #define M_PI_4l         0.7853981633974483096156608458198757L  /* pi/4 */ | 
|---|
| 55 | #define M_1_PIl         0.3183098861837906715377675267450287L  /* 1/pi */ | 
|---|
| 56 | #define M_2_PIl         0.6366197723675813430755350534900574L  /* 2/pi */ | 
|---|
| 57 | #define M_2_SQRTPIl     1.1283791670955125738961589031215452L  /* 2/sqrt(pi) */ | 
|---|
| 58 | #define M_SQRT2l        1.4142135623730950488016887242096981L  /* sqrt(2) */ | 
|---|
| 59 | #define M_SQRT1_2l      0.7071067811865475244008443621048490L  /* 1/sqrt(2) */ | 
|---|
| 60 |  | 
|---|
| 61 | int isinf(double d) __attribute__((__const__)); | 
|---|
| 62 | ////////////////////////////////////////////////////// | 
|---|
| 63 |  | 
|---|
| 64 | //////////////////////////////////////////////// | 
|---|
| 65 | //         Use gcc builtin functions          // | 
|---|
| 66 | // (based on math.h from MutekH Revision 788) // | 
|---|
| 67 | //////////////////////////////////////////////// | 
|---|
| 68 | #define acoshf __builtin_acoshf | 
|---|
| 69 | #define acoshl __builtin_acoshl | 
|---|
| 70 | #define acosh __builtin_acosh | 
|---|
| 71 | #define asinhf __builtin_asinhf | 
|---|
| 72 | #define asinhl __builtin_asinhl | 
|---|
| 73 | #define asinh __builtin_asinh | 
|---|
| 74 | #define atanhf __builtin_atanhf | 
|---|
| 75 | #define atanhl __builtin_atanhl | 
|---|
| 76 | #define atanh __builtin_atanh | 
|---|
| 77 | #define cabsf __builtin_cabsf | 
|---|
| 78 | #define cabsl __builtin_cabsl | 
|---|
| 79 | #define cabs __builtin_cabs | 
|---|
| 80 | #define cacosf __builtin_cacosf | 
|---|
| 81 | #define cacoshf __builtin_cacoshf | 
|---|
| 82 | #define cacoshl __builtin_cacoshl | 
|---|
| 83 | #define cacosh __builtin_cacosh | 
|---|
| 84 | #define cacosl __builtin_cacosl | 
|---|
| 85 | #define cacos __builtin_cacos | 
|---|
| 86 | #define cargf __builtin_cargf | 
|---|
| 87 | #define cargl __builtin_cargl | 
|---|
| 88 | #define carg __builtin_carg | 
|---|
| 89 | #define casinf __builtin_casinf | 
|---|
| 90 | #define casinhf __builtin_casinhf | 
|---|
| 91 | #define casinhl __builtin_casinhl | 
|---|
| 92 | #define casinh __builtin_casinh | 
|---|
| 93 | #define casinl __builtin_casinl | 
|---|
| 94 | #define casin __builtin_casin | 
|---|
| 95 | #define catanf __builtin_catanf | 
|---|
| 96 | #define catanhf __builtin_catanhf | 
|---|
| 97 | #define catanhl __builtin_catanhl | 
|---|
| 98 | #define catanh __builtin_catanh | 
|---|
| 99 | #define catanl __builtin_catanl | 
|---|
| 100 | #define catan __builtin_catan | 
|---|
| 101 | #define cbrtf __builtin_cbrtf | 
|---|
| 102 | #define cbrtl __builtin_cbrtl | 
|---|
| 103 | #define cbrt __builtin_cbrt | 
|---|
| 104 | #define ccosf __builtin_ccosf | 
|---|
| 105 | #define ccoshf __builtin_ccoshf | 
|---|
| 106 | #define ccoshl __builtin_ccoshl | 
|---|
| 107 | #define ccosh __builtin_ccosh | 
|---|
| 108 | #define ccosl __builtin_ccosl | 
|---|
| 109 | #define ccos __builtin_ccos | 
|---|
| 110 | #define cexpf __builtin_cexpf | 
|---|
| 111 | #define cexpl __builtin_cexpl | 
|---|
| 112 | #define cexp __builtin_cexp | 
|---|
| 113 | #define cimagf __builtin_cimagf | 
|---|
| 114 | #define cimagl __builtin_cimagl | 
|---|
| 115 | #define cimag __builtin_cimag | 
|---|
| 116 | #define clogf __builtin_clogf | 
|---|
| 117 | #define clogl __builtin_clogl | 
|---|
| 118 | #define clog __builtin_clog | 
|---|
| 119 | #define conjf __builtin_conjf | 
|---|
| 120 | #define conjl __builtin_conjl | 
|---|
| 121 | #define conj __builtin_conj | 
|---|
| 122 | #define copysignf __builtin_copysignf | 
|---|
| 123 | #define copysignl __builtin_copysignl | 
|---|
| 124 | #define copysign __builtin_copysign | 
|---|
| 125 | #define cpowf __builtin_cpowf | 
|---|
| 126 | #define cpowl __builtin_cpowl | 
|---|
| 127 | #define cpow __builtin_cpow | 
|---|
| 128 | #define cprojf __builtin_cprojf | 
|---|
| 129 | #define cprojl __builtin_cprojl | 
|---|
| 130 | #define cproj __builtin_cproj | 
|---|
| 131 | #define crealf __builtin_crealf | 
|---|
| 132 | #define creall __builtin_creall | 
|---|
| 133 | #define creal __builtin_creal | 
|---|
| 134 | #define csinf __builtin_csinf | 
|---|
| 135 | #define csinhf __builtin_csinhf | 
|---|
| 136 | #define csinhl __builtin_csinhl | 
|---|
| 137 | #define csinh __builtin_csinh | 
|---|
| 138 | #define csinl __builtin_csinl | 
|---|
| 139 | #define csin __builtin_csin | 
|---|
| 140 | #define csqrtf __builtin_csqrtf | 
|---|
| 141 | #define csqrtl __builtin_csqrtl | 
|---|
| 142 | #define csqrt __builtin_csqrt | 
|---|
| 143 | #define ctanf __builtin_ctanf | 
|---|
| 144 | #define ctanhf __builtin_ctanhf | 
|---|
| 145 | #define ctanhl __builtin_ctanhl | 
|---|
| 146 | #define ctanh __builtin_ctanh | 
|---|
| 147 | #define ctanl __builtin_ctanl | 
|---|
| 148 | #define ctan __builtin_ctan | 
|---|
| 149 | #define erfcf __builtin_erfcf | 
|---|
| 150 | #define erfcl __builtin_erfcl | 
|---|
| 151 | #define erfc __builtin_erfc | 
|---|
| 152 | #define erff __builtin_erff | 
|---|
| 153 | #define erfl __builtin_erfl | 
|---|
| 154 | #define erf __builtin_erf | 
|---|
| 155 | #define exp2f __builtin_exp2f | 
|---|
| 156 | #define exp2l __builtin_exp2l | 
|---|
| 157 | #define exp2 __builtin_exp2 | 
|---|
| 158 | #define expm1f __builtin_expm1f | 
|---|
| 159 | #define expm1l __builtin_expm1l | 
|---|
| 160 | #define expm1 __builtin_expm1 | 
|---|
| 161 | #define fdimf __builtin_fdimf | 
|---|
| 162 | #define fdiml __builtin_fdiml | 
|---|
| 163 | #define fdim __builtin_fdim | 
|---|
| 164 | #define fmaf __builtin_fmaf | 
|---|
| 165 | #define fmal __builtin_fmal | 
|---|
| 166 | #define fmaxf __builtin_fmaxf | 
|---|
| 167 | #define fmaxl __builtin_fmaxl | 
|---|
| 168 | #define fmax __builtin_fmax | 
|---|
| 169 | #define fma __builtin_fma | 
|---|
| 170 | #define fminf __builtin_fminf | 
|---|
| 171 | #define fminl __builtin_fminl | 
|---|
| 172 | #define fmin __builtin_fmin | 
|---|
| 173 | #define hypotf __builtin_hypotf | 
|---|
| 174 | #define hypotl __builtin_hypotl | 
|---|
| 175 | #define hypot __builtin_hypot | 
|---|
| 176 | #define ilogbf __builtin_ilogbf | 
|---|
| 177 | #define ilogbl __builtin_ilogbl | 
|---|
| 178 | #define ilogb __builtin_ilogb | 
|---|
| 179 | #define imaxabs __builtin_imaxabs | 
|---|
| 180 | #define isblank __builtin_isblank | 
|---|
| 181 | #define iswblank __builtin_iswblank | 
|---|
| 182 | #define lgammaf __builtin_lgammaf | 
|---|
| 183 | #define lgammal __builtin_lgammal | 
|---|
| 184 | #define lgamma __builtin_lgamma | 
|---|
| 185 | #define llrintf __builtin_llrintf | 
|---|
| 186 | #define llrintl __builtin_llrintl | 
|---|
| 187 | #define llrint __builtin_llrint | 
|---|
| 188 | #define llroundf __builtin_llroundf | 
|---|
| 189 | #define llroundl __builtin_llroundl | 
|---|
| 190 | #define llround __builtin_llround | 
|---|
| 191 | #define log1pf __builtin_log1pf | 
|---|
| 192 | #define log1pl __builtin_log1pl | 
|---|
| 193 | #define log1p __builtin_log1p | 
|---|
| 194 | #define log2f __builtin_log2f | 
|---|
| 195 | #define log2l __builtin_log2l | 
|---|
| 196 | #define log2 __builtin_log2 | 
|---|
| 197 | #define logbf __builtin_logbf | 
|---|
| 198 | #define logbl __builtin_logbl | 
|---|
| 199 | #define logb __builtin_logb | 
|---|
| 200 | #define lrintf __builtin_lrintf | 
|---|
| 201 | #define lrintl __builtin_lrintl | 
|---|
| 202 | #define lrint __builtin_lrint | 
|---|
| 203 | #define lroundf __builtin_lroundf | 
|---|
| 204 | #define lroundl __builtin_lroundl | 
|---|
| 205 | #define lround __builtin_lround | 
|---|
| 206 | #define nearbyintf __builtin_nearbyintf | 
|---|
| 207 | #define nearbyintl __builtin_nearbyintl | 
|---|
| 208 | #define nearbyint __builtin_nearbyint | 
|---|
| 209 | #define nextafterf __builtin_nextafterf | 
|---|
| 210 | #define nextafterl __builtin_nextafterl | 
|---|
| 211 | #define nextafter __builtin_nextafter | 
|---|
| 212 | #define nexttowardf __builtin_nexttowardf | 
|---|
| 213 | #define nexttowardl __builtin_nexttowardl | 
|---|
| 214 | #define nexttoward __builtin_nexttoward | 
|---|
| 215 | #define remainderf __builtin_remainderf | 
|---|
| 216 | #define remainderl __builtin_remainderl | 
|---|
| 217 | #define remainder __builtin_remainder | 
|---|
| 218 | #define remquof __builtin_remquof | 
|---|
| 219 | #define remquol __builtin_remquol | 
|---|
| 220 | #define remquo __builtin_remquo | 
|---|
| 221 | #define rintf __builtin_rintf | 
|---|
| 222 | #define rintl __builtin_rintl | 
|---|
| 223 | #define rint __builtin_rint | 
|---|
| 224 | #define roundf __builtin_roundf | 
|---|
| 225 | #define roundl __builtin_roundl | 
|---|
| 226 | #define round __builtin_round | 
|---|
| 227 | #define scalblnf __builtin_scalblnf | 
|---|
| 228 | #define scalblnl __builtin_scalblnl | 
|---|
| 229 | #define scalbln __builtin_scalbln | 
|---|
| 230 | #define scalbnf __builtin_scalbnf | 
|---|
| 231 | #define scalbnl __builtin_scalbnl | 
|---|
| 232 | #define scalbn __builtin_scalbn | 
|---|
| 233 | #define snprintf __builtin_snprintf | 
|---|
| 234 | #define tgammaf __builtin_tgammaf | 
|---|
| 235 | #define tgammal __builtin_tgammal | 
|---|
| 236 | #define tgamma __builtin_tgamma | 
|---|
| 237 | #define truncf __builtin_truncf | 
|---|
| 238 | #define truncl __builtin_truncl | 
|---|
| 239 | #define trunc __builtin_trunc | 
|---|
| 240 | #define acosf __builtin_acosf | 
|---|
| 241 | #define acosl __builtin_acosl | 
|---|
| 242 | #define asinf __builtin_asinf | 
|---|
| 243 | #define asinl __builtin_asinl | 
|---|
| 244 | #define atan2f __builtin_atan2f | 
|---|
| 245 | #define atan2l __builtin_atan2l | 
|---|
| 246 | #define atanf __builtin_atanf | 
|---|
| 247 | #define atanl __builtin_atanl | 
|---|
| 248 | #define ceilf __builtin_ceilf | 
|---|
| 249 | #define ceill __builtin_ceill | 
|---|
| 250 | #define cosf __builtin_cosf | 
|---|
| 251 | #define coshf __builtin_coshf | 
|---|
| 252 | #define coshl __builtin_coshl | 
|---|
| 253 | #define cosl __builtin_cosl | 
|---|
| 254 | #define expf __builtin_expf | 
|---|
| 255 | #define expl __builtin_expl | 
|---|
| 256 | #define fabsf __builtin_fabsf | 
|---|
| 257 | #define fabsl __builtin_fabsl | 
|---|
| 258 | #define floorf __builtin_floorf | 
|---|
| 259 | #define floorl __builtin_floorl | 
|---|
| 260 | #define fmodf __builtin_fmodf | 
|---|
| 261 | #define fmodl __builtin_fmodl | 
|---|
| 262 | #define frexpf __builtin_frexpf | 
|---|
| 263 | #define frexpl __builtin_frexpl | 
|---|
| 264 | #define ldexpf __builtin_ldexpf | 
|---|
| 265 | #define ldexpl __builtin_ldexpl | 
|---|
| 266 | #define log10f __builtin_log10f | 
|---|
| 267 | #define log10l __builtin_log10l | 
|---|
| 268 | #define logf __builtin_logf | 
|---|
| 269 | #define logl __builtin_logl | 
|---|
| 270 | #define modfl __builtin_modfl | 
|---|
| 271 | #define modf __builtin_modf | 
|---|
| 272 | #define powf __builtin_powf | 
|---|
| 273 | #define powl __builtin_powl | 
|---|
| 274 | #define sinf __builtin_sinf | 
|---|
| 275 | #define sinhf __builtin_sinhf | 
|---|
| 276 | #define sinhl __builtin_sinhl | 
|---|
| 277 | #define sinl __builtin_sinl | 
|---|
| 278 | #define sqrtf __builtin_sqrtf | 
|---|
| 279 | #define sqrtl __builtin_sqrtl | 
|---|
| 280 | #define tanf __builtin_tanf | 
|---|
| 281 | #define tanhf __builtin_tanhf | 
|---|
| 282 | #define tanhl __builtin_tanhl | 
|---|
| 283 | #define tanl __builtin_tanl | 
|---|
| 284 | #define acos __builtin_acos | 
|---|
| 285 | #define asin __builtin_asin | 
|---|
| 286 | #define atan2 __builtin_atan2 | 
|---|
| 287 | #define atan __builtin_atan | 
|---|
| 288 | #define ceil __builtin_ceil | 
|---|
| 289 | #define cosh __builtin_cosh | 
|---|
| 290 | #define cos __builtin_cos | 
|---|
| 291 | #define exp __builtin_exp | 
|---|
| 292 | #define fabs __builtin_fabs | 
|---|
| 293 | #define floor __builtin_floor | 
|---|
| 294 | #define fmod __builtin_fmod | 
|---|
| 295 | #define ldexp __builtin_ldexp | 
|---|
| 296 | #define log10 __builtin_log10 | 
|---|
| 297 | #define log __builtin_log | 
|---|
| 298 | #define modf __builtin_modf | 
|---|
| 299 | #define pow __builtin_pow | 
|---|
| 300 | #define sinh __builtin_sinh | 
|---|
| 301 | #define sin __builtin_sin | 
|---|
| 302 | #define sqrt __builtin_sqrt | 
|---|
| 303 |  | 
|---|
| 304 | #endif  /* _MATH_H */ | 
|---|
| 305 |  | 
|---|