00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef _RTAI_MATH_H
00027 #define _RTAI_MATH_H    1
00028 #define _MATH_H         1
00029 
00030 #include <rtai_types.h>
00031 #ifdef __attribute_pure__
00032 #undef __attribute_pure__
00033 #endif
00034 #ifdef __attribute_used__
00035 #undef __attribute_used__
00036 #endif
00037 #include <features.h>
00038 
00039 __BEGIN_DECLS
00040 
00041 
00042 
00043 #include <bits/huge_val.h>
00044 
00045 
00046 #ifdef   __USE_ISOC99
00047 # include <bits/nan.h>
00048 #endif
00049 
00050 #include <bits/mathdef.h>
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 #define __MATHCALL(function,suffix, args)   \
00059   __MATHDECL (_Mdouble_,function,suffix, args)
00060 #define __MATHDECL(type, function,suffix, args) \
00061   __MATHDECL_1(type, function,suffix, args); \
00062   __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
00063 #define __MATHCALLX(function,suffix, args, attrib)  \
00064   __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
00065 #define __MATHDECLX(type, function,suffix, args, attrib) \
00066   __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
00067   __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib)
00068 #define __MATHDECL_1(type, function,suffix, args) \
00069   extern type __MATH_PRECNAME(function,suffix) args __THROW
00070 
00071 #define _Mdouble_       double
00072 #define __MATH_PRECNAME(name,r) __CONCAT(name,r)
00073 
00074 #define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
00075 #define _Mdouble_END_NAMESPACE   __END_NAMESPACE_STD
00076 
00077 #include <bits/mathcalls.h>
00078 #undef  _Mdouble_
00079 
00080 #undef _Mdouble_BEGIN_NAMESPACE
00081 #undef _Mdouble_END_NAMESPACE
00082 
00083 #undef  __MATH_PRECNAME
00084 
00085 #if defined __USE_MISC || defined __USE_ISOC99
00086 
00087 
00088 
00089 
00090 
00091 # ifndef _Mfloat_
00092 #  define _Mfloat_      float
00093 # endif
00094 # define _Mdouble_      _Mfloat_
00095 # ifdef __STDC__
00096 #  define __MATH_PRECNAME(name,r) name##f##r
00097 # else
00098 #  define __MATH_PRECNAME(name,r) namefr
00099 # endif
00100 
00101 #define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
00102 #define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
00103 
00104 # include <bits/mathcalls.h>
00105 # undef _Mdouble_
00106 
00107 # undef _Mdouble_BEGIN_NAMESPACE
00108 # undef _Mdouble_END_NAMESPACE
00109 
00110 # undef __MATH_PRECNAME
00111 
00112 # if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH
00113 
00114 
00115 
00116 #  ifndef _Mlong_double_
00117 #   define _Mlong_double_   long double
00118 #  endif
00119 #  define _Mdouble_         _Mlong_double_
00120 #  ifdef __STDC__
00121 #   define __MATH_PRECNAME(name,r) name##l##r
00122 #  else
00123 #   define __MATH_PRECNAME(name,r) namelr
00124 #  endif
00125 
00126 #define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
00127 #define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
00128 
00129 #  include <bits/mathcalls.h>
00130 #  undef _Mdouble_
00131 
00132 # undef _Mdouble_BEGIN_NAMESPACE
00133 # undef _Mdouble_END_NAMESPACE 
00134 
00135 #  undef __MATH_PRECNAME
00136 
00137 # endif 
00138 
00139 #endif  
00140 #undef  __MATHDECL_1
00141 #undef  __MATHDECL
00142 #undef  __MATHCALL
00143 
00144 
00145 #if defined __USE_MISC || defined __USE_XOPEN
00146 
00147 extern int signgam;
00148 #endif
00149 
00150 
00151 
00152 #if defined(__USE_ISOC99) && __USE_ISOC99
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 enum
00189   {
00190     FP_NAN,
00191 # define FP_NAN FP_NAN
00192     FP_INFINITE,
00193 # define FP_INFINITE FP_INFINITE
00194     FP_ZERO,
00195 # define FP_ZERO FP_ZERO
00196     FP_SUBNORMAL,
00197 # define FP_SUBNORMAL FP_SUBNORMAL
00198     FP_NORMAL
00199 # define FP_NORMAL FP_NORMAL
00200   };
00201 
00202 
00203 # ifdef __NO_LONG_DOUBLE_MATH
00204 #  define fpclassify(x) \
00205      (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
00206 # else
00207 #  define fpclassify(x) \
00208      (sizeof (x) == sizeof (float)                        \
00209       ? __fpclassifyf (x)                             \
00210       : sizeof (x) == sizeof (double)                         \
00211       ? __fpclassify (x) : __fpclassifyl (x))
00212 # endif
00213 
00214 
00215 # ifdef __NO_LONG_DOUBLE_MATH
00216 #  define signbit(x) \
00217      (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x))
00218 # else
00219 #  define signbit(x) \
00220      (sizeof (x) == sizeof (float)                        \
00221       ? __signbitf (x)                                \
00222       : sizeof (x) == sizeof (double)                         \
00223       ? __signbit (x) : __signbitl (x))
00224 # endif
00225 
00226 
00227 # ifdef __NO_LONG_DOUBLE_MATH
00228 #  define isfinite(x) \
00229      (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x))
00230 # else
00231 #  define isfinite(x) \
00232      (sizeof (x) == sizeof (float)                        \
00233       ? __finitef (x)                                 \
00234       : sizeof (x) == sizeof (double)                         \
00235       ? __finite (x) : __finitel (x))
00236 # endif
00237 
00238 
00239 # define isnormal(x) (fpclassify (x) == FP_NORMAL)
00240 
00241 
00242 
00243 # ifdef __NO_LONG_DOUBLE_MATH
00244 #  define isnan(x) \
00245      (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
00246 # else
00247 #  define isnan(x) \
00248      (sizeof (x) == sizeof (float)                        \
00249       ? __isnanf (x)                                  \
00250       : sizeof (x) == sizeof (double)                         \
00251       ? __isnan (x) : __isnanl (x))
00252 # endif
00253 
00254 
00255 # ifdef __NO_LONG_DOUBLE_MATH
00256 #  define isinf(x) \
00257      (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
00258 # else
00259 #  define isinf(x) \
00260      (sizeof (x) == sizeof (float)                        \
00261       ? __isinff (x)                                  \
00262       : sizeof (x) == sizeof (double)                         \
00263       ? __isinf (x) : __isinfl (x))
00264 # endif
00265 
00266 
00267 # define MATH_ERRNO 1   
00268 # define MATH_ERREXCEPT 2   
00269 
00270 #endif 
00271 
00272 #ifdef  __USE_MISC
00273 
00274 typedef enum
00275 {
00276   _IEEE_ = -1,  
00277   _SVID_,   
00278   _XOPEN_,  
00279   _POSIX_,
00280   _ISOC_    
00281 } _LIB_VERSION_TYPE;
00282 
00283 
00284 
00285 
00286 extern _LIB_VERSION_TYPE _LIB_VERSION;
00287 #endif
00288 
00289 
00290 #ifdef __USE_SVID
00291 
00292 
00293 
00294 
00295 
00296 # ifdef __cplusplus
00297 struct __exception
00298 # else
00299 struct exception
00300 # endif
00301   {
00302     int type;
00303     char *name;
00304     double arg1;
00305     double arg2;
00306     double retval;
00307   };
00308 
00309 # ifdef __cplusplus
00310 extern int matherr (struct __exception *__exc) throw ();
00311 # else
00312 extern int matherr (struct exception *__exc);
00313 # endif
00314 
00315 # define X_TLOSS    1.41484755040568800000e+16
00316 
00317 
00318 # define DOMAIN     1
00319 # define SING       2
00320 # define OVERFLOW   3
00321 # define UNDERFLOW  4
00322 # define TLOSS      5
00323 # define PLOSS      6
00324 
00325 
00326 # define HUGE       3.40282347e+38F
00327 
00328 #else   
00329 
00330 # ifdef __USE_XOPEN
00331 
00332 #  define MAXFLOAT  3.40282347e+38F
00333 # endif
00334 
00335 #endif  
00336 
00337 
00338 
00339 #if defined __USE_BSD || defined __USE_XOPEN
00340 # define M_E        2.7182818284590452354   
00341 # define M_LOG2E    1.4426950408889634074   
00342 # define M_LOG10E   0.43429448190325182765  
00343 # define M_LN2      0.69314718055994530942  
00344 # define M_LN10     2.30258509299404568402  
00345 # define M_PI       3.14159265358979323846  
00346 # define M_PI_2     1.57079632679489661923  
00347 # define M_PI_4     0.78539816339744830962  
00348 # define M_1_PI     0.31830988618379067154  
00349 # define M_2_PI     0.63661977236758134308  
00350 # define M_2_SQRTPI 1.12837916709551257390  
00351 # define M_SQRT2    1.41421356237309504880  
00352 # define M_SQRT1_2  0.70710678118654752440  
00353 #endif
00354 
00355 
00356 
00357 
00358 #ifdef __USE_GNU
00359 # define M_El       2.7182818284590452353602874713526625L  
00360 # define M_LOG2El   1.4426950408889634073599246810018922L  
00361 # define M_LOG10El  0.4342944819032518276511289189166051L  
00362 # define M_LN2l     0.6931471805599453094172321214581766L  
00363 # define M_LN10l    2.3025850929940456840179914546843642L  
00364 # define M_PIl      3.1415926535897932384626433832795029L  
00365 # define M_PI_2l    1.5707963267948966192313216916397514L  
00366 # define M_PI_4l    0.7853981633974483096156608458198757L  
00367 # define M_1_PIl    0.3183098861837906715377675267450287L  
00368 # define M_2_PIl    0.6366197723675813430755350534900574L  
00369 # define M_2_SQRTPIl    1.1283791670955125738961589031215452L  
00370 # define M_SQRT2l   1.4142135623730950488016887242096981L  
00371 # define M_SQRT1_2l 0.7071067811865475244008443621048490L  
00372 #endif
00373 
00374 
00375 
00376 
00377 
00378 #if defined __STRICT_ANSI__ && !defined __NO_MATH_INLINES
00379 # define __NO_MATH_INLINES  1
00380 #endif
00381 
00382 
00383 #ifdef __USE_EXTERN_INLINES
00384 # include <bits/mathinline.h>
00385 #endif
00386 
00387 
00388 #if defined(__USE_ISOC99) && __USE_ISOC99
00389 
00390 
00391 
00392 
00393 
00394 
00395 
00396 # ifndef isgreater
00397 #  define isgreater(x, y) \
00398   (__extension__                                  \
00399    ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
00400       !isunordered (__x, __y) && __x > __y; }))
00401 # endif
00402 
00403 
00404 # ifndef isgreaterequal
00405 #  define isgreaterequal(x, y) \
00406   (__extension__                                  \
00407    ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
00408       !isunordered (__x, __y) && __x >= __y; }))
00409 # endif
00410 
00411 
00412 # ifndef isless
00413 #  define isless(x, y) \
00414   (__extension__                                  \
00415    ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
00416       !isunordered (__x, __y) && __x < __y; }))
00417 # endif
00418 
00419 
00420 # ifndef islessequal
00421 #  define islessequal(x, y) \
00422   (__extension__                                  \
00423    ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
00424       !isunordered (__x, __y) && __x <= __y; }))
00425 # endif
00426 
00427 
00428 # ifndef islessgreater
00429 #  define islessgreater(x, y) \
00430   (__extension__                                  \
00431    ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
00432       !isunordered (__x, __y) && (__x < __y || __y < __x); }))
00433 # endif
00434 
00435 
00436 # ifndef isunordered
00437 #  define isunordered(u, v) \
00438   (__extension__                                  \
00439    ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v);               \
00440       fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; }))
00441 # endif
00442 
00443 #endif
00444 
00445 __END_DECLS
00446 
00447 
00448 
00449 struct complex {
00450     double x;
00451     double y;
00452 };
00453 
00454 double cabs __P((struct complex));
00455 
00456 double gamma_r(double x, int *signgamp); 
00457 
00458 long int rinttol(double x);
00459 
00460 long int roundtol(double x);
00461 
00462 #endif