/home/ntakagi/work/STLport-5.1.5/stlport/stl/_cmath.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Boris Fomitchev
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 #ifndef _STLP_INTERNAL_CMATH
00017 #define _STLP_INTERNAL_CMATH
00018 
00019 /* gcc do not like when a using directive appear after a function
00020  * declaration. cmath have abs overloads and cstdlib a using directive
00021  * so cstdlib has to be included first.
00022  */
00023 #if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
00024 #  include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
00025 #endif
00026 
00027 #if defined (_STLP_USE_NEW_C_HEADERS)
00028 #  if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
00029 #    define exception __math_exception
00030 #  endif
00031 #  include _STLP_NATIVE_CPP_C_HEADER(cmath)
00032 #  if defined (_STLP_HAS_NO_NAMESPACES)
00033 #    undef exception
00034 #  endif
00035 #else
00036 #  include <math.h>
00037 #endif
00038 
00039 #if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
00040      !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
00041 #  ifndef _STLP_HAS_NO_NAMESPACES
00042 namespace std {
00043 #  endif
00044 extern "C" double hypot(double x, double y);
00045 #  ifndef _STLP_HAS_NO_NAMESPACES
00046 }
00047 #  endif
00048 
00049 #endif
00050 
00051 #if defined (__sun) && defined (__GNUC__)
00052 extern "C" {
00053   float __cosf(float v);
00054   float __sinf(float v);
00055   float __atan2f(float, float);
00056   float __coshf(float v);
00057   float __sinhf(float v);
00058   float __sqrtf(float v);
00059   float __expf(float v);
00060   float __logf(float v);
00061   float __log10f(float v);
00062 
00063   long double __cosl(long double v);
00064   long double __sinl(long double v);
00065   long double __atan2l(long double, long double);
00066   long double __coshl(long double v);
00067   long double __sinhl(long double v);
00068   long double __sqrtl(long double v);
00069   long double __expl(long double v);
00070   long double __logl(long double v);
00071   long double __log10l(long double v);
00072 }
00073 
00074 extern "C" {
00075   inline float cosf(float v) { return __cosf(v); }
00076   inline float sinf(float v) { return __sinf(v); }
00077   inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
00078   inline float coshf(float v) { return __coshf(v); }
00079   inline float sinhf(float v) { return __sinhf(v); }
00080   inline float sqrtf(float v) { return __sqrtf(v); }
00081   inline float expf(float v) { return __expf(v); }
00082   inline float logf(float v) { return __logf(v); }
00083   inline float log10f(float v) { return __log10f(v); }
00084 
00085   inline long double cosl(long double v) { return __cosl(v); }
00086   inline long double sinl(long double v) { return __sinl(v); }
00087   inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
00088   inline long double coshl(long double v) { return __coshl(v); }
00089   inline long double sinhl(long double v) { return __sinhl(v); }
00090   inline long double sqrtl(long double v) { return __sqrtl(v); }
00091   inline long double expl(long double v) { return __expl(v); }
00092   inline long double logl(long double v) { return __logl(v); }
00093   inline long double log10l(long double v) { return __log10l(v); }
00094 }
00095 #endif // __sun && __GNUC__
00096 
00097 #if defined (__sun)
00098 extern "C" {
00099 extern float __acosf(float);
00100 extern float __asinf(float);
00101 extern float __atanf(float);
00102 extern float __atan2f(float, float);
00103 extern float __ceilf(float);
00104 extern float __cosf(float);
00105 extern float __coshf(float);
00106 extern float __expf(float);
00107 extern float __fabsf(float);
00108 extern float __floorf(float);
00109 extern float __fmodf(float, float);
00110 extern float __frexpf(float, int *);
00111 extern float __ldexpf(float, int);
00112 extern float __logf(float);
00113 extern float __log10f(float);
00114 extern float __modff(float, float *);
00115 extern float __powf(float, float);
00116 extern float __sinf(float);
00117 extern float __sinhf(float);
00118 extern float __sqrtf(float);
00119 extern float __tanf(float);
00120 extern float __tanhf(float);
00121 
00122 extern long double __acosl(long double);
00123 extern long double __asinl(long double);
00124 extern long double __atanl(long double);
00125 extern long double __atan2l(long double, long double);
00126 extern long double __ceill(long double);
00127 extern long double __cosl(long double);
00128 extern long double __coshl(long double);
00129 extern long double __expl(long double);
00130 extern long double __fabsl(long double);
00131 extern long double __floorl(long double);
00132 extern long double __fmodl(long double, long double);
00133 extern long double __frexpl(long double, int *);
00134 extern long double __ldexpl(long double, int);
00135 extern long double __logl(long double);
00136 extern long double __log10l(long double);
00137 extern long double __modfl(long double, long double *);
00138 extern long double __powl(long double, long double);
00139 extern long double __sinl(long double);
00140 extern long double __sinhl(long double);
00141 extern long double __sqrtl(long double);
00142 extern long double __tanl(long double);
00143 extern long double __tanhl(long double);
00144 }
00145 #endif
00146 
00147 #if defined (__BORLANDC__)
00148 #  define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
00149 #else
00150 #  define _STLP_CMATH_FUNC_NAMESPACE
00151 #endif
00152 
00153 #if !defined (__sun) || defined (__GNUC__)
00154 #  define _STLP_MATH_INLINE(float_type, func, cfunc) \
00155      inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
00156 #  define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
00157      inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
00158 #  define _STLP_MATH_INLINE_D(float_type, func, cfunc)
00159 #  define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
00160 #else
00161 #  ifdef __SUNPRO_CC
00162 #    define _STLP_MATH_INLINE(float_type, func, cfunc) \
00163        inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
00164 #    define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
00165        inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
00166 #    define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
00167        inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
00168 #    define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
00169        inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
00170 #  else
00171 #    error Unknown compiler for the Sun platform
00172 #  endif
00173 #endif
00174 
00179 #define _STLP_MATH_INLINEX(__type,func,cfunc) \
00180   inline __type func (__type x) \
00181   { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
00182 #define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
00183   inline __type1 func (__type1 x, __type2 y) \
00184   { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
00185 #define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
00186   inline __type func (__type x, __type *y) { \
00187     double tmp1, tmp2; \
00188     tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
00189     *y = __STATIC_CAST(__type, tmp2); \
00190     return __STATIC_CAST(__type, tmp1); \
00191   }
00192 #define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
00193   inline __type func (__type x, __type y) \
00194   { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
00195 
00196 
00219 #if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
00220    // long double support and both e.g. sinl(long double) and sinf(float)
00221    // This is the default for a correct and complete native library.
00222 #  define _STLP_DEF_MATH_INLINE(func,cf) \
00223   _STLP_MATH_INLINE(float,func,cf##f) \
00224   _STLP_MATH_INLINE_D(double,func,cf) \
00225   _STLP_MATH_INLINE(long double,func,cf##l)
00226 #  define _STLP_DEF_MATH_INLINE2(func,cf) \
00227   _STLP_MATH_INLINE2(float,float,func,cf##f) \
00228   _STLP_MATH_INLINE2_D(double,double,func,cf) \
00229   _STLP_MATH_INLINE2(long double,long double,func,cf##l)
00230 #  define _STLP_DEF_MATH_INLINE2P(func,cf) \
00231   _STLP_MATH_INLINE2(float,float *,func,cf##f) \
00232   _STLP_MATH_INLINE2_D(double,double *,func,cf) \
00233   _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
00234 #  define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00235   _STLP_MATH_INLINE2(float,int *,func,cf##f) \
00236   _STLP_MATH_INLINE2_D(double,int *,func,cf) \
00237   _STLP_MATH_INLINE2(long double,int *,func,cf##l)
00238 #  define _STLP_DEF_MATH_INLINE2I(func,cf) \
00239   _STLP_MATH_INLINE2(float,int,func,cf##f) \
00240   _STLP_MATH_INLINE2_D(double,int,func,cf) \
00241   _STLP_MATH_INLINE2(long double,int,func,cf##l)
00242 #else
00243 #  if !defined (_STLP_NO_LONG_DOUBLE)
00244 #    if !defined (_STLP_NO_VENDOR_MATH_F)
00245        // long double support and e.g. sinf(float) but not e.g. sinl(long double)
00246 #      define _STLP_DEF_MATH_INLINE(func,cf) \
00247       _STLP_MATH_INLINE(float,func,cf##f) \
00248       _STLP_MATH_INLINEX(long double,func,cf)
00249 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
00250       _STLP_MATH_INLINE2(float,float,func,cf##f) \
00251       _STLP_MATH_INLINE2XX(long double,func,cf)
00252 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
00253       _STLP_MATH_INLINE2(float,float *,func,cf##f) \
00254       _STLP_MATH_INLINE2PX(long double,func,cf)
00255 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00256       _STLP_MATH_INLINE2(float,int *,func,cf##f) \
00257       _STLP_MATH_INLINE2X(long double,int *,func,cf)
00258 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
00259       _STLP_MATH_INLINE2(float,int,func,cf##f) \
00260       _STLP_MATH_INLINE2X(long double,int,func,cf)
00261 #    elif !defined (_STLP_NO_VENDOR_MATH_L)
00262        // long double support and e.g. sinl(long double) but not e.g. sinf(float)
00263 #      define _STLP_DEF_MATH_INLINE(func,cf) \
00264       _STLP_MATH_INLINEX(float,func,cf) \
00265       _STLP_MATH_INLINE(long double,func,cf##l)
00266 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
00267       _STLP_MATH_INLINE2XX(float,func,cf) \
00268       _STLP_MATH_INLINE2(long double,long double,func,cf##l)
00269 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
00270       _STLP_MATH_INLINE2PX(float,func,cf) \
00271       _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
00272 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00273       _STLP_MATH_INLINE2X(float,int *,func,cf) \
00274       _STLP_MATH_INLINE2(long double,int *,func,cf##l)
00275 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
00276       _STLP_MATH_INLINE2X(float,int,func,cf) \
00277       _STLP_MATH_INLINE2(long double,int,func,cf##l)
00278 #    else
00279 #      define _STLP_DEF_MATH_INLINE(func,cf) \
00280       _STLP_MATH_INLINEX(float,func,cf) \
00281       _STLP_MATH_INLINEX(long double,func,cf)
00282 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
00283       _STLP_MATH_INLINE2XX(float,func,cf) \
00284       _STLP_MATH_INLINE2XX(long double,func,cf)
00285 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
00286       _STLP_MATH_INLINE2PX(float,func,cf) \
00287       _STLP_MATH_INLINE2PX(long double,func,cf)
00288 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00289       _STLP_MATH_INLINE2X(float,int *,func,cf) \
00290       _STLP_MATH_INLINE2X(long double,int *,func,cf)
00291 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
00292       _STLP_MATH_INLINE2X(float,int,func,cf) \
00293       _STLP_MATH_INLINE2X(long double,int,func,cf)
00294 #    endif
00295 #  else
00296 #    if !defined (_STLP_NO_VENDOR_MATH_F)
00297 #      define _STLP_DEF_MATH_INLINE(func,cf) \
00298       _STLP_MATH_INLINE(float,func,cf##f)
00299 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
00300       _STLP_MATH_INLINE2(float,float,func,cf##f)
00301 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
00302       _STLP_MATH_INLINE2(float,float *,func,cf##f)
00303 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00304       _STLP_MATH_INLINE2(float,int *,func,cf##f)
00305 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
00306       _STLP_MATH_INLINE2(float,int,func,cf##f)
00307 #    else // _STLP_NO_VENDOR_MATH_F
00308        // neither long double support nor e.g. sinf(float) functions
00309 #      define _STLP_DEF_MATH_INLINE(func,cf) \
00310       _STLP_MATH_INLINEX(float,func,cf)
00311 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
00312       _STLP_MATH_INLINE2XX(float,func,cf)
00313 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
00314       _STLP_MATH_INLINE2PX(float,func,cf)
00315 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
00316       _STLP_MATH_INLINE2X(float,int *,func,cf)
00317 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
00318       _STLP_MATH_INLINE2X(float,int,func,cf)
00319 #    endif // _STLP_NO_VENDOR_MATH_F
00320 #  endif
00321 #endif
00322 
00323 #if defined (_STLP_WCE) || \
00324    (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
00325 /*
00326  * dums: VC6 has all the required C++ functions but only define them if
00327  * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
00328  * thing also when _MSC_EXTENSIONS is defined.
00329  * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
00330  */
00331 //We have to tell the compilers that abs, acos ... math functions are not intrinsic
00332 //otherwise we have Internal Compiler Error in release mode...
00333 #  pragma warning(push)
00334 #  pragma warning(disable: 4162) // no function with C linkage found
00335 #  pragma warning(disable: 4163) // not available as an intrinsic function
00336 #  pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
00337 #  if defined (_STLP_WCE)
00338 #    pragma function (ceil, floor)
00339 #  endif
00340 #  define _STLP_RESTORE_FUNCTION_INTRINSIC
00341 #endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
00342 
00343 #if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
00344 /* In this config Borland native lib only define functions in std namespace.
00345  * In order to have all overloads in STLport namespace we need to add the
00346  * double overload in global namespace. We do not use a using statement to avoid
00347  * import of invalid overload.
00348  */
00349 #  define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
00350 #  define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
00351 
00352 _STLP_DMATH_INLINE(acos)
00353 _STLP_DMATH_INLINE(asin)
00354 _STLP_DMATH_INLINE(atan)
00355 _STLP_DMATH_INLINE2(atan2)
00356 _STLP_DMATH_INLINE(ceil)
00357 _STLP_DMATH_INLINE(cos)
00358 _STLP_DMATH_INLINE(cosh)
00359 _STLP_DMATH_INLINE(exp)
00360 _STLP_DMATH_INLINE(fabs)
00361 _STLP_DMATH_INLINE(floor)
00362 _STLP_DMATH_INLINE2(fmod)
00363 _STLP_MATH_INLINE2X(double, int*, frexp, frexp)
00364 _STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
00365 _STLP_DMATH_INLINE(log)
00366 _STLP_DMATH_INLINE(log10)
00367 _STLP_MATH_INLINE2PX(double, modf, modf)
00368 _STLP_DMATH_INLINE(sin)
00369 _STLP_DMATH_INLINE(sinh)
00370 _STLP_DMATH_INLINE(sqrt)
00371 _STLP_DMATH_INLINE(tan)
00372 _STLP_DMATH_INLINE(tanh)
00373 _STLP_DMATH_INLINE2(pow)
00374 _STLP_DMATH_INLINE2(hypot)
00375 
00376 #  undef _STLP_DMATH_INLINE
00377 #  undef _STLP_DMATH_INLINE2
00378 #endif
00379 
00380 #if defined (__DMC__)
00381 #  if defined (fabs)
00382 inline double __stlp_fabs(double __x) { return fabs(__x); }
00383 #    undef fabs
00384 inline double fabs(double __x) { return __stlp_fabs(__x); }
00385 #  endif
00386 #  if defined (cos)
00387 inline double __stlp_cos(double __x) { return cos(__x); }
00388 #    undef cos
00389 inline double cos(double __x) { return __stlp_cos(__x); }
00390 #  endif
00391 #  if defined (sin)
00392 inline double __stlp_sin(double __x) { return sin(__x); }
00393 #    undef sin
00394 inline double sin(double __x) { return __stlp_sin(__x); }
00395 #  endif
00396 #  if defined (sqrt)
00397 inline double __stlp_sqrt(double __x) { return sqrt(__x); }
00398 #    undef sqrt
00399 inline double sqrt(double __x) { return __stlp_sqrt(__x); }
00400 #  endif
00401 #  if defined (ldexp)
00402 inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
00403 #    undef ldexp
00404 inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
00405 #  endif
00406 #endif
00407 
00408 /* MSVC native lib starting with .Net 2003 has already all math functions
00409  * in global namespace.
00410  * HP-UX native lib has math functions in the global namespace.
00411  */
00412 #if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
00413     (!defined (__HP_aCC) || (__HP_aCC < 30000))
00414 inline double abs(double __x)
00415 { return ::fabs(__x); }
00416 #  if !defined (__MVS__)
00417 _STLP_DEF_MATH_INLINE(abs, fabs)
00418 #  else // __MVS__ has native long double abs?
00419 inline float abs(float __x) { return ::fabsf(__x); }
00420 #  endif
00421 
00422 _STLP_DEF_MATH_INLINE(acos, acos)
00423 _STLP_DEF_MATH_INLINE(asin, asin)
00424 _STLP_DEF_MATH_INLINE(atan, atan)
00425 _STLP_DEF_MATH_INLINE2(atan2, atan2)
00426 _STLP_DEF_MATH_INLINE(ceil, ceil)
00427 _STLP_DEF_MATH_INLINE(cos, cos)
00428 _STLP_DEF_MATH_INLINE(cosh, cosh)
00429 _STLP_DEF_MATH_INLINE(exp, exp)
00430 _STLP_DEF_MATH_INLINE(fabs, fabs)
00431 _STLP_DEF_MATH_INLINE(floor, floor)
00432 _STLP_DEF_MATH_INLINE2(fmod, fmod)
00433 _STLP_DEF_MATH_INLINE2PI(frexp, frexp)
00434 _STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
00435 _STLP_DEF_MATH_INLINE(log, log)
00436 _STLP_DEF_MATH_INLINE(log10, log10)
00437 _STLP_DEF_MATH_INLINE2P(modf, modf)
00438 _STLP_DEF_MATH_INLINE(sin, sin)
00439 _STLP_DEF_MATH_INLINE(sinh, sinh)
00440 _STLP_DEF_MATH_INLINE(sqrt, sqrt)
00441 _STLP_DEF_MATH_INLINE(tan, tan)
00442 _STLP_DEF_MATH_INLINE(tanh, tanh)
00443 _STLP_DEF_MATH_INLINE2(pow, pow)
00444 
00445 #  if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
00446 #    ifndef _STLP_NO_VENDOR_MATH_F
00447 #      ifndef __sun
00448 inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
00449 #      else
00450 inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
00451 #      endif
00452 #    else
00453 inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
00454 #    endif
00455 inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
00456 #    if !defined (_STLP_NO_LONG_DOUBLE)
00457 #      if !defined(_STLP_NO_VENDOR_MATH_L)
00458 #        ifndef __sun
00459 inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
00460 #        else
00461 #          ifndef __SUNPRO_CC
00462 inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
00463 #          else
00464 inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
00465 #          endif
00466 #        endif
00467 #      else
00468 inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); }
00469 #      endif
00470 #    endif
00471 #  else
00472 //The MS native pow version has a bugged overload so it is not imported
00473 //in the STLport namespace.
00474 //Here is the bugged version:
00475 //inline double pow(int __x, int __y)            { return (_Pow_int(__x, __y)); }
00476 inline double      pow(double __x, int __y)      { return (_Pow_int(__x, __y)); }
00477 inline float       pow(float __x, int __y)       { return (_Pow_int(__x, __y)); }
00478 inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
00479 #  endif
00480 #endif
00481 
00482 #if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
00483 #  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
00484 #    pragma warning (push)
00485 #    pragma warning (disable : 4996) // hypot is deprecated.
00486 #  endif
00487 _STLP_MATH_INLINE2XX(float, hypot, hypot)
00488 inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
00489 #  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
00490 #    pragma warning (pop)
00491 #  endif
00492 #else
00493 #  if defined (_STLP_USE_UCLIBC)
00494 inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
00495 _STLP_DEF_MATH_INLINE2(hypot, hypot)
00496 #  elif defined (_STLP_WCE)
00497    /* CE has a double _hypot(double,double) which we use */
00498 inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
00499 _STLP_DEF_MATH_INLINE2(hypot, _hypot)
00500 #  endif
00501 #endif
00502 
00503 #if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
00504 //restoration of the default intrinsic status of those functions:
00505 #  pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
00506 #  if defined (_STLP_WCE)
00507 #    pragma intrinsic (ceil, floor)
00508 #  endif
00509 #  pragma warning(pop)
00510 #  undef _STLP_RESTORE_FUNCTION_INTRINSIC
00511 #endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
00512 
00513 /* C++ Standard is unclear about several call to 'using ::func' if new overloads
00514  * of ::func appears between 2 successive 'using' calls. To avoid this potential
00515  * problem we provide all abs overload before the 'using' call.
00516  * Beware: This header inclusion has to be after all abs overload of this file.
00517  *         The first 'using ::abs' call is going to be in the other header.
00518  */
00519 #ifndef _STLP_INTERNAL_CSTDLIB
00520 #  include <stl/_cstdlib.h>
00521 #endif
00522 
00523 #if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
00524 _STLP_BEGIN_NAMESPACE
00525 using ::abs;
00526 using ::acos;
00527 using ::asin;
00528 using ::atan;
00529 using ::atan2;
00530 using ::ceil;
00531 using ::cos;
00532 using ::cosh;
00533 using ::exp;
00534 using ::fabs;
00535 using ::floor;
00536 using ::fmod;
00537 using ::frexp;
00538 using ::hypot;
00539 using ::ldexp;
00540 using ::log;
00541 using ::log10;
00542 using ::modf;
00543 using ::pow;
00544 using ::sin;
00545 using ::sinh;
00546 using ::sqrt;
00547 using ::tan;
00548 using ::tanh;
00549 _STLP_END_NAMESPACE
00550 #  if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560)
00551 using _STLP_VENDOR_CSTD::_ecvt;
00552 using _STLP_VENDOR_CSTD::_fcvt;
00553 #  endif
00554 #endif
00555 
00556 #endif /* _STLP_INTERNAL_CMATH */
00557 
00558 // Local Variables:
00559 // mode:C++
00560 // End:



Generated on Mon Mar 10 15:32:20 2008 by  doxygen 1.5.1