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