epoc32/include/tools/stlport/stl/_cmath.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/tools/stlport/stl/_cmath.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,560 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999
     1.6 + * Boris Fomitchev
     1.7 + *
     1.8 + * This material is provided "as is", with absolutely no warranty expressed
     1.9 + * or implied. Any use is at your own risk.
    1.10 + *
    1.11 + * Permission to use or copy this software for any purpose is hereby granted
    1.12 + * without fee, provided the above notices are retained on all copies.
    1.13 + * Permission to modify the code and to distribute modified code is granted,
    1.14 + * provided the above notices are retained, and a notice that the code was
    1.15 + * modified is included with the above copyright notice.
    1.16 + *
    1.17 + */
    1.18 +
    1.19 +#ifndef _STLP_INTERNAL_CMATH
    1.20 +#define _STLP_INTERNAL_CMATH
    1.21 +
    1.22 +/* gcc do not like when a using directive appear after a function
    1.23 + * declaration. cmath have abs overloads and cstdlib a using directive
    1.24 + * so cstdlib has to be included first.
    1.25 + */
    1.26 +#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
    1.27 +#  include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
    1.28 +#endif
    1.29 +
    1.30 +#if defined (_STLP_USE_NEW_C_HEADERS)
    1.31 +#  if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
    1.32 +#    define exception __math_exception
    1.33 +#  endif
    1.34 +#  include _STLP_NATIVE_CPP_C_HEADER(cmath)
    1.35 +#  if defined (_STLP_HAS_NO_NAMESPACES)
    1.36 +#    undef exception
    1.37 +#  endif
    1.38 +#else
    1.39 +#  include <math.h>
    1.40 +#endif
    1.41 +
    1.42 +#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
    1.43 +     !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
    1.44 +#  ifndef _STLP_HAS_NO_NAMESPACES
    1.45 +namespace std {
    1.46 +#  endif
    1.47 +extern "C" double hypot(double x, double y);
    1.48 +#  ifndef _STLP_HAS_NO_NAMESPACES
    1.49 +}
    1.50 +#  endif
    1.51 +
    1.52 +#endif
    1.53 +
    1.54 +#if defined (__sun) && defined (__GNUC__)
    1.55 +extern "C" {
    1.56 +  float __cosf(float v);
    1.57 +  float __sinf(float v);
    1.58 +  float __atan2f(float, float);
    1.59 +  float __coshf(float v);
    1.60 +  float __sinhf(float v);
    1.61 +  float __sqrtf(float v);
    1.62 +  float __expf(float v);
    1.63 +  float __logf(float v);
    1.64 +  float __log10f(float v);
    1.65 +
    1.66 +  long double __cosl(long double v);
    1.67 +  long double __sinl(long double v);
    1.68 +  long double __atan2l(long double, long double);
    1.69 +  long double __coshl(long double v);
    1.70 +  long double __sinhl(long double v);
    1.71 +  long double __sqrtl(long double v);
    1.72 +  long double __expl(long double v);
    1.73 +  long double __logl(long double v);
    1.74 +  long double __log10l(long double v);
    1.75 +}
    1.76 +
    1.77 +extern "C" {
    1.78 +  inline float cosf(float v) { return __cosf(v); }
    1.79 +  inline float sinf(float v) { return __sinf(v); }
    1.80 +  inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
    1.81 +  inline float coshf(float v) { return __coshf(v); }
    1.82 +  inline float sinhf(float v) { return __sinhf(v); }
    1.83 +  inline float sqrtf(float v) { return __sqrtf(v); }
    1.84 +  inline float expf(float v) { return __expf(v); }
    1.85 +  inline float logf(float v) { return __logf(v); }
    1.86 +  inline float log10f(float v) { return __log10f(v); }
    1.87 +
    1.88 +  inline long double cosl(long double v) { return __cosl(v); }
    1.89 +  inline long double sinl(long double v) { return __sinl(v); }
    1.90 +  inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
    1.91 +  inline long double coshl(long double v) { return __coshl(v); }
    1.92 +  inline long double sinhl(long double v) { return __sinhl(v); }
    1.93 +  inline long double sqrtl(long double v) { return __sqrtl(v); }
    1.94 +  inline long double expl(long double v) { return __expl(v); }
    1.95 +  inline long double logl(long double v) { return __logl(v); }
    1.96 +  inline long double log10l(long double v) { return __log10l(v); }
    1.97 +}
    1.98 +#endif // __sun && __GNUC__
    1.99 +
   1.100 +#if defined (__sun)
   1.101 +extern "C" {
   1.102 +extern float __acosf(float);
   1.103 +extern float __asinf(float);
   1.104 +extern float __atanf(float);
   1.105 +extern float __atan2f(float, float);
   1.106 +extern float __ceilf(float);
   1.107 +extern float __cosf(float);
   1.108 +extern float __coshf(float);
   1.109 +extern float __expf(float);
   1.110 +extern float __fabsf(float);
   1.111 +extern float __floorf(float);
   1.112 +extern float __fmodf(float, float);
   1.113 +extern float __frexpf(float, int *);
   1.114 +extern float __ldexpf(float, int);
   1.115 +extern float __logf(float);
   1.116 +extern float __log10f(float);
   1.117 +extern float __modff(float, float *);
   1.118 +extern float __powf(float, float);
   1.119 +extern float __sinf(float);
   1.120 +extern float __sinhf(float);
   1.121 +extern float __sqrtf(float);
   1.122 +extern float __tanf(float);
   1.123 +extern float __tanhf(float);
   1.124 +
   1.125 +extern long double __acosl(long double);
   1.126 +extern long double __asinl(long double);
   1.127 +extern long double __atanl(long double);
   1.128 +extern long double __atan2l(long double, long double);
   1.129 +extern long double __ceill(long double);
   1.130 +extern long double __cosl(long double);
   1.131 +extern long double __coshl(long double);
   1.132 +extern long double __expl(long double);
   1.133 +extern long double __fabsl(long double);
   1.134 +extern long double __floorl(long double);
   1.135 +extern long double __fmodl(long double, long double);
   1.136 +extern long double __frexpl(long double, int *);
   1.137 +extern long double __ldexpl(long double, int);
   1.138 +extern long double __logl(long double);
   1.139 +extern long double __log10l(long double);
   1.140 +extern long double __modfl(long double, long double *);
   1.141 +extern long double __powl(long double, long double);
   1.142 +extern long double __sinl(long double);
   1.143 +extern long double __sinhl(long double);
   1.144 +extern long double __sqrtl(long double);
   1.145 +extern long double __tanl(long double);
   1.146 +extern long double __tanhl(long double);
   1.147 +}
   1.148 +#endif
   1.149 +
   1.150 +#if defined (__BORLANDC__)
   1.151 +#  define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
   1.152 +#else
   1.153 +#  define _STLP_CMATH_FUNC_NAMESPACE
   1.154 +#endif
   1.155 +
   1.156 +#if !defined (__sun) || defined (__GNUC__)
   1.157 +#  define _STLP_MATH_INLINE(float_type, func, cfunc) \
   1.158 +     inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
   1.159 +#  define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
   1.160 +     inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
   1.161 +#  define _STLP_MATH_INLINE_D(float_type, func, cfunc)
   1.162 +#  define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
   1.163 +#else
   1.164 +#  ifdef __SUNPRO_CC
   1.165 +#    define _STLP_MATH_INLINE(float_type, func, cfunc) \
   1.166 +       inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
   1.167 +#    define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
   1.168 +       inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
   1.169 +#    define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
   1.170 +       inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
   1.171 +#    define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
   1.172 +       inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
   1.173 +#  else
   1.174 +#    error Unknown compiler for the Sun platform
   1.175 +#  endif
   1.176 +#endif
   1.177 +
   1.178 +/** macros to define math functions
   1.179 +These macros (having an X somewhere in the name) forward to the C library's
   1.180 +double functions but cast the arguments and return values to the given type. */
   1.181 +
   1.182 +#define _STLP_MATH_INLINEX(__type,func,cfunc) \
   1.183 +  inline __type func (__type x) \
   1.184 +  { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
   1.185 +#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
   1.186 +  inline __type1 func (__type1 x, __type2 y) \
   1.187 +  { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
   1.188 +#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
   1.189 +  inline __type func (__type x, __type *y) { \
   1.190 +    double tmp1, tmp2; \
   1.191 +    tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
   1.192 +    *y = __STATIC_CAST(__type, tmp2); \
   1.193 +    return __STATIC_CAST(__type, tmp1); \
   1.194 +  }
   1.195 +#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
   1.196 +  inline __type func (__type x, __type y) \
   1.197 +  { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
   1.198 +
   1.199 +
   1.200 +/** rough characterization of compiler and native C library
   1.201 +For the compiler, it can either support long double or not. If it doesn't, the
   1.202 +macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
   1.203 +overloads.
   1.204 +For the native C library the question is whether it has variants with an 'f'
   1.205 +suffix (for float as opposed to double) or an 'l' suffix (for long double). If
   1.206 +the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
   1.207 +long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
   1.208 +the latter doesn't make sense anyway when the compiler already has no long
   1.209 +double support.
   1.210 +
   1.211 +Those two traits determine a) which overloads get defined and b) how they are
   1.212 +defined.
   1.213 +
   1.214 +Meaning of suffixes:
   1.215 +""   : function returning and taking a float_type
   1.216 +"2"  : function returning a float_type and taking to float_types
   1.217 +"2P" : function returning a float_type and taking a float_type and a float_type*
   1.218 +"2PI": function returning a float_type and taking a float_type and an int*
   1.219 +"2I" : function returning a float_type and taking a float_Type and an int
   1.220 +*/
   1.221 +
   1.222 +#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
   1.223 +   // long double support and both e.g. sinl(long double) and sinf(float)
   1.224 +   // This is the default for a correct and complete native library.
   1.225 +#  define _STLP_DEF_MATH_INLINE(func,cf) \
   1.226 +  _STLP_MATH_INLINE(float,func,cf##f) \
   1.227 +  _STLP_MATH_INLINE_D(double,func,cf) \
   1.228 +  _STLP_MATH_INLINE(long double,func,cf##l)
   1.229 +#  define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.230 +  _STLP_MATH_INLINE2(float,float,func,cf##f) \
   1.231 +  _STLP_MATH_INLINE2_D(double,double,func,cf) \
   1.232 +  _STLP_MATH_INLINE2(long double,long double,func,cf##l)
   1.233 +#  define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.234 +  _STLP_MATH_INLINE2(float,float *,func,cf##f) \
   1.235 +  _STLP_MATH_INLINE2_D(double,double *,func,cf) \
   1.236 +  _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
   1.237 +#  define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.238 +  _STLP_MATH_INLINE2(float,int *,func,cf##f) \
   1.239 +  _STLP_MATH_INLINE2_D(double,int *,func,cf) \
   1.240 +  _STLP_MATH_INLINE2(long double,int *,func,cf##l)
   1.241 +#  define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.242 +  _STLP_MATH_INLINE2(float,int,func,cf##f) \
   1.243 +  _STLP_MATH_INLINE2_D(double,int,func,cf) \
   1.244 +  _STLP_MATH_INLINE2(long double,int,func,cf##l)
   1.245 +#else
   1.246 +#  if !defined (_STLP_NO_LONG_DOUBLE)
   1.247 +#    if !defined (_STLP_NO_VENDOR_MATH_F)
   1.248 +       // long double support and e.g. sinf(float) but not e.g. sinl(long double)
   1.249 +#      define _STLP_DEF_MATH_INLINE(func,cf) \
   1.250 +      _STLP_MATH_INLINE(float,func,cf##f) \
   1.251 +      _STLP_MATH_INLINEX(long double,func,cf)
   1.252 +#      define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.253 +      _STLP_MATH_INLINE2(float,float,func,cf##f) \
   1.254 +      _STLP_MATH_INLINE2XX(long double,func,cf)
   1.255 +#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.256 +      _STLP_MATH_INLINE2(float,float *,func,cf##f) \
   1.257 +      _STLP_MATH_INLINE2PX(long double,func,cf)
   1.258 +#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.259 +      _STLP_MATH_INLINE2(float,int *,func,cf##f) \
   1.260 +      _STLP_MATH_INLINE2X(long double,int *,func,cf)
   1.261 +#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.262 +      _STLP_MATH_INLINE2(float,int,func,cf##f) \
   1.263 +      _STLP_MATH_INLINE2X(long double,int,func,cf)
   1.264 +#    elif !defined (_STLP_NO_VENDOR_MATH_L)
   1.265 +       // long double support and e.g. sinl(long double) but not e.g. sinf(float)
   1.266 +#      define _STLP_DEF_MATH_INLINE(func,cf) \
   1.267 +      _STLP_MATH_INLINEX(float,func,cf) \
   1.268 +      _STLP_MATH_INLINE(long double,func,cf##l)
   1.269 +#      define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.270 +      _STLP_MATH_INLINE2XX(float,func,cf) \
   1.271 +      _STLP_MATH_INLINE2(long double,long double,func,cf##l)
   1.272 +#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.273 +      _STLP_MATH_INLINE2PX(float,func,cf) \
   1.274 +      _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
   1.275 +#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.276 +      _STLP_MATH_INLINE2X(float,int *,func,cf) \
   1.277 +      _STLP_MATH_INLINE2(long double,int *,func,cf##l)
   1.278 +#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.279 +      _STLP_MATH_INLINE2X(float,int,func,cf) \
   1.280 +      _STLP_MATH_INLINE2(long double,int,func,cf##l)
   1.281 +#    else
   1.282 +#      define _STLP_DEF_MATH_INLINE(func,cf) \
   1.283 +      _STLP_MATH_INLINEX(float,func,cf) \
   1.284 +      _STLP_MATH_INLINEX(long double,func,cf)
   1.285 +#      define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.286 +      _STLP_MATH_INLINE2XX(float,func,cf) \
   1.287 +      _STLP_MATH_INLINE2XX(long double,func,cf)
   1.288 +#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.289 +      _STLP_MATH_INLINE2PX(float,func,cf) \
   1.290 +      _STLP_MATH_INLINE2PX(long double,func,cf)
   1.291 +#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.292 +      _STLP_MATH_INLINE2X(float,int *,func,cf) \
   1.293 +      _STLP_MATH_INLINE2X(long double,int *,func,cf)
   1.294 +#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.295 +      _STLP_MATH_INLINE2X(float,int,func,cf) \
   1.296 +      _STLP_MATH_INLINE2X(long double,int,func,cf)
   1.297 +#    endif
   1.298 +#  else
   1.299 +#    if !defined (_STLP_NO_VENDOR_MATH_F)
   1.300 +#      define _STLP_DEF_MATH_INLINE(func,cf) \
   1.301 +      _STLP_MATH_INLINE(float,func,cf##f)
   1.302 +#      define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.303 +      _STLP_MATH_INLINE2(float,float,func,cf##f)
   1.304 +#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.305 +      _STLP_MATH_INLINE2(float,float *,func,cf##f)
   1.306 +#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.307 +      _STLP_MATH_INLINE2(float,int *,func,cf##f)
   1.308 +#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.309 +      _STLP_MATH_INLINE2(float,int,func,cf##f)
   1.310 +#    else // _STLP_NO_VENDOR_MATH_F
   1.311 +       // neither long double support nor e.g. sinf(float) functions
   1.312 +#      define _STLP_DEF_MATH_INLINE(func,cf) \
   1.313 +      _STLP_MATH_INLINEX(float,func,cf)
   1.314 +#      define _STLP_DEF_MATH_INLINE2(func,cf) \
   1.315 +      _STLP_MATH_INLINE2XX(float,func,cf)
   1.316 +#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
   1.317 +      _STLP_MATH_INLINE2PX(float,func,cf)
   1.318 +#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
   1.319 +      _STLP_MATH_INLINE2X(float,int *,func,cf)
   1.320 +#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
   1.321 +      _STLP_MATH_INLINE2X(float,int,func,cf)
   1.322 +#    endif // _STLP_NO_VENDOR_MATH_F
   1.323 +#  endif
   1.324 +#endif
   1.325 +
   1.326 +#if defined (_STLP_WCE) || \
   1.327 +   (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
   1.328 +/*
   1.329 + * dums: VC6 has all the required C++ functions but only define them if
   1.330 + * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
   1.331 + * thing also when _MSC_EXTENSIONS is defined.
   1.332 + * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
   1.333 + */
   1.334 +//We have to tell the compilers that abs, acos ... math functions are not intrinsic
   1.335 +//otherwise we have Internal Compiler Error in release mode...
   1.336 +#  pragma warning(push)
   1.337 +#  pragma warning(disable: 4162) // no function with C linkage found
   1.338 +#  pragma warning(disable: 4163) // not available as an intrinsic function
   1.339 +#  pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
   1.340 +#  if defined (_STLP_WCE)
   1.341 +#    pragma function (ceil, floor)
   1.342 +#  endif
   1.343 +#  define _STLP_RESTORE_FUNCTION_INTRINSIC
   1.344 +#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
   1.345 +
   1.346 +#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
   1.347 +/* In this config Borland native lib only define functions in std namespace.
   1.348 + * In order to have all overloads in STLport namespace we need to add the
   1.349 + * double overload in global namespace. We do not use a using statement to avoid
   1.350 + * import of invalid overload.
   1.351 + */
   1.352 +#  define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
   1.353 +#  define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
   1.354 +
   1.355 +_STLP_DMATH_INLINE(acos)
   1.356 +_STLP_DMATH_INLINE(asin)
   1.357 +_STLP_DMATH_INLINE(atan)
   1.358 +_STLP_DMATH_INLINE2(atan2)
   1.359 +_STLP_DMATH_INLINE(ceil)
   1.360 +_STLP_DMATH_INLINE(cos)
   1.361 +_STLP_DMATH_INLINE(cosh)
   1.362 +_STLP_DMATH_INLINE(exp)
   1.363 +_STLP_DMATH_INLINE(fabs)
   1.364 +_STLP_DMATH_INLINE(floor)
   1.365 +_STLP_DMATH_INLINE2(fmod)
   1.366 +_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
   1.367 +_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
   1.368 +_STLP_DMATH_INLINE(log)
   1.369 +_STLP_DMATH_INLINE(log10)
   1.370 +_STLP_MATH_INLINE2PX(double, modf, modf)
   1.371 +_STLP_DMATH_INLINE(sin)
   1.372 +_STLP_DMATH_INLINE(sinh)
   1.373 +_STLP_DMATH_INLINE(sqrt)
   1.374 +_STLP_DMATH_INLINE(tan)
   1.375 +_STLP_DMATH_INLINE(tanh)
   1.376 +_STLP_DMATH_INLINE2(pow)
   1.377 +_STLP_DMATH_INLINE2(hypot)
   1.378 +
   1.379 +#  undef _STLP_DMATH_INLINE
   1.380 +#  undef _STLP_DMATH_INLINE2
   1.381 +#endif
   1.382 +
   1.383 +#if defined (__DMC__)
   1.384 +#  if defined (fabs)
   1.385 +inline double __stlp_fabs(double __x) { return fabs(__x); }
   1.386 +#    undef fabs
   1.387 +inline double fabs(double __x) { return __stlp_fabs(__x); }
   1.388 +#  endif
   1.389 +#  if defined (cos)
   1.390 +inline double __stlp_cos(double __x) { return cos(__x); }
   1.391 +#    undef cos
   1.392 +inline double cos(double __x) { return __stlp_cos(__x); }
   1.393 +#  endif
   1.394 +#  if defined (sin)
   1.395 +inline double __stlp_sin(double __x) { return sin(__x); }
   1.396 +#    undef sin
   1.397 +inline double sin(double __x) { return __stlp_sin(__x); }
   1.398 +#  endif
   1.399 +#  if defined (sqrt)
   1.400 +inline double __stlp_sqrt(double __x) { return sqrt(__x); }
   1.401 +#    undef sqrt
   1.402 +inline double sqrt(double __x) { return __stlp_sqrt(__x); }
   1.403 +#  endif
   1.404 +#  if defined (ldexp)
   1.405 +inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
   1.406 +#    undef ldexp
   1.407 +inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
   1.408 +#  endif
   1.409 +#endif
   1.410 +
   1.411 +/* MSVC native lib starting with .Net 2003 has already all math functions
   1.412 + * in global namespace.
   1.413 + * HP-UX native lib has math functions in the global namespace.
   1.414 + */
   1.415 +#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
   1.416 +    (!defined (__HP_aCC) || (__HP_aCC < 30000))
   1.417 +inline double abs(double __x)
   1.418 +{ return ::fabs(__x); }
   1.419 +#  if !defined (__MVS__)
   1.420 +_STLP_DEF_MATH_INLINE(abs, fabs)
   1.421 +#  else // __MVS__ has native long double abs?
   1.422 +inline float abs(float __x) { return ::fabsf(__x); }
   1.423 +#  endif
   1.424 +
   1.425 +_STLP_DEF_MATH_INLINE(acos, acos)
   1.426 +_STLP_DEF_MATH_INLINE(asin, asin)
   1.427 +_STLP_DEF_MATH_INLINE(atan, atan)
   1.428 +_STLP_DEF_MATH_INLINE2(atan2, atan2)
   1.429 +_STLP_DEF_MATH_INLINE(ceil, ceil)
   1.430 +_STLP_DEF_MATH_INLINE(cos, cos)
   1.431 +_STLP_DEF_MATH_INLINE(cosh, cosh)
   1.432 +_STLP_DEF_MATH_INLINE(exp, exp)
   1.433 +_STLP_DEF_MATH_INLINE(fabs, fabs)
   1.434 +_STLP_DEF_MATH_INLINE(floor, floor)
   1.435 +_STLP_DEF_MATH_INLINE2(fmod, fmod)
   1.436 +_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
   1.437 +_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
   1.438 +_STLP_DEF_MATH_INLINE(log, log)
   1.439 +_STLP_DEF_MATH_INLINE(log10, log10)
   1.440 +_STLP_DEF_MATH_INLINE2P(modf, modf)
   1.441 +_STLP_DEF_MATH_INLINE(sin, sin)
   1.442 +_STLP_DEF_MATH_INLINE(sinh, sinh)
   1.443 +_STLP_DEF_MATH_INLINE(sqrt, sqrt)
   1.444 +_STLP_DEF_MATH_INLINE(tan, tan)
   1.445 +_STLP_DEF_MATH_INLINE(tanh, tanh)
   1.446 +_STLP_DEF_MATH_INLINE2(pow, pow)
   1.447 +
   1.448 +#  if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
   1.449 +#    ifndef _STLP_NO_VENDOR_MATH_F
   1.450 +#      ifndef __sun
   1.451 +inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
   1.452 +#      else
   1.453 +inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
   1.454 +#      endif
   1.455 +#    else
   1.456 +inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
   1.457 +#    endif
   1.458 +inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
   1.459 +#    if !defined (_STLP_NO_LONG_DOUBLE)
   1.460 +#      if !defined(_STLP_NO_VENDOR_MATH_L)
   1.461 +#        ifndef __sun
   1.462 +inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
   1.463 +#        else
   1.464 +#          ifndef __SUNPRO_CC
   1.465 +inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
   1.466 +#          else
   1.467 +inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
   1.468 +#          endif
   1.469 +#        endif
   1.470 +#      else
   1.471 +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))); }
   1.472 +#      endif
   1.473 +#    endif
   1.474 +#  else
   1.475 +//The MS native pow version has a bugged overload so it is not imported
   1.476 +//in the STLport namespace.
   1.477 +//Here is the bugged version:
   1.478 +//inline double pow(int __x, int __y)            { return (_Pow_int(__x, __y)); }
   1.479 +inline double      pow(double __x, int __y)      { return (_Pow_int(__x, __y)); }
   1.480 +inline float       pow(float __x, int __y)       { return (_Pow_int(__x, __y)); }
   1.481 +inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
   1.482 +#  endif
   1.483 +#endif
   1.484 +
   1.485 +#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
   1.486 +#  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
   1.487 +#    pragma warning (push)
   1.488 +#    pragma warning (disable : 4996) // hypot is deprecated.
   1.489 +#  endif
   1.490 +_STLP_MATH_INLINE2XX(float, hypot, hypot)
   1.491 +inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
   1.492 +#  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
   1.493 +#    pragma warning (pop)
   1.494 +#  endif
   1.495 +#else
   1.496 +#  if defined (_STLP_USE_UCLIBC)
   1.497 +inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
   1.498 +_STLP_DEF_MATH_INLINE2(hypot, hypot)
   1.499 +#  elif defined (_STLP_WCE)
   1.500 +   /* CE has a double _hypot(double,double) which we use */
   1.501 +inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
   1.502 +_STLP_DEF_MATH_INLINE2(hypot, _hypot)
   1.503 +#  endif
   1.504 +#endif
   1.505 +
   1.506 +#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
   1.507 +//restoration of the default intrinsic status of those functions:
   1.508 +#  pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
   1.509 +#  if defined (_STLP_WCE)
   1.510 +#    pragma intrinsic (ceil, floor)
   1.511 +#  endif
   1.512 +#  pragma warning(pop)
   1.513 +#  undef _STLP_RESTORE_FUNCTION_INTRINSIC
   1.514 +#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
   1.515 +
   1.516 +/* C++ Standard is unclear about several call to 'using ::func' if new overloads
   1.517 + * of ::func appears between 2 successive 'using' calls. To avoid this potential
   1.518 + * problem we provide all abs overload before the 'using' call.
   1.519 + * Beware: This header inclusion has to be after all abs overload of this file.
   1.520 + *         The first 'using ::abs' call is going to be in the other header.
   1.521 + */
   1.522 +#ifndef _STLP_INTERNAL_CSTDLIB
   1.523 +#  include <stl/_cstdlib.h>
   1.524 +#endif
   1.525 +
   1.526 +#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
   1.527 +_STLP_BEGIN_NAMESPACE
   1.528 +using ::abs;
   1.529 +using ::acos;
   1.530 +using ::asin;
   1.531 +using ::atan;
   1.532 +using ::atan2;
   1.533 +using ::ceil;
   1.534 +using ::cos;
   1.535 +using ::cosh;
   1.536 +using ::exp;
   1.537 +using ::fabs;
   1.538 +using ::floor;
   1.539 +using ::fmod;
   1.540 +using ::frexp;
   1.541 +using ::hypot;
   1.542 +using ::ldexp;
   1.543 +using ::log;
   1.544 +using ::log10;
   1.545 +using ::modf;
   1.546 +using ::pow;
   1.547 +using ::sin;
   1.548 +using ::sinh;
   1.549 +using ::sqrt;
   1.550 +using ::tan;
   1.551 +using ::tanh;
   1.552 +_STLP_END_NAMESPACE
   1.553 +#  if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560)
   1.554 +using _STLP_VENDOR_CSTD::_ecvt;
   1.555 +using _STLP_VENDOR_CSTD::_fcvt;
   1.556 +#  endif
   1.557 +#endif
   1.558 +
   1.559 +#endif /* _STLP_INTERNAL_CMATH */
   1.560 +
   1.561 +// Local Variables:
   1.562 +// mode:C++
   1.563 +// End: