epoc32/include/stdapis/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/stdapis/stlport/stl/_cmath.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,210 @@
     1.4 +/*
     1.5 + * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 + *
     1.7 + * Copyright (c) 1999 
     1.8 + * Boris Fomitchev
     1.9 + *
    1.10 + * This material is provided "as is", with absolutely no warranty expressed
    1.11 + * or implied. Any use is at your own risk.
    1.12 + *
    1.13 + * Permission to use or copy this software for any purpose is hereby granted 
    1.14 + * without fee, provided the above notices are retained on all copies.
    1.15 + * Permission to modify the code and to distribute modified code is granted,
    1.16 + * provided the above notices are retained, and a notice that the code was
    1.17 + * modified is included with the above copyright notice.
    1.18 + *
    1.19 + */
    1.20 +
    1.21 +#ifndef _STLP_CMATH_H_HEADER
    1.22 +# define _STLP_CMATH_H_HEADER
    1.23 +
    1.24 +# include <cmath>
    1.25 +
    1.26 +_STLP_BEGIN_NAMESPACE
    1.27 +
    1.28 +# if defined  (_STLP_SAME_FUNCTION_NAME_RESOLUTION_BUG) && (! defined (_STLP_VXWORKS_TORNADO)) 
    1.29 +
    1.30 +// this proxy is needed for some compilers to resolve problems
    1.31 +// calling sqrt() from within sqrt(), etc.
    1.32 +template <class _Tp>
    1.33 +struct _STL_math_proxy {
    1.34 +  static inline _Tp _do_abs(const _Tp& __x)     { return _STLP_VENDOR_CSTD::fabs(__x); } 
    1.35 +  static inline _Tp _do_acos(const _Tp& __x)    { return _STLP_VENDOR_CSTD::acos(__x); } 
    1.36 +  static inline _Tp _do_asin(const _Tp& __x)    { return _STLP_VENDOR_CSTD::asin(__x); } 
    1.37 +  static inline _Tp _do_atan(const _Tp& __x)    { return _STLP_VENDOR_CSTD::atan(__x); } 
    1.38 +  static inline _Tp _do_atan2(const _Tp& __x, const _Tp& __y)  { return _STLP_VENDOR_CSTD::atan2(__x, __y); } 
    1.39 +  static inline _Tp _do_cos(const _Tp& __x)     { return _STLP_VENDOR_CSTD::cos(__x); } 
    1.40 +  static inline _Tp _do_cosh(const _Tp& __x)    { return _STLP_VENDOR_CSTD::cosh(__x); } 
    1.41 +  static inline _Tp _do_floor(const _Tp& __x)    { return _STLP_VENDOR_CSTD::floor(__x); } 
    1.42 +  static inline _Tp _do_ceil(const _Tp& __x)    { return _STLP_VENDOR_CSTD::ceil(__x); } 
    1.43 +  static inline _Tp _do_fmod(const _Tp& __x, const _Tp& __y)    { return _STLP_VENDOR_CSTD::fmod(__x, __y); } 
    1.44 +  static inline _Tp _do_frexp(const _Tp& __x, int* __y)    { return _STLP_VENDOR_CSTD::frexp(__x, __y); } 
    1.45 +  static inline _Tp _do_ldexp(const _Tp& __x, int __y)    { return _STLP_VENDOR_CSTD::ldexp(__x, __y); } 
    1.46 +  static inline _Tp _do_modf(const _Tp& __x, double* __y) { return _STLP_VENDOR_CSTD::modf(__x, __y); }
    1.47 +  static inline _Tp _do_log(const _Tp& __x)     { return _STLP_VENDOR_CSTD::log(__x); } 
    1.48 +  static inline _Tp _do_log10(const _Tp& __x)   { return _STLP_VENDOR_CSTD::log10(__x); } 
    1.49 +  static inline _Tp _do_pow(const _Tp& __x, const _Tp& __y)    { return _STLP_VENDOR_CSTD::pow(__x, __y); } 
    1.50 +  static inline _Tp _do_pow(const _Tp& __x, int __y)    { return _STLP_VENDOR_CSTD::pow(__x, __y); } 
    1.51 +  static inline _Tp _do_sin(const _Tp& __x)     { return _STLP_VENDOR_CSTD::sin(__x); } 
    1.52 +  static inline _Tp _do_sinh(const _Tp& __x)    { return _STLP_VENDOR_CSTD::sinh(__x); } 
    1.53 +
    1.54 +  static inline _Tp _do_sqrt(const _Tp& __x)    { return _STLP_VENDOR_CSTD::sqrt(__x); } 
    1.55 +  static inline _Tp _do_tan(const _Tp& __x)     { return _STLP_VENDOR_CSTD::tan(__x); } 
    1.56 +  static inline _Tp _do_tanh(const _Tp& __x)    { return _STLP_VENDOR_CSTD::tanh(__x); } 
    1.57 +  static inline _Tp _do_exp(const _Tp& __x)     { return _STLP_VENDOR_CSTD::exp(__x); } 
    1.58 +  static inline _Tp _do_hypot(const _Tp& __x, const _Tp& __y)   { return _STLP_VENDOR_CSTD::hypot(__x, __y); } 
    1.59 +};
    1.60 +
    1.61 +#  define _STLP_DO_ABS(_Tp)   _STL_math_proxy<_Tp>::_do_abs
    1.62 +#  define _STLP_DO_ACOS(_Tp)  _STL_math_proxy<_Tp>::_do_acos
    1.63 +#  define _STLP_DO_ASIN(_Tp)  _STL_math_proxy<_Tp>::_do_asin
    1.64 +#  define _STLP_DO_ATAN(_Tp)  _STL_math_proxy<_Tp>::_do_atan
    1.65 +#  define _STLP_DO_ATAN2(_Tp) _STL_math_proxy<_Tp>::_do_atan2
    1.66 +#  define _STLP_DO_COS(_Tp)   _STL_math_proxy<_Tp>::_do_cos
    1.67 +#  define _STLP_DO_COSH(_Tp)  _STL_math_proxy<_Tp>::_do_cosh
    1.68 +#  define _STLP_DO_FLOOR(_Tp) _STL_math_proxy<_Tp>::_do_floor
    1.69 +#  define _STLP_DO_CEIL(_Tp) _STL_math_proxy<_Tp>::_do_ceil
    1.70 +#  define _STLP_DO_FMOD(_Tp) _STL_math_proxy<_Tp>::_do_fmod
    1.71 +#  define _STLP_DO_FREXP(_Tp) _STL_math_proxy<_Tp>::_do_frexp
    1.72 +#  define _STLP_DO_LDEXP(_Tp) _STL_math_proxy<_Tp>::_do_ldexp
    1.73 +#  define _STLP_DO_MODF(_Tp) _STL_math_proxy<_Tp>::_do_modf
    1.74 +#  define _STLP_DO_LOG(_Tp)   _STL_math_proxy<_Tp>::_do_log
    1.75 +#  define _STLP_DO_LOG10(_Tp) _STL_math_proxy<_Tp>::_do_log10
    1.76 +#  define _STLP_DO_POW(_Tp)   _STL_math_proxy<_Tp>::_do_pow
    1.77 +#  define _STLP_DO_SIN(_Tp)   _STL_math_proxy<_Tp>::_do_sin
    1.78 +#  define _STLP_DO_SINH(_Tp)  _STL_math_proxy<_Tp>::_do_sinh
    1.79 +#  define _STLP_DO_SQRT(_Tp)  _STL_math_proxy<_Tp>::_do_sqrt
    1.80 +#  define _STLP_DO_TAN(_Tp)   _STL_math_proxy<_Tp>::_do_tan
    1.81 +#  define _STLP_DO_TANH(_Tp)  _STL_math_proxy<_Tp>::_do_tanh
    1.82 +#  define _STLP_DO_EXP(_Tp)   _STL_math_proxy<_Tp>::_do_exp
    1.83 +#  define _STLP_DO_HYPOT(_Tp) _STL_math_proxy<_Tp>::_do_hypot
    1.84 +# else
    1.85 +#  define _STLP_DO_ABS(_Tp)   _STLP_VENDOR_CSTD::fabs
    1.86 +#  define _STLP_DO_ACOS(_Tp)  _STLP_VENDOR_CSTD::acos
    1.87 +#  define _STLP_DO_ASIN(_Tp)  _STLP_VENDOR_CSTD::asin
    1.88 +#  define _STLP_DO_ATAN(_Tp)  _STLP_VENDOR_CSTD::atan
    1.89 +#  define _STLP_DO_ATAN2(_Tp) _STLP_VENDOR_CSTD::atan2
    1.90 +#  define _STLP_DO_COS(_Tp)   _STLP_VENDOR_CSTD::cos
    1.91 +#  define _STLP_DO_COSH(_Tp)  _STLP_VENDOR_CSTD::cosh
    1.92 +#  define _STLP_DO_FLOOR(_Tp)  _STLP_VENDOR_CSTD::floor
    1.93 +#  define _STLP_DO_CEIL(_Tp)   _STLP_VENDOR_CSTD::ceil
    1.94 +#  define _STLP_DO_FMOD(_Tp)   _STLP_VENDOR_CSTD::fmod
    1.95 +#  define _STLP_DO_FREXP(_Tp) _STLP_VENDOR_CSTD::frexp
    1.96 +#  define _STLP_DO_LDEXP(_Tp) _STLP_VENDOR_CSTD::ldexp
    1.97 +#  define _STLP_DO_MODF(_Tp) _STLP_VENDOR_CSTD::modf
    1.98 +#  define _STLP_DO_LOG(_Tp)   _STLP_VENDOR_CSTD::log
    1.99 +#  define _STLP_DO_LOG10(_Tp) _STLP_VENDOR_CSTD::log10
   1.100 +#  define _STLP_DO_POW(_Tp)   _STLP_VENDOR_CSTD::pow
   1.101 +#  define _STLP_DO_SIN(_Tp)   _STLP_VENDOR_CSTD::sin
   1.102 +#  define _STLP_DO_SINH(_Tp)  _STLP_VENDOR_CSTD::sinh
   1.103 +#  define _STLP_DO_SQRT(_Tp)  _STLP_VENDOR_CSTD::sqrt
   1.104 +#  define _STLP_DO_TAN(_Tp)   _STLP_VENDOR_CSTD::tan
   1.105 +#  define _STLP_DO_TANH(_Tp)  _STLP_VENDOR_CSTD::tanh
   1.106 +#  define _STLP_DO_EXP(_Tp)   _STLP_VENDOR_CSTD::exp
   1.107 +#  define _STLP_DO_HYPOT(_Tp) ::hypot
   1.108 +# endif
   1.109 +
   1.110 +_STLP_END_NAMESPACE
   1.111 +
   1.112 +# if (defined (_STLP_HAS_NO_NEW_C_HEADERS) || defined(_STLP_MSVC) || defined (__ICL)) && !defined (_STLP_HAS_NO_NAMESPACES)
   1.113 +
   1.114 +#if (! defined (_STLP_USE_NEW_C_HEADERS)) && ! defined (_STLP_VXWORKS_TORNADO)
   1.115 +_STLP_BEGIN_NAMESPACE
   1.116 +
   1.117 +#  ifndef _STLP_HAS_NATIVE_FLOAT_ABS
   1.118 +inline double abs(double __x)                 { return _STLP_DO_ABS(double)(__x); }
   1.119 +inline float abs (float __x)                  { return _STLP_DO_ABS(float)(__x); }
   1.120 +#  endif
   1.121 +
   1.122 +#if  ( defined (__SYMBIAN32__) || defined (__WINS__))
   1.123 +inline double pow(double __x, int __y)        { return _STLP_DO_POW(double)(__x, __y); }
   1.124 +inline float acos (float __x)                 { return _STLP_DO_ACOS(float)(__x); }
   1.125 +inline float asin (float __x)                 { return _STLP_DO_ASIN(float)(__x); }
   1.126 +inline float atan (float __x)                 { return _STLP_DO_ATAN(float)(__x); }
   1.127 +inline float atan2(float __x, float __y)      { return _STLP_DO_ATAN2(float)(__x, __y); }
   1.128 +inline float ceil (float __x)                 { return _STLP_DO_CEIL(float)(__x); }
   1.129 +inline float cos (float __x)                  { return _STLP_DO_COS(float)(__x); }
   1.130 +inline float cosh (float __x)                 { return _STLP_DO_COSH(float)(__x); }
   1.131 +inline float exp (float __x)                  { return _STLP_DO_EXP(float)(__x); }
   1.132 +# ifdef _STLP_USE_NAMESPACES
   1.133 +inline float fabs (float __x)                 { return _STLP_DO_ABS(float)(__x); }
   1.134 +# endif
   1.135 +inline float floor(float __x)                 { return _STLP_DO_FLOOR(float)(__x); }
   1.136 +inline float fmod (float __x, float __y)      { return _STLP_DO_FMOD(float)(__x, __y); }
   1.137 +inline float frexp(float __x, int* __y)       { return _STLP_DO_FREXP(float)(__x, __y); }
   1.138 +inline float ldexp(float __x, int __y)        { return _STLP_DO_LDEXP(float)(__x, __y); }
   1.139 +// fbp : float versions are not always available
   1.140 +#if !defined(_STLP_VENDOR_LONG_DOUBLE_MATH)		//*ty 11/25/2001 - 
   1.141 +inline float modf (float __x, float* __y)     { 
   1.142 + #ifndef __SYMBIAN32__
   1.143 +  double __dd[2]; 
   1.144 +  double __res = _STLP_DO_MODF(double)((double)__x, __dd); 
   1.145 +  __y[0] = (float)__dd[0] ; __y[1] = (float)__dd[1]; 
   1.146 +  return (float)__res; 
   1.147 +#else
   1.148 +  float f = modff(__x, __y);
   1.149 +  return f;
   1.150 +#endif    
   1.151 +}
   1.152 +#else		//*ty 11/25/2001 - i.e. for apple SCpp
   1.153 +inline float modf (float __x, float* __y)     { 
   1.154 +  long double __dd[2]; 
   1.155 +  long double __res = _STLP_DO_MODF(long double)((long double)__x, __dd); 
   1.156 +  __y[0] = (float)__dd[0] ; __y[1] = (float)__dd[1]; 
   1.157 +  return (float)__res; 
   1.158 +}
   1.159 +#endif		//*ty 11/25/2001 - 
   1.160 +
   1.161 +inline float log (float __x)                  { return _STLP_DO_LOG(float)(__x); }
   1.162 +inline float log10(float __x)                 { return _STLP_DO_LOG10(float)(__x); }
   1.163 +inline float pow (float __x, float __y)       { return _STLP_DO_POW(float)(__x, __y); }
   1.164 +inline float pow (float __x, int __y)         { return _STLP_DO_POW(float)(__x, __y); }
   1.165 +inline float sin (float __x)                  { return _STLP_DO_SIN(float)(__x); }
   1.166 +inline float sinh (float __x)                 { return _STLP_DO_SINH(float)(__x); }
   1.167 +inline float sqrt (float __x)                 { return _STLP_DO_SQRT(float)(__x); }
   1.168 +inline float tan (float __x)                  { return _STLP_DO_TAN(float)(__x); }
   1.169 +inline float tanh (float __x)                 { return _STLP_DO_TANH(float)(__x); }
   1.170 +
   1.171 +#  if ! (defined  (_STLP_NO_LONG_DOUBLE) || defined(_STLP_VENDOR_LONG_DOUBLE_MATH))
   1.172 +
   1.173 +#if !( defined (__MVS__) || defined (_STLP_HAS_NATIVE_FLOAT_ABS))
   1.174 +inline long double abs (long double __x)                  { return _STLP_DO_ABS(long double)((double)__x); }
   1.175 +#endif
   1.176 +inline long double acos (long double __x)                 { return _STLP_DO_ACOS(long double)(__x); }
   1.177 +inline long double asin (long double __x)                 { return _STLP_DO_ASIN(long double)(__x); }
   1.178 +inline long double atan (long double __x)                 { return _STLP_DO_ATAN(long double)(__x); }
   1.179 +inline long double atan2(long double __x, long double __y)      { return _STLP_DO_ATAN2(long double)(__x, __y); }
   1.180 +inline long double ceil (long double __x)                 { return _STLP_DO_CEIL(long double)(__x); }
   1.181 +inline long double cos (long double __x)                  { return _STLP_DO_COS(long double)(__x); }
   1.182 +inline long double cosh (long double __x)                 { return _STLP_DO_COSH(long double)(__x); }
   1.183 +inline long double exp (long double __x)                  { return _STLP_DO_EXP(long double)(__x); }
   1.184 +inline long double fabs (long double __x)                 { return _STLP_DO_ABS(long double)(__x); }
   1.185 +inline long double floor(long double __x)                 { return _STLP_DO_FLOOR(long double)(__x); }
   1.186 +inline long double fmod (long double __x, long double __y)      { return _STLP_DO_FMOD(long double)(__x, __y); }
   1.187 +inline long double frexp(long double __x, int* __y)       { return _STLP_DO_FREXP(long double)(__x, __y); }
   1.188 +inline long double ldexp(long double __x, int __y)        { return _STLP_DO_LDEXP(long double)(__x, __y); }
   1.189 +// fbp : long double versions are not available
   1.190 +inline long double modf (long double __x, long double* __y)     { 
   1.191 +  double __dd[2]; 
   1.192 +  double __res = _STLP_DO_MODF(double)((double)__x, __dd); 
   1.193 +  __y[0] = (long double)__dd[0] ; __y[1] = (long double)__dd[1]; 
   1.194 +  return (long double)__res; 
   1.195 +}
   1.196 +inline long double log (long double __x)                  { return _STLP_DO_LOG(long double)(__x); }
   1.197 +inline long double log10(long double __x)                 { return _STLP_DO_LOG10(long double)(__x); }
   1.198 +inline long double pow (long double __x, long double __y)       { return _STLP_DO_POW(long double)(__x, __y); }
   1.199 +inline long double pow (long double __x, int __y)         { return _STLP_DO_POW(long double)(__x, __y); }
   1.200 +inline long double sin (long double __x)                  { return _STLP_DO_SIN(long double)(__x); }
   1.201 +inline long double sinh (long double __x)                 { return _STLP_DO_SINH(long double)(__x); }
   1.202 +inline long double sqrt (long double __x)                 { return _STLP_DO_SQRT(long double)(__x); }
   1.203 +inline long double tan (long double __x)                  { return _STLP_DO_TAN(long double)(__x); }
   1.204 +inline long double tanh (long double __x)                 { return _STLP_DO_TANH(long double)(__x); }
   1.205 +#endif
   1.206 +#endif
   1.207 +
   1.208 +_STLP_END_NAMESPACE
   1.209 +
   1.210 +# endif /* NEW_C_HEADERS */
   1.211 +# endif /* NEW_C_HEADERS */
   1.212 +
   1.213 +#endif /* CMATH_H */