PSP2SDK
dirty-f9e4f2d
The free SDK for PSP2
|
00001 /* 00002 * Copyright (C) 2015 PSP2SDK Project 00003 * 00004 * This Source Code Form is subject to the terms of the Mozilla Public 00005 * License, v. 2.0. If a copy of the MPL was not distributed with this 00006 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00007 * 00008 * This file is modified for PSP2 by PSP2SDK Team 00009 */ 00010 00011 #ifndef _MATH_H_ 00012 00013 #define _MATH_H_ 00014 00015 #include <machine/ieeefp.h> 00016 #include "_ansi.h" 00017 00018 _BEGIN_STD_C 00019 00020 /* __dmath, __fmath, and __ldmath are only here for backwards compatibility 00021 * in case any code used them. They are no longer used by Newlib, itself, 00022 * other than legacy. */ 00023 union __dmath 00024 { 00025 double d; 00026 unsigned long i[2]; 00027 }; 00028 00029 union __fmath 00030 { 00031 float f; 00032 unsigned long i[1]; 00033 }; 00034 00035 #if defined(_HAVE_LONG_DOUBLE) 00036 union __ldmath 00037 { 00038 long double ld; 00039 unsigned long i[4]; 00040 }; 00041 #endif 00042 00043 /* Natural log of 2 */ 00044 #define _M_LN2 0.693147180559945309417 00045 00046 #if __GNUC_PREREQ (3, 3) 00047 /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */ 00048 00049 # ifndef HUGE_VAL 00050 # define HUGE_VAL (__builtin_huge_val()) 00051 # endif 00052 00053 # ifndef HUGE_VALF 00054 # define HUGE_VALF (__builtin_huge_valf()) 00055 # endif 00056 00057 # ifndef HUGE_VALL 00058 # define HUGE_VALL (__builtin_huge_vall()) 00059 # endif 00060 00061 # ifndef INFINITY 00062 # define INFINITY (__builtin_inff()) 00063 # endif 00064 00065 # ifndef NAN 00066 # define NAN (__builtin_nanf("")) 00067 # endif 00068 00069 #else /* !gcc >= 3.3 */ 00070 00071 /* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY 00072 * and NAN macros are required to be constant expressions. Using a variable-- 00073 * even a static const--does not meet this requirement, as it cannot be 00074 * evaluated at translation time.) 00075 * The infinities are done using numbers that are far in excess of 00076 * something that would be expected to be encountered in a floating-point 00077 * implementation. (A more certain way uses values from float.h, but that is 00078 * avoided because system includes are not supposed to include each other.) 00079 * This method might produce warnings from some compilers. (It does in 00080 * newer GCCs, but not for ones that would hit this #else.) If this happens, 00081 * please report details to the Newlib mailing list. */ 00082 00083 #ifndef HUGE_VAL 00084 #define HUGE_VAL (1.0e999999999) 00085 #endif 00086 00087 #ifndef HUGE_VALF 00088 #define HUGE_VALF (1.0e999999999F) 00089 #endif 00090 00091 #if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE) 00092 #define HUGE_VALL (1.0e999999999L) 00093 #endif 00094 00095 #if !defined(INFINITY) 00096 #define INFINITY (HUGE_VALF) 00097 #endif 00098 00099 #if !defined(NAN) 00100 #if defined(__GNUC__) && defined(__cplusplus) 00101 /* Exception: older g++ versions warn about the divide by 0 used in the 00102 * normal case (even though older gccs do not). This trick suppresses the 00103 * warning, but causes errors for plain gcc, so is only used in the one 00104 * special case. */ 00105 static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000}; 00106 #define NAN (__Nanf.__d) 00107 #else 00108 #define NAN (0.0F/0.0F) 00109 #endif 00110 #endif 00111 00112 #endif /* !gcc >= 3.3 */ 00113 00114 /* Reentrant ANSI C functions. */ 00115 00116 #ifndef __math_68881 00117 extern double atan _PARAMS((double)); 00118 extern double cos _PARAMS((double)); 00119 extern double sin _PARAMS((double)); 00120 extern double tan _PARAMS((double)); 00121 extern double tanh _PARAMS((double)); 00122 extern double frexp _PARAMS((double, int *)); 00123 extern double modf _PARAMS((double, double *)); 00124 extern double ceil _PARAMS((double)); 00125 extern double fabs _PARAMS((double)); 00126 extern double floor _PARAMS((double)); 00127 #endif /* ! defined (__math_68881) */ 00128 00129 /* Non reentrant ANSI C functions. */ 00130 00131 #ifndef _REENT_ONLY 00132 #ifndef __math_68881 00133 extern double acos _PARAMS((double)); 00134 extern double asin _PARAMS((double)); 00135 extern double atan2 _PARAMS((double, double)); 00136 extern double cosh _PARAMS((double)); 00137 extern double sinh _PARAMS((double)); 00138 extern double exp _PARAMS((double)); 00139 extern double ldexp _PARAMS((double, int)); 00140 extern double log _PARAMS((double)); 00141 extern double log10 _PARAMS((double)); 00142 extern double pow _PARAMS((double, double)); 00143 extern double sqrt _PARAMS((double)); 00144 extern double fmod _PARAMS((double, double)); 00145 #endif /* ! defined (__math_68881) */ 00146 #endif /* ! defined (_REENT_ONLY) */ 00147 00148 #if !defined(__STRICT_ANSI__) || defined(__cplusplus) || \ 00149 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 00150 00151 /* ISO C99 types and macros. */ 00152 00153 /* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard, 00154 * considering that the standard says the includes it defines should not 00155 * include other includes that it defines) and that value used. (This can be 00156 * solved, but autoconf has a bug which makes the solution more difficult, so 00157 * it has been skipped for now.) */ 00158 #if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__) 00159 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 00160 #define __TMP_FLT_EVAL_METHOD 00161 #endif /* FLT_EVAL_METHOD */ 00162 #if defined FLT_EVAL_METHOD 00163 #if FLT_EVAL_METHOD == 0 00164 typedef float float_t; 00165 typedef double double_t; 00166 #elif FLT_EVAL_METHOD == 1 00167 typedef double float_t; 00168 typedef double double_t; 00169 #elif FLT_EVAL_METHOD == 2 00170 typedef long double float_t; 00171 typedef long double double_t; 00172 #else 00173 /* Implementation-defined. Assume float_t and double_t have been 00174 * defined previously for this configuration (e.g. config.h). */ 00175 #endif 00176 #else 00177 /* Assume basic definitions. */ 00178 typedef float float_t; 00179 typedef double double_t; 00180 #endif 00181 #if defined(__TMP_FLT_EVAL_METHOD) 00182 #undef FLT_EVAL_METHOD 00183 #endif 00184 00185 #define FP_NAN 0 00186 #define FP_INFINITE 1 00187 #define FP_ZERO 2 00188 #define FP_SUBNORMAL 3 00189 #define FP_NORMAL 4 00190 00191 #ifndef FP_ILOGB0 00192 # define FP_ILOGB0 (-INT_MAX) 00193 #endif 00194 #ifndef FP_ILOGBNAN 00195 # define FP_ILOGBNAN INT_MAX 00196 #endif 00197 00198 #ifndef MATH_ERRNO 00199 # define MATH_ERRNO 1 00200 #endif 00201 #ifndef MATH_ERREXCEPT 00202 # define MATH_ERREXCEPT 2 00203 #endif 00204 #ifndef math_errhandling 00205 # define math_errhandling MATH_ERRNO 00206 #endif 00207 00208 extern int __isinff (float x); 00209 extern int __isinfd (double x); 00210 extern int __isnanf (float x); 00211 extern int __isnand (double x); 00212 extern int __fpclassifyf (float x); 00213 extern int __fpclassifyd (double x); 00214 extern int __signbitf (float x); 00215 extern int __signbitd (double x); 00216 00217 #define fpclassify(__x) \ 00218 ((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \ 00219 __fpclassifyd(__x)) 00220 00221 #ifndef isfinite 00222 #define isfinite(__y) \ 00223 (__extension__ ({int __cy = fpclassify(__y); \ 00224 __cy != FP_INFINITE && __cy != FP_NAN;})) 00225 #endif 00226 00227 /* Note: isinf and isnan were once functions in newlib that took double 00228 * arguments. C99 specifies that these names are reserved for macros 00229 * supporting multiple floating point types. Thus, they are 00230 * now defined as macros. Implementations of the old functions 00231 * taking double arguments still exist for compatibility purposes 00232 * (prototypes for them are in <ieeefp.h>). */ 00233 #ifndef isinf 00234 #define isinf(y) (fpclassify(y) == FP_INFINITE) 00235 #endif 00236 00237 #ifndef isnan 00238 #define isnan(y) (fpclassify(y) == FP_NAN) 00239 #endif 00240 00241 #define isnormal(y) (fpclassify(y) == FP_NORMAL) 00242 #define signbit(__x) \ 00243 ((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \ 00244 __signbitd(__x)) 00245 00246 #define isgreater(x,y) \ 00247 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \ 00248 !isunordered(__x,__y) && (__x > __y);})) 00249 #define isgreaterequal(x,y) \ 00250 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \ 00251 !isunordered(__x,__y) && (__x >= __y);})) 00252 #define isless(x,y) \ 00253 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \ 00254 !isunordered(__x,__y) && (__x < __y);})) 00255 #define islessequal(x,y) \ 00256 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \ 00257 !isunordered(__x,__y) && (__x <= __y);})) 00258 #define islessgreater(x,y) \ 00259 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \ 00260 !isunordered(__x,__y) && (__x < __y || __x > __y);})) 00261 00262 #define isunordered(a,b) \ 00263 (__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \ 00264 fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;})) 00265 00266 /* Non ANSI double precision functions. */ 00267 00268 extern double infinity _PARAMS((void)); 00269 extern double nan _PARAMS((const char *)); 00270 extern int finite _PARAMS((double)); 00271 extern double copysign _PARAMS((double, double)); 00272 extern double logb _PARAMS((double)); 00273 extern int ilogb _PARAMS((double)); 00274 00275 extern double asinh _PARAMS((double)); 00276 extern double cbrt _PARAMS((double)); 00277 extern double nextafter _PARAMS((double, double)); 00278 extern double rint _PARAMS((double)); 00279 extern double scalbn _PARAMS((double, int)); 00280 00281 extern double exp2 _PARAMS((double)); 00282 extern double scalbln _PARAMS((double, long int)); 00283 extern double tgamma _PARAMS((double)); 00284 extern double nearbyint _PARAMS((double)); 00285 extern long int lrint _PARAMS((double)); 00286 extern long long int llrint _PARAMS((double)); 00287 extern double round _PARAMS((double)); 00288 extern long int lround _PARAMS((double)); 00289 extern long long int llround _PARAMS((double)); 00290 extern double trunc _PARAMS((double)); 00291 extern double remquo _PARAMS((double, double, int *)); 00292 extern double fdim _PARAMS((double, double)); 00293 extern double fmax _PARAMS((double, double)); 00294 extern double fmin _PARAMS((double, double)); 00295 extern double fma _PARAMS((double, double, double)); 00296 00297 #ifndef __math_68881 00298 extern double log1p _PARAMS((double)); 00299 extern double expm1 _PARAMS((double)); 00300 #endif /* ! defined (__math_68881) */ 00301 00302 #ifndef _REENT_ONLY 00303 extern double acosh _PARAMS((double)); 00304 extern double atanh _PARAMS((double)); 00305 extern double remainder _PARAMS((double, double)); 00306 extern double gamma _PARAMS((double)); 00307 extern double lgamma _PARAMS((double)); 00308 extern double erf _PARAMS((double)); 00309 extern double erfc _PARAMS((double)); 00310 extern double log2 _PARAMS((double)); 00311 #if !defined(__cplusplus) 00312 #define log2(x) (log (x) / _M_LN2) 00313 #endif 00314 00315 #ifndef __math_68881 00316 extern double hypot _PARAMS((double, double)); 00317 #endif 00318 00319 #endif /* ! defined (_REENT_ONLY) */ 00320 00321 /* Single precision versions of ANSI functions. */ 00322 00323 extern float atanf _PARAMS((float)); 00324 extern float cosf _PARAMS((float)); 00325 extern float sinf _PARAMS((float)); 00326 extern float tanf _PARAMS((float)); 00327 extern float tanhf _PARAMS((float)); 00328 extern float frexpf _PARAMS((float, int *)); 00329 extern float modff _PARAMS((float, float *)); 00330 extern float ceilf _PARAMS((float)); 00331 extern float fabsf _PARAMS((float)); 00332 extern float floorf _PARAMS((float)); 00333 00334 #ifndef _REENT_ONLY 00335 extern float acosf _PARAMS((float)); 00336 extern float asinf _PARAMS((float)); 00337 extern float atan2f _PARAMS((float, float)); 00338 extern float coshf _PARAMS((float)); 00339 extern float sinhf _PARAMS((float)); 00340 extern float expf _PARAMS((float)); 00341 extern float ldexpf _PARAMS((float, int)); 00342 extern float logf _PARAMS((float)); 00343 extern float log10f _PARAMS((float)); 00344 extern float powf _PARAMS((float, float)); 00345 extern float sqrtf _PARAMS((float)); 00346 extern float fmodf _PARAMS((float, float)); 00347 #endif /* ! defined (_REENT_ONLY) */ 00348 00349 /* Other single precision functions. */ 00350 00351 extern float exp2f _PARAMS((float)); 00352 extern float scalblnf _PARAMS((float, long int)); 00353 extern float tgammaf _PARAMS((float)); 00354 extern float nearbyintf _PARAMS((float)); 00355 extern long int lrintf _PARAMS((float)); 00356 extern long long int llrintf _PARAMS((float)); 00357 extern float roundf _PARAMS((float)); 00358 extern long int lroundf _PARAMS((float)); 00359 extern long long int llroundf _PARAMS((float)); 00360 extern float truncf _PARAMS((float)); 00361 extern float remquof _PARAMS((float, float, int *)); 00362 extern float fdimf _PARAMS((float, float)); 00363 extern float fmaxf _PARAMS((float, float)); 00364 extern float fminf _PARAMS((float, float)); 00365 extern float fmaf _PARAMS((float, float, float)); 00366 00367 extern float infinityf _PARAMS((void)); 00368 extern float nanf _PARAMS((const char *)); 00369 extern int finitef _PARAMS((float)); 00370 extern float copysignf _PARAMS((float, float)); 00371 extern float logbf _PARAMS((float)); 00372 extern int ilogbf _PARAMS((float)); 00373 00374 extern float asinhf _PARAMS((float)); 00375 extern float cbrtf _PARAMS((float)); 00376 extern float nextafterf _PARAMS((float, float)); 00377 extern float rintf _PARAMS((float)); 00378 extern float scalbnf _PARAMS((float, int)); 00379 extern float log1pf _PARAMS((float)); 00380 extern float expm1f _PARAMS((float)); 00381 00382 #ifndef _REENT_ONLY 00383 extern float acoshf _PARAMS((float)); 00384 extern float atanhf _PARAMS((float)); 00385 extern float remainderf _PARAMS((float, float)); 00386 extern float gammaf _PARAMS((float)); 00387 extern float lgammaf _PARAMS((float)); 00388 extern float erff _PARAMS((float)); 00389 extern float erfcf _PARAMS((float)); 00390 extern float log2f _PARAMS((float)); 00391 extern float hypotf _PARAMS((float, float)); 00392 #endif /* ! defined (_REENT_ONLY) */ 00393 00394 /* On platforms where long double equals double. */ 00395 #ifdef _LDBL_EQ_DBL 00396 /* Reentrant ANSI C functions. */ 00397 #ifndef __math_68881 00398 extern long double atanl _PARAMS((long double)); 00399 extern long double cosl _PARAMS((long double)); 00400 extern long double sinl _PARAMS((long double)); 00401 extern long double tanl _PARAMS((long double)); 00402 extern long double tanhl _PARAMS((long double)); 00403 extern long double frexpl _PARAMS((long double, int *)); 00404 extern long double modfl _PARAMS((long double, long double *)); 00405 extern long double ceill _PARAMS((long double)); 00406 extern long double fabsl _PARAMS((long double)); 00407 extern long double floorl _PARAMS((long double)); 00408 extern long double log1pl _PARAMS((long double)); 00409 extern long double expm1l _PARAMS((long double)); 00410 #endif /* ! defined (__math_68881) */ 00411 /* Non reentrant ANSI C functions. */ 00412 #ifndef _REENT_ONLY 00413 #ifndef __math_68881 00414 extern long double acosl _PARAMS((long double)); 00415 extern long double asinl _PARAMS((long double)); 00416 extern long double atan2l _PARAMS((long double, long double)); 00417 extern long double coshl _PARAMS((long double)); 00418 extern long double sinhl _PARAMS((long double)); 00419 extern long double expl _PARAMS((long double)); 00420 extern long double ldexpl _PARAMS((long double, int)); 00421 extern long double logl _PARAMS((long double)); 00422 extern long double log10l _PARAMS((long double)); 00423 extern long double powl _PARAMS((long double, long double)); 00424 extern long double sqrtl _PARAMS((long double)); 00425 extern long double fmodl _PARAMS((long double, long double)); 00426 extern long double hypotl _PARAMS((long double, long double)); 00427 #endif /* ! defined (__math_68881) */ 00428 #endif /* ! defined (_REENT_ONLY) */ 00429 extern long double copysignl _PARAMS((long double, long double)); 00430 extern long double nanl _PARAMS((const char *)); 00431 extern int ilogbl _PARAMS((long double)); 00432 extern long double asinhl _PARAMS((long double)); 00433 extern long double cbrtl _PARAMS((long double)); 00434 extern long double nextafterl _PARAMS((long double, long double)); 00435 extern float nexttowardf _PARAMS((float, long double)); 00436 extern double nexttoward _PARAMS((double, long double)); 00437 extern long double nexttowardl _PARAMS((long double, long double)); 00438 extern long double logbl _PARAMS((long double)); 00439 extern long double log2l _PARAMS((long double)); 00440 extern long double rintl _PARAMS((long double)); 00441 extern long double scalbnl _PARAMS((long double, int)); 00442 extern long double exp2l _PARAMS((long double)); 00443 extern long double scalblnl _PARAMS((long double, long)); 00444 extern long double tgammal _PARAMS((long double)); 00445 extern long double nearbyintl _PARAMS((long double)); 00446 extern long int lrintl _PARAMS((long double)); 00447 extern long long int llrintl _PARAMS((long double)); 00448 extern long double roundl _PARAMS((long double)); 00449 extern long lroundl _PARAMS((long double)); 00450 extern long long int llroundl _PARAMS((long double)); 00451 extern long double truncl _PARAMS((long double)); 00452 extern long double remquol _PARAMS((long double, long double, int *)); 00453 extern long double fdiml _PARAMS((long double, long double)); 00454 extern long double fmaxl _PARAMS((long double, long double)); 00455 extern long double fminl _PARAMS((long double, long double)); 00456 extern long double fmal _PARAMS((long double, long double, long double)); 00457 #ifndef _REENT_ONLY 00458 extern long double acoshl _PARAMS((long double)); 00459 extern long double atanhl _PARAMS((long double)); 00460 extern long double remainderl _PARAMS((long double, long double)); 00461 extern long double lgammal _PARAMS((long double)); 00462 extern long double erfl _PARAMS((long double)); 00463 extern long double erfcl _PARAMS((long double)); 00464 #endif /* ! defined (_REENT_ONLY) */ 00465 #else /* !_LDBL_EQ_DBL */ 00466 #ifdef __i386__ 00467 /* Other long double precision functions. */ 00468 extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE)); 00469 extern long int lrintl _PARAMS((_LONG_DOUBLE)); 00470 extern long long int llrintl _PARAMS((_LONG_DOUBLE)); 00471 #endif /* __i386__ */ 00472 #endif /* !_LDBL_EQ_DBL */ 00473 00474 #endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */ 00475 00476 #if !defined (__STRICT_ANSI__) || defined(__cplusplus) 00477 00478 extern double drem _PARAMS((double, double)); 00479 extern void sincos _PARAMS((double, double *, double *)); 00480 extern double gamma_r _PARAMS((double, int *)); 00481 extern double lgamma_r _PARAMS((double, int *)); 00482 00483 extern double y0 _PARAMS((double)); 00484 extern double y1 _PARAMS((double)); 00485 extern double yn _PARAMS((int, double)); 00486 extern double j0 _PARAMS((double)); 00487 extern double j1 _PARAMS((double)); 00488 extern double jn _PARAMS((int, double)); 00489 00490 extern float dremf _PARAMS((float, float)); 00491 extern void sincosf _PARAMS((float, float *, float *)); 00492 extern float gammaf_r _PARAMS((float, int *)); 00493 extern float lgammaf_r _PARAMS((float, int *)); 00494 00495 extern float y0f _PARAMS((float)); 00496 extern float y1f _PARAMS((float)); 00497 extern float ynf _PARAMS((int, float)); 00498 extern float j0f _PARAMS((float)); 00499 extern float j1f _PARAMS((float)); 00500 extern float jnf _PARAMS((int, float)); 00501 00502 /* GNU extensions */ 00503 # ifndef exp10 00504 extern double exp10 _PARAMS((double)); 00505 # endif 00506 # ifndef pow10 00507 extern double pow10 _PARAMS((double)); 00508 # endif 00509 # ifndef exp10f 00510 extern float exp10f _PARAMS((float)); 00511 # endif 00512 # ifndef pow10f 00513 extern float pow10f _PARAMS((float)); 00514 # endif 00515 00516 #endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) */ 00517 00518 #ifndef __STRICT_ANSI__ 00519 00520 /* The gamma functions use a global variable, signgam. */ 00521 #ifndef _REENT_ONLY 00522 #define signgam (*__signgam()) 00523 extern int *__signgam _PARAMS((void)); 00524 #endif /* ! defined (_REENT_ONLY) */ 00525 00526 #define __signgam_r(ptr) _REENT_SIGNGAM(ptr) 00527 00528 /* The exception structure passed to the matherr routine. */ 00529 /* We have a problem when using C++ since `exception' is a reserved 00530 name in C++. */ 00531 #ifdef __cplusplus 00532 struct __exception 00533 #else 00534 struct exception 00535 #endif 00536 { 00537 int type; 00538 char *name; 00539 double arg1; 00540 double arg2; 00541 double retval; 00542 int err; 00543 }; 00544 00545 #ifdef __cplusplus 00546 extern int matherr _PARAMS((struct __exception *e)); 00547 #else 00548 extern int matherr _PARAMS((struct exception *e)); 00549 #endif 00550 00551 /* Values for the type field of struct exception. */ 00552 00553 #define DOMAIN 1 00554 #define SING 2 00555 #define OVERFLOW 3 00556 #define UNDERFLOW 4 00557 #define TLOSS 5 00558 #define PLOSS 6 00559 00560 #endif /* ! defined (__STRICT_ANSI__) */ 00561 00562 /* Useful constants. */ 00563 00564 #if !defined(__STRICT_ANSI__) || ((_XOPEN_SOURCE - 0) >= 500) 00565 00566 #define MAXFLOAT 3.40282347e+38F 00567 00568 #define M_E 2.7182818284590452354 00569 #define M_LOG2E 1.4426950408889634074 00570 #define M_LOG10E 0.43429448190325182765 00571 #define M_LN2 _M_LN2 00572 #define M_LN10 2.30258509299404568402 00573 #define M_PI 3.14159265358979323846 00574 #define M_PI_2 1.57079632679489661923 00575 #define M_PI_4 0.78539816339744830962 00576 #define M_1_PI 0.31830988618379067154 00577 #define M_2_PI 0.63661977236758134308 00578 #define M_2_SQRTPI 1.12837916709551257390 00579 #define M_SQRT2 1.41421356237309504880 00580 #define M_SQRT1_2 0.70710678118654752440 00581 00582 #endif 00583 00584 #ifndef __STRICT_ANSI__ 00585 00586 #define M_TWOPI (M_PI * 2.0) 00587 #define M_3PI_4 2.3561944901923448370E0 00588 #define M_SQRTPI 1.77245385090551602792981 00589 #define M_LN2LO 1.9082149292705877000E-10 00590 #define M_LN2HI 6.9314718036912381649E-1 00591 #define M_SQRT3 1.73205080756887719000 00592 #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ 00593 #define M_LOG2_E _M_LN2 00594 #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ 00595 00596 /* Global control over fdlibm error handling. */ 00597 00598 enum __fdlibm_version 00599 { 00600 __fdlibm_ieee = -1, 00601 __fdlibm_svid, 00602 __fdlibm_xopen, 00603 __fdlibm_posix 00604 }; 00605 00606 #define _LIB_VERSION_TYPE enum __fdlibm_version 00607 #define _LIB_VERSION __fdlib_version 00608 00609 extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION; 00610 00611 #define _IEEE_ __fdlibm_ieee 00612 #define _SVID_ __fdlibm_svid 00613 #define _XOPEN_ __fdlibm_xopen 00614 #define _POSIX_ __fdlibm_posix 00615 00616 #endif /* ! defined (__STRICT_ANSI__) */ 00617 00618 _END_STD_C 00619 00620 #ifdef __FAST_MATH__ 00621 #include <machine/fastmath.h> 00622 #endif 00623 00624 #endif /* _MATH_H_ */