]> git.buserror.net Git - polintos/scott/priv.git/blob - include/c++/stl/stl/_cmath.h
Add STLport 5.1.4
[polintos/scott/priv.git] / include / c++ / stl / stl / _cmath.h
1 /*
2  * Copyright (c) 1999
3  * Boris Fomitchev
4  *
5  * This material is provided "as is", with absolutely no warranty expressed
6  * or implied. Any use is at your own risk.
7  *
8  * Permission to use or copy this software for any purpose is hereby granted
9  * without fee, provided the above notices are retained on all copies.
10  * Permission to modify the code and to distribute modified code is granted,
11  * provided the above notices are retained, and a notice that the code was
12  * modified is included with the above copyright notice.
13  *
14  */
15
16 #ifndef _STLP_INTERNAL_CMATH
17 #define _STLP_INTERNAL_CMATH
18
19 /* gcc do not like when a using directive appear after a function
20  * declaration. cmath have abs overloads and cstdlib a using directive
21  * so cstdlib has to be included first.
22  */
23 #if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
24 #  include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
25 #endif
26
27 #if defined (_STLP_USE_NEW_C_HEADERS)
28 #  if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
29 #    define exception __math_exception
30 #  endif
31 #  include _STLP_NATIVE_CPP_C_HEADER(cmath)
32 #  if defined (_STLP_HAS_NO_NAMESPACES)
33 #    undef exception
34 #  endif
35 #else
36 #  include <math.h>
37 #endif
38
39 #if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
40      !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
41 #  ifndef _STLP_HAS_NO_NAMESPACES
42 namespace std {
43 #  endif
44 extern "C" double hypot(double x, double y);
45 #  ifndef _STLP_HAS_NO_NAMESPACES
46 }
47 #  endif
48
49 #endif
50
51 #if defined (__sun) && defined (__GNUC__)
52 extern "C" {
53   float __cosf(float v);
54   float __sinf(float v);
55   float __atan2f(float, float);
56   float __coshf(float v);
57   float __sinhf(float v);
58   float __sqrtf(float v);
59   float __expf(float v);
60   float __logf(float v);
61   float __log10f(float v);
62
63   long double __cosl(long double v);
64   long double __sinl(long double v);
65   long double __atan2l(long double, long double);
66   long double __coshl(long double v);
67   long double __sinhl(long double v);
68   long double __sqrtl(long double v);
69   long double __expl(long double v);
70   long double __logl(long double v);
71   long double __log10l(long double v);
72 }
73
74 extern "C" {
75   inline float cosf(float v) { return __cosf(v); }
76   inline float sinf(float v) { return __sinf(v); }
77   inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
78   inline float coshf(float v) { return __coshf(v); }
79   inline float sinhf(float v) { return __sinhf(v); }
80   inline float sqrtf(float v) { return __sqrtf(v); }
81   inline float expf(float v) { return __expf(v); }
82   inline float logf(float v) { return __logf(v); }
83   inline float log10f(float v) { return __log10f(v); }
84
85   inline long double cosl(long double v) { return __cosl(v); }
86   inline long double sinl(long double v) { return __sinl(v); }
87   inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
88   inline long double coshl(long double v) { return __coshl(v); }
89   inline long double sinhl(long double v) { return __sinhl(v); }
90   inline long double sqrtl(long double v) { return __sqrtl(v); }
91   inline long double expl(long double v) { return __expl(v); }
92   inline long double logl(long double v) { return __logl(v); }
93   inline long double log10l(long double v) { return __log10l(v); }
94 }
95 #endif // __sun && __GNUC__
96
97 #if defined (__sun)
98 extern "C" {
99 extern float __acosf(float);
100 extern float __asinf(float);
101 extern float __atanf(float);
102 extern float __atan2f(float, float);
103 extern float __ceilf(float);
104 extern float __cosf(float);
105 extern float __coshf(float);
106 extern float __expf(float);
107 extern float __fabsf(float);
108 extern float __floorf(float);
109 extern float __fmodf(float, float);
110 extern float __frexpf(float, int *);
111 extern float __ldexpf(float, int);
112 extern float __logf(float);
113 extern float __log10f(float);
114 extern float __modff(float, float *);
115 extern float __powf(float, float);
116 extern float __sinf(float);
117 extern float __sinhf(float);
118 extern float __sqrtf(float);
119 extern float __tanf(float);
120 extern float __tanhf(float);
121
122 extern long double __acosl(long double);
123 extern long double __asinl(long double);
124 extern long double __atanl(long double);
125 extern long double __atan2l(long double, long double);
126 extern long double __ceill(long double);
127 extern long double __cosl(long double);
128 extern long double __coshl(long double);
129 extern long double __expl(long double);
130 extern long double __fabsl(long double);
131 extern long double __floorl(long double);
132 extern long double __fmodl(long double, long double);
133 extern long double __frexpl(long double, int *);
134 extern long double __ldexpl(long double, int);
135 extern long double __logl(long double);
136 extern long double __log10l(long double);
137 extern long double __modfl(long double, long double *);
138 extern long double __powl(long double, long double);
139 extern long double __sinl(long double);
140 extern long double __sinhl(long double);
141 extern long double __sqrtl(long double);
142 extern long double __tanl(long double);
143 extern long double __tanhl(long double);
144 }
145 #endif
146
147 #if defined (__BORLANDC__)
148 #  define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
149 #else
150 #  define _STLP_CMATH_FUNC_NAMESPACE
151 #endif
152
153 #if !defined (__sun) || defined (__GNUC__)
154 #  define _STLP_MATH_INLINE(float_type, func, cfunc) \
155      inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
156 #  define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
157      inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
158 #  define _STLP_MATH_INLINE_D(float_type, func, cfunc)
159 #  define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
160 #else
161 #  ifdef __SUNPRO_CC
162 #    define _STLP_MATH_INLINE(float_type, func, cfunc) \
163        inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
164 #    define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
165        inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
166 #    define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
167        inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
168 #    define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
169        inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
170 #  else
171 #    error Unknown compiler for the Sun platform
172 #  endif
173 #endif
174
175 /** macros to define math functions
176 These macros (having an X somewhere in the name) forward to the C library's
177 double functions but cast the arguments and return values to the given type. */
178
179 #define _STLP_MATH_INLINEX(__type,func,cfunc) \
180   inline __type func (__type x) \
181   { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
182 #define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
183   inline __type1 func (__type1 x, __type2 y) \
184   { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
185 #define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
186   inline __type func (__type x, __type *y) { \
187     double tmp1, tmp2; \
188     tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
189     *y = __STATIC_CAST(__type, tmp2); \
190     return __STATIC_CAST(__type, tmp1); \
191   }
192 #define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
193   inline __type func (__type x, __type y) \
194   { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
195
196
197 /** rough characterization of compiler and native C library
198 For the compiler, it can either support long double or not. If it doesn't, the
199 macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
200 overloads.
201 For the native C library the question is whether it has variants with an 'f'
202 suffix (for float as opposed to double) or an 'l' suffix (for long double). If
203 the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
204 long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
205 the latter doesn't make sense anyway when the compiler already has no long
206 double support.
207
208 Those two traits determine a) which overloads get defined and b) how they are
209 defined.
210
211 Meaning of suffixes:
212 ""   : function returning and taking a float_type
213 "2"  : function returning a float_type and taking to float_types
214 "2P" : function returning a float_type and taking a float_type and a float_type*
215 "2PI": function returning a float_type and taking a float_type and an int*
216 "2I" : function returning a float_type and taking a float_Type and an int
217 */
218
219 #if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
220    // long double support and both e.g. sinl(long double) and sinf(float)
221    // This is the default for a correct and complete native library.
222 #  define _STLP_DEF_MATH_INLINE(func,cf) \
223   _STLP_MATH_INLINE(float,func,cf##f) \
224   _STLP_MATH_INLINE_D(double,func,cf) \
225   _STLP_MATH_INLINE(long double,func,cf##l)
226 #  define _STLP_DEF_MATH_INLINE2(func,cf) \
227   _STLP_MATH_INLINE2(float,float,func,cf##f) \
228   _STLP_MATH_INLINE2_D(double,double,func,cf) \
229   _STLP_MATH_INLINE2(long double,long double,func,cf##l)
230 #  define _STLP_DEF_MATH_INLINE2P(func,cf) \
231   _STLP_MATH_INLINE2(float,float *,func,cf##f) \
232   _STLP_MATH_INLINE2_D(double,double *,func,cf) \
233   _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
234 #  define _STLP_DEF_MATH_INLINE2PI(func,cf) \
235   _STLP_MATH_INLINE2(float,int *,func,cf##f) \
236   _STLP_MATH_INLINE2_D(double,int *,func,cf) \
237   _STLP_MATH_INLINE2(long double,int *,func,cf##l)
238 #  define _STLP_DEF_MATH_INLINE2I(func,cf) \
239   _STLP_MATH_INLINE2(float,int,func,cf##f) \
240   _STLP_MATH_INLINE2_D(double,int,func,cf) \
241   _STLP_MATH_INLINE2(long double,int,func,cf##l)
242 #else
243 #  if !defined (_STLP_NO_LONG_DOUBLE)
244 #    if !defined (_STLP_NO_VENDOR_MATH_F)
245        // long double support and e.g. sinf(float) but not e.g. sinl(long double)
246 #      define _STLP_DEF_MATH_INLINE(func,cf) \
247       _STLP_MATH_INLINE(float,func,cf##f) \
248       _STLP_MATH_INLINEX(long double,func,cf)
249 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
250       _STLP_MATH_INLINE2(float,float,func,cf##f) \
251       _STLP_MATH_INLINE2XX(long double,func,cf)
252 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
253       _STLP_MATH_INLINE2(float,float *,func,cf##f) \
254       _STLP_MATH_INLINE2PX(long double,func,cf)
255 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
256       _STLP_MATH_INLINE2(float,int *,func,cf##f) \
257       _STLP_MATH_INLINE2X(long double,int *,func,cf)
258 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
259       _STLP_MATH_INLINE2(float,int,func,cf##f) \
260       _STLP_MATH_INLINE2X(long double,int,func,cf)
261 #    elif !defined (_STLP_NO_VENDOR_MATH_L)
262        // long double support and e.g. sinl(long double) but not e.g. sinf(float)
263 #      define _STLP_DEF_MATH_INLINE(func,cf) \
264       _STLP_MATH_INLINEX(float,func,cf) \
265       _STLP_MATH_INLINE(long double,func,cf##l)
266 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
267       _STLP_MATH_INLINE2XX(float,func,cf) \
268       _STLP_MATH_INLINE2(long double,long double,func,cf##l)
269 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
270       _STLP_MATH_INLINE2PX(float,func,cf) \
271       _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
272 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
273       _STLP_MATH_INLINE2X(float,int *,func,cf) \
274       _STLP_MATH_INLINE2(long double,int *,func,cf##l)
275 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
276       _STLP_MATH_INLINE2X(float,int,func,cf) \
277       _STLP_MATH_INLINE2(long double,int,func,cf##l)
278 #    else
279 #      define _STLP_DEF_MATH_INLINE(func,cf) \
280       _STLP_MATH_INLINEX(float,func,cf) \
281       _STLP_MATH_INLINEX(long double,func,cf)
282 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
283       _STLP_MATH_INLINE2XX(float,func,cf) \
284       _STLP_MATH_INLINE2XX(long double,func,cf)
285 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
286       _STLP_MATH_INLINE2PX(float,func,cf) \
287       _STLP_MATH_INLINE2PX(long double,func,cf)
288 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
289       _STLP_MATH_INLINE2X(float,int *,func,cf) \
290       _STLP_MATH_INLINE2X(long double,int *,func,cf)
291 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
292       _STLP_MATH_INLINE2X(float,int,func,cf) \
293       _STLP_MATH_INLINE2X(long double,int,func,cf)
294 #    endif
295 #  else
296 #    if !defined (_STLP_NO_VENDOR_MATH_F)
297 #      define _STLP_DEF_MATH_INLINE(func,cf) \
298       _STLP_MATH_INLINE(float,func,cf##f)
299 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
300       _STLP_MATH_INLINE2(float,float,func,cf##f)
301 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
302       _STLP_MATH_INLINE2(float,float *,func,cf##f)
303 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
304       _STLP_MATH_INLINE2(float,int *,func,cf##f)
305 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
306       _STLP_MATH_INLINE2(float,int,func,cf##f)
307 #    else // _STLP_NO_VENDOR_MATH_F
308        // neither long double support nor e.g. sinf(float) functions
309 #      define _STLP_DEF_MATH_INLINE(func,cf) \
310       _STLP_MATH_INLINEX(float,func,cf)
311 #      define _STLP_DEF_MATH_INLINE2(func,cf) \
312       _STLP_MATH_INLINE2XX(float,func,cf)
313 #      define _STLP_DEF_MATH_INLINE2P(func,cf) \
314       _STLP_MATH_INLINE2PX(float,func,cf)
315 #      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
316       _STLP_MATH_INLINE2X(float,int *,func,cf)
317 #      define _STLP_DEF_MATH_INLINE2I(func,cf) \
318       _STLP_MATH_INLINE2X(float,int,func,cf)
319 #    endif // _STLP_NO_VENDOR_MATH_F
320 #  endif
321 #endif
322
323 #if defined (_STLP_WCE) || \
324    (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
325 /*
326  * dums: VC6 has all the required C++ functions but only define them if
327  * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
328  * thing also when _MSC_EXTENSIONS is defined.
329  * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
330  */
331 //We have to tell the compilers that abs, acos ... math functions are not intrinsic
332 //otherwise we have Internal Compiler Error in release mode...
333 #  pragma warning(push)
334 #  pragma warning(disable: 4162) // no function with C linkage found
335 #  pragma warning(disable: 4163) // not available as an intrinsic function
336 #  pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
337 #  if defined (_STLP_WCE)
338 #    pragma function (ceil, floor)
339 #  endif
340 #  define _STLP_RESTORE_FUNCTION_INTRINSIC
341 #endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
342
343 #if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
344 /* In this config Borland native lib only define functions in std namespace.
345  * In order to have all overloads in STLport namespace we need to add the
346  * double overload in global namespace. We do not use a using statement to avoid
347  * import of invalid overload.
348  */
349 #  define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
350 #  define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
351
352 _STLP_DMATH_INLINE(acos)
353 _STLP_DMATH_INLINE(asin)
354 _STLP_DMATH_INLINE(atan)
355 _STLP_DMATH_INLINE2(atan2)
356 _STLP_DMATH_INLINE(ceil)
357 _STLP_DMATH_INLINE(cos)
358 _STLP_DMATH_INLINE(cosh)
359 _STLP_DMATH_INLINE(exp)
360 _STLP_DMATH_INLINE(fabs)
361 _STLP_DMATH_INLINE(floor)
362 _STLP_DMATH_INLINE2(fmod)
363 _STLP_MATH_INLINE2X(double, int*, frexp, frexp)
364 _STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
365 _STLP_DMATH_INLINE(log)
366 _STLP_DMATH_INLINE(log10)
367 _STLP_MATH_INLINE2PX(double, modf, modf)
368 _STLP_DMATH_INLINE(sin)
369 _STLP_DMATH_INLINE(sinh)
370 _STLP_DMATH_INLINE(sqrt)
371 _STLP_DMATH_INLINE(tan)
372 _STLP_DMATH_INLINE(tanh)
373 _STLP_DMATH_INLINE2(pow)
374 _STLP_DMATH_INLINE2(hypot)
375
376 #  undef _STLP_DMATH_INLINE
377 #  undef _STLP_DMATH_INLINE2
378 #endif
379
380 #if defined (__DMC__)
381 #  if defined (fabs)
382 inline double __stlp_fabs(double __x) { return fabs(__x); }
383 #    undef fabs
384 inline double fabs(double __x) { return __stlp_fabs(__x); }
385 #  endif
386 #  if defined (cos)
387 inline double __stlp_cos(double __x) { return cos(__x); }
388 #    undef cos
389 inline double cos(double __x) { return __stlp_cos(__x); }
390 #  endif
391 #  if defined (sin)
392 inline double __stlp_sin(double __x) { return sin(__x); }
393 #    undef sin
394 inline double sin(double __x) { return __stlp_sin(__x); }
395 #  endif
396 #  if defined (sqrt)
397 inline double __stlp_sqrt(double __x) { return sqrt(__x); }
398 #    undef sqrt
399 inline double sqrt(double __x) { return __stlp_sqrt(__x); }
400 #  endif
401 #  if defined (ldexp)
402 inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
403 #    undef ldexp
404 inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
405 #  endif
406 #endif
407
408 /* MSVC native lib starting with .Net 2003 has already all math functions
409  * in global namespace.
410  * HP-UX native lib has math functions in the global namespace.
411  */
412 #if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
413     (!defined (__HP_aCC) || (__HP_aCC < 30000))
414 inline double abs(double __x)
415 { return ::fabs(__x); }
416 #  if !defined (__MVS__)
417 _STLP_DEF_MATH_INLINE(abs, fabs)
418 #  else // __MVS__ has native long double abs?
419 inline float abs(float __x) { return ::fabsf(__x); }
420 #  endif
421
422 _STLP_DEF_MATH_INLINE(acos, acos)
423 _STLP_DEF_MATH_INLINE(asin, asin)
424 _STLP_DEF_MATH_INLINE(atan, atan)
425 _STLP_DEF_MATH_INLINE2(atan2, atan2)
426 _STLP_DEF_MATH_INLINE(ceil, ceil)
427 _STLP_DEF_MATH_INLINE(cos, cos)
428 _STLP_DEF_MATH_INLINE(cosh, cosh)
429 _STLP_DEF_MATH_INLINE(exp, exp)
430 _STLP_DEF_MATH_INLINE(fabs, fabs)
431 _STLP_DEF_MATH_INLINE(floor, floor)
432 _STLP_DEF_MATH_INLINE2(fmod, fmod)
433 _STLP_DEF_MATH_INLINE2PI(frexp, frexp)
434 _STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
435 _STLP_DEF_MATH_INLINE(log, log)
436 _STLP_DEF_MATH_INLINE(log10, log10)
437 _STLP_DEF_MATH_INLINE2P(modf, modf)
438 _STLP_DEF_MATH_INLINE(sin, sin)
439 _STLP_DEF_MATH_INLINE(sinh, sinh)
440 _STLP_DEF_MATH_INLINE(sqrt, sqrt)
441 _STLP_DEF_MATH_INLINE(tan, tan)
442 _STLP_DEF_MATH_INLINE(tanh, tanh)
443 _STLP_DEF_MATH_INLINE2(pow, pow)
444
445 #  if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
446 #    ifndef _STLP_NO_VENDOR_MATH_F
447 #      ifndef __sun
448 inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
449 #      else
450 inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
451 #      endif
452 #    else
453 inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
454 #    endif
455 inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
456 #    if !defined (_STLP_NO_LONG_DOUBLE)
457 #      if !defined(_STLP_NO_VENDOR_MATH_L)
458 #        ifndef __sun
459 inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
460 #        else
461 #          ifndef __SUNPRO_CC
462 inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
463 #          else
464 inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
465 #          endif
466 #        endif
467 #      else
468 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))); }
469 #      endif
470 #    endif
471 #  else
472 //The MS native pow version has a bugged overload so it is not imported
473 //in the STLport namespace.
474 //Here is the bugged version:
475 //inline double pow(int __x, int __y)            { return (_Pow_int(__x, __y)); }
476 inline double      pow(double __x, int __y)      { return (_Pow_int(__x, __y)); }
477 inline float       pow(float __x, int __y)       { return (_Pow_int(__x, __y)); }
478 inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
479 #  endif
480 #endif
481
482 #if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
483 #  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
484 #    pragma warning (push)
485 #    pragma warning (disable : 4996) // hypot is deprecated.
486 #  endif
487 _STLP_MATH_INLINE2XX(float, hypot, hypot)
488 inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
489 #  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
490 #    pragma warning (pop)
491 #  endif
492 #else
493 #  if defined (_STLP_USE_UCLIBC)
494 inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
495 _STLP_DEF_MATH_INLINE2(hypot, hypot)
496 #  elif defined (_STLP_WCE)
497    /* CE has a double _hypot(double,double) which we use */
498 inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
499 _STLP_DEF_MATH_INLINE2(hypot, _hypot)
500 #  endif
501 #endif
502
503 #if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
504 //restoration of the default intrinsic status of those functions:
505 #  pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
506 #  if defined (_STLP_WCE)
507 #    pragma intrinsic (ceil, floor)
508 #  endif
509 #  pragma warning(pop)
510 #  undef _STLP_RESTORE_FUNCTION_INTRINSIC
511 #endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
512
513 /* C++ Standard is unclear about several call to 'using ::func' if new overloads
514  * of ::func appears between 2 successive 'using' calls. To avoid this potential
515  * problem we provide all abs overload before the 'using' call.
516  * Beware: This header inclusion has to be after all abs overload of this file.
517  *         The first 'using ::abs' call is going to be in the other header.
518  */
519 #ifndef _STLP_INTERNAL_CSTDLIB
520 #  include <stl/_cstdlib.h>
521 #endif
522
523 #if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
524 _STLP_BEGIN_NAMESPACE
525 using ::abs;
526 using ::acos;
527 using ::asin;
528 using ::atan;
529 using ::atan2;
530 using ::ceil;
531 using ::cos;
532 using ::cosh;
533 using ::exp;
534 using ::fabs;
535 using ::floor;
536 using ::fmod;
537 using ::frexp;
538 using ::hypot;
539 using ::ldexp;
540 using ::log;
541 using ::log10;
542 using ::modf;
543 using ::pow;
544 using ::sin;
545 using ::sinh;
546 using ::sqrt;
547 using ::tan;
548 using ::tanh;
549 _STLP_END_NAMESPACE
550 #  if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560)
551 using _STLP_VENDOR_CSTD::_ecvt;
552 using _STLP_VENDOR_CSTD::_fcvt;
553 #  endif
554 #endif
555
556 #endif /* _STLP_INTERNAL_CMATH */
557
558 // Local Variables:
559 // mode:C++
560 // End: