summaryrefslogtreecommitdiffstats
path: root/8/sources/cxx-stl/stlport/stlport/stl/_cmath.h
blob: 5cb0cd59becbd1dfd9d9a6b9f5e22804fffc0deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
/*
 * Copyright (c) 1999
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

#ifndef _STLP_INTERNAL_CMATH
#define _STLP_INTERNAL_CMATH

/* gcc do not like when a using directive appear after a function
 * declaration. cmath have abs overloads and cstdlib a using directive
 * so cstdlib has to be included first.
 */
#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
#  if defined (_STLP_HAS_INCLUDE_NEXT)
#    include_next <cstdlib>
#  else
#    include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
#  endif
#endif

#if defined (_STLP_USE_NEW_C_HEADERS)
#  if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
#    define exception __math_exception
#  endif
#  if defined (_STLP_HAS_INCLUDE_NEXT)
#    include_next <cmath>
#  else
#    include _STLP_NATIVE_CPP_C_HEADER(cmath)
#  endif
#  if defined (_STLP_HAS_NO_NAMESPACES)
#    undef exception
#  endif
#else
#  include <math.h>
#endif

#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
     !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
#  if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
// All the other hypot stuff is going to be at file scope, so follow along here.
namespace std {
#  endif
extern "C" double hypot(double x, double y);
#  if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
}
#  endif

#endif

#if defined (__sun) && defined (__GNUC__)
extern "C" {
  float __cosf(float v);
  float __sinf(float v);
  float __atan2f(float, float);
  float __coshf(float v);
  float __sinhf(float v);
  float __sqrtf(float v);
  float __expf(float v);
  float __logf(float v);
  float __log10f(float v);

  long double __cosl(long double v);
  long double __sinl(long double v);
  long double __atan2l(long double, long double);
  long double __coshl(long double v);
  long double __sinhl(long double v);
  long double __sqrtl(long double v);
  long double __expl(long double v);
  long double __logl(long double v);
  long double __log10l(long double v);
}

extern "C" {
  inline float cosf(float v) { return __cosf(v); }
  inline float sinf(float v) { return __sinf(v); }
  inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
  inline float coshf(float v) { return __coshf(v); }
  inline float sinhf(float v) { return __sinhf(v); }
  inline float sqrtf(float v) { return __sqrtf(v); }
  inline float expf(float v) { return __expf(v); }
  inline float logf(float v) { return __logf(v); }
  inline float log10f(float v) { return __log10f(v); }

  inline long double cosl(long double v) { return __cosl(v); }
  inline long double sinl(long double v) { return __sinl(v); }
  inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
  inline long double coshl(long double v) { return __coshl(v); }
  inline long double sinhl(long double v) { return __sinhl(v); }
  inline long double sqrtl(long double v) { return __sqrtl(v); }
  inline long double expl(long double v) { return __expl(v); }
  inline long double logl(long double v) { return __logl(v); }
  inline long double log10l(long double v) { return __log10l(v); }
}
#endif // __sun && __GNUC__

#if defined (__sun)
extern "C" {
extern float __acosf(float);
extern float __asinf(float);
extern float __atanf(float);
extern float __atan2f(float, float);
extern float __ceilf(float);
extern float __cosf(float);
extern float __coshf(float);
extern float __expf(float);
extern float __fabsf(float);
extern float __floorf(float);
extern float __fmodf(float, float);
extern float __frexpf(float, int *);
extern float __ldexpf(float, int);
extern float __logf(float);
extern float __log10f(float);
extern float __modff(float, float *);
extern float __powf(float, float);
extern float __sinf(float);
extern float __sinhf(float);
extern float __sqrtf(float);
extern float __tanf(float);
extern float __tanhf(float);

extern long double __acosl(long double);
extern long double __asinl(long double);
extern long double __atanl(long double);
extern long double __atan2l(long double, long double);
extern long double __ceill(long double);
extern long double __cosl(long double);
extern long double __coshl(long double);
extern long double __expl(long double);
extern long double __fabsl(long double);
extern long double __floorl(long double);
extern long double __fmodl(long double, long double);
extern long double __frexpl(long double, int *);
extern long double __ldexpl(long double, int);
extern long double __logl(long double);
extern long double __log10l(long double);
extern long double __modfl(long double, long double *);
extern long double __powl(long double, long double);
extern long double __sinl(long double);
extern long double __sinhl(long double);
extern long double __sqrtl(long double);
extern long double __tanl(long double);
extern long double __tanhl(long double);
}
#endif

#if defined (__BORLANDC__)
#  define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
#else
#  define _STLP_CMATH_FUNC_NAMESPACE
#endif

#if !defined (__sun) || defined (__GNUC__)
#  define _STLP_MATH_INLINE(float_type, func, cfunc) \
     inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
#  define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
     inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
#  define _STLP_MATH_INLINE_D(float_type, func, cfunc)
#  define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
#else
#  ifdef __SUNPRO_CC
#    define _STLP_MATH_INLINE(float_type, func, cfunc) \
       inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
#    define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
       inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
#    define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
       inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
#    define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
       inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
#  else
#    error Unknown compiler for the Sun platform
#  endif
#endif

/** macros to define math functions
These macros (having an X somewhere in the name) forward to the C library's
double functions but cast the arguments and return values to the given type. */

#define _STLP_MATH_INLINEX(__type,func,cfunc) \
  inline __type func (__type x) \
  { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
  inline __type1 func (__type1 x, __type2 y) \
  { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
  inline __type func (__type x, __type *y) { \
    double tmp1, tmp2; \
    tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
    *y = __STATIC_CAST(__type, tmp2); \
    return __STATIC_CAST(__type, tmp1); \
  }
#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
  inline __type func (__type x, __type y) \
  { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }


/** rough characterization of compiler and native C library
For the compiler, it can either support long double or not. If it doesn't, the
macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
overloads.
For the native C library the question is whether it has variants with an 'f'
suffix (for float as opposed to double) or an 'l' suffix (for long double). If
the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
the latter doesn't make sense anyway when the compiler already has no long
double support.

Those two traits determine a) which overloads get defined and b) how they are
defined.

Meaning of suffixes:
""   : function returning and taking a float_type
"2"  : function returning a float_type and taking to float_types
"2P" : function returning a float_type and taking a float_type and a float_type*
"2PI": function returning a float_type and taking a float_type and an int*
"2I" : function returning a float_type and taking a float_Type and an int
*/

#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
   // long double support and both e.g. sinl(long double) and sinf(float)
   // This is the default for a correct and complete native library.
#  define _STLP_DEF_MATH_INLINE(func,cf) \
  _STLP_MATH_INLINE(float,func,cf##f) \
  _STLP_MATH_INLINE_D(double,func,cf) \
  _STLP_MATH_INLINE(long double,func,cf##l)
#  define _STLP_DEF_MATH_INLINE2(func,cf) \
  _STLP_MATH_INLINE2(float,float,func,cf##f) \
  _STLP_MATH_INLINE2_D(double,double,func,cf) \
  _STLP_MATH_INLINE2(long double,long double,func,cf##l)
#  define _STLP_DEF_MATH_INLINE2P(func,cf) \
  _STLP_MATH_INLINE2(float,float *,func,cf##f) \
  _STLP_MATH_INLINE2_D(double,double *,func,cf) \
  _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
#  define _STLP_DEF_MATH_INLINE2PI(func,cf) \
  _STLP_MATH_INLINE2(float,int *,func,cf##f) \
  _STLP_MATH_INLINE2_D(double,int *,func,cf) \
  _STLP_MATH_INLINE2(long double,int *,func,cf##l)
#  define _STLP_DEF_MATH_INLINE2I(func,cf) \
  _STLP_MATH_INLINE2(float,int,func,cf##f) \
  _STLP_MATH_INLINE2_D(double,int,func,cf) \
  _STLP_MATH_INLINE2(long double,int,func,cf##l)
#else
#  if !defined (_STLP_NO_LONG_DOUBLE)
#    if !defined (_STLP_NO_VENDOR_MATH_F)
       // long double support and e.g. sinf(float) but not e.g. sinl(long double)
#      define _STLP_DEF_MATH_INLINE(func,cf) \
      _STLP_MATH_INLINE(float,func,cf##f) \
      _STLP_MATH_INLINEX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2(func,cf) \
      _STLP_MATH_INLINE2(float,float,func,cf##f) \
      _STLP_MATH_INLINE2XX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
      _STLP_MATH_INLINE2(float,float *,func,cf##f) \
      _STLP_MATH_INLINE2PX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
      _STLP_MATH_INLINE2(float,int *,func,cf##f) \
      _STLP_MATH_INLINE2X(long double,int *,func,cf)
#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
      _STLP_MATH_INLINE2(float,int,func,cf##f) \
      _STLP_MATH_INLINE2X(long double,int,func,cf)
#    elif !defined (_STLP_NO_VENDOR_MATH_L)
       // long double support and e.g. sinl(long double) but not e.g. sinf(float)
#      define _STLP_DEF_MATH_INLINE(func,cf) \
      _STLP_MATH_INLINEX(float,func,cf) \
      _STLP_MATH_INLINE(long double,func,cf##l)
#      define _STLP_DEF_MATH_INLINE2(func,cf) \
      _STLP_MATH_INLINE2XX(float,func,cf) \
      _STLP_MATH_INLINE2(long double,long double,func,cf##l)
#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
      _STLP_MATH_INLINE2PX(float,func,cf) \
      _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
      _STLP_MATH_INLINE2X(float,int *,func,cf) \
      _STLP_MATH_INLINE2(long double,int *,func,cf##l)
#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
      _STLP_MATH_INLINE2X(float,int,func,cf) \
      _STLP_MATH_INLINE2(long double,int,func,cf##l)
#    else
#      define _STLP_DEF_MATH_INLINE(func,cf) \
      _STLP_MATH_INLINEX(float,func,cf) \
      _STLP_MATH_INLINEX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2(func,cf) \
      _STLP_MATH_INLINE2XX(float,func,cf) \
      _STLP_MATH_INLINE2XX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
      _STLP_MATH_INLINE2PX(float,func,cf) \
      _STLP_MATH_INLINE2PX(long double,func,cf)
#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
      _STLP_MATH_INLINE2X(float,int *,func,cf) \
      _STLP_MATH_INLINE2X(long double,int *,func,cf)
#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
      _STLP_MATH_INLINE2X(float,int,func,cf) \
      _STLP_MATH_INLINE2X(long double,int,func,cf)
#    endif
#  else
#    if !defined (_STLP_NO_VENDOR_MATH_F)
#      define _STLP_DEF_MATH_INLINE(func,cf) \
      _STLP_MATH_INLINE(float,func,cf##f)
#      define _STLP_DEF_MATH_INLINE2(func,cf) \
      _STLP_MATH_INLINE2(float,float,func,cf##f)
#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
      _STLP_MATH_INLINE2(float,float *,func,cf##f)
#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
      _STLP_MATH_INLINE2(float,int *,func,cf##f)
#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
      _STLP_MATH_INLINE2(float,int,func,cf##f)
#    else // _STLP_NO_VENDOR_MATH_F
       // neither long double support nor e.g. sinf(float) functions
#      define _STLP_DEF_MATH_INLINE(func,cf) \
      _STLP_MATH_INLINEX(float,func,cf)
#      define _STLP_DEF_MATH_INLINE2(func,cf) \
      _STLP_MATH_INLINE2XX(float,func,cf)
#      define _STLP_DEF_MATH_INLINE2P(func,cf) \
      _STLP_MATH_INLINE2PX(float,func,cf)
#      define _STLP_DEF_MATH_INLINE2PI(func,cf) \
      _STLP_MATH_INLINE2X(float,int *,func,cf)
#      define _STLP_DEF_MATH_INLINE2I(func,cf) \
      _STLP_MATH_INLINE2X(float,int,func,cf)
#    endif // _STLP_NO_VENDOR_MATH_F
#  endif
#endif

#if defined (_STLP_WCE) || \
   (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
/*
 * dums: VC6 has all the required C++ functions but only define them if
 * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
 * thing also when _MSC_EXTENSIONS is defined.
 * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
 */
//We have to tell the compilers that abs, acos ... math functions are not intrinsic
//otherwise we have Internal Compiler Error in release mode...
#  pragma warning(push)
#  pragma warning(disable: 4162) // no function with C linkage found
#  pragma warning(disable: 4163) // not available as an intrinsic function
#  pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
#  if defined (_STLP_WCE)
#    pragma function (ceil, floor)
#  endif
#  define _STLP_RESTORE_FUNCTION_INTRINSIC
#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS

#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS)
/* In this config Borland native lib only define functions in std namespace.
 * In order to have all overloads in STLport namespace we need to add the
 * double overload in global namespace. We do not use a using statement to avoid
 * import of invalid overload.
 */
#  define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
#  define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)

_STLP_DMATH_INLINE(acos)
_STLP_DMATH_INLINE(asin)
_STLP_DMATH_INLINE(atan)
_STLP_DMATH_INLINE2(atan2)
_STLP_DMATH_INLINE(ceil)
_STLP_DMATH_INLINE(cos)
_STLP_DMATH_INLINE(cosh)
_STLP_DMATH_INLINE(exp)
_STLP_DMATH_INLINE(fabs)
_STLP_DMATH_INLINE(floor)
_STLP_DMATH_INLINE2(fmod)
_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
_STLP_DMATH_INLINE(log)
_STLP_DMATH_INLINE(log10)
_STLP_MATH_INLINE2PX(double, modf, modf)
_STLP_DMATH_INLINE(sin)
_STLP_DMATH_INLINE(sinh)
_STLP_DMATH_INLINE(sqrt)
_STLP_DMATH_INLINE(tan)
_STLP_DMATH_INLINE(tanh)
_STLP_DMATH_INLINE2(pow)
_STLP_DMATH_INLINE2(hypot)

#  undef _STLP_DMATH_INLINE
#  undef _STLP_DMATH_INLINE2
#endif

#if defined (__DMC__)
#  if defined (fabs)
inline double __stlp_fabs(double __x) { return fabs(__x); }
#    undef fabs
inline double fabs(double __x) { return __stlp_fabs(__x); }
#  endif
#  if defined (cos)
inline double __stlp_cos(double __x) { return cos(__x); }
#    undef cos
inline double cos(double __x) { return __stlp_cos(__x); }
#  endif
#  if defined (sin)
inline double __stlp_sin(double __x) { return sin(__x); }
#    undef sin
inline double sin(double __x) { return __stlp_sin(__x); }
#  endif
#  if defined (sqrt)
inline double __stlp_sqrt(double __x) { return sqrt(__x); }
#    undef sqrt
inline double sqrt(double __x) { return __stlp_sqrt(__x); }
#  endif
#  if defined (ldexp)
inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
#    undef ldexp
inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
#  endif
#endif

/* MSVC native lib starting with .Net 2003 has already all math functions
 * in global namespace.
 * HP-UX native lib has math functions in the global namespace.
 */
#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
    (!defined (__HP_aCC) || (__HP_aCC < 30000)) && \
    !defined (__WATCOMC__)
inline double abs(double __x)
{ return ::fabs(__x); }
#  if !defined (__MVS__)
_STLP_DEF_MATH_INLINE(abs, fabs)
#  else // __MVS__ has native long double abs?
inline float abs(float __x) { return ::fabsf(__x); }
#  endif

_STLP_DEF_MATH_INLINE(acos, acos)
_STLP_DEF_MATH_INLINE(asin, asin)
_STLP_DEF_MATH_INLINE(atan, atan)
_STLP_DEF_MATH_INLINE2(atan2, atan2)
_STLP_DEF_MATH_INLINE(ceil, ceil)
_STLP_DEF_MATH_INLINE(cos, cos)
_STLP_DEF_MATH_INLINE(cosh, cosh)
_STLP_DEF_MATH_INLINE(exp, exp)
_STLP_DEF_MATH_INLINE(fabs, fabs)
_STLP_DEF_MATH_INLINE(floor, floor)
_STLP_DEF_MATH_INLINE2(fmod, fmod)
_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
_STLP_DEF_MATH_INLINE(log, log)
_STLP_DEF_MATH_INLINE(log10, log10)
_STLP_DEF_MATH_INLINE2P(modf, modf)
_STLP_DEF_MATH_INLINE(sin, sin)
_STLP_DEF_MATH_INLINE(sinh, sinh)
_STLP_DEF_MATH_INLINE(sqrt, sqrt)
_STLP_DEF_MATH_INLINE(tan, tan)
_STLP_DEF_MATH_INLINE(tanh, tanh)
_STLP_DEF_MATH_INLINE2(pow, pow)

#  if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
#    ifndef _STLP_NO_VENDOR_MATH_F
#      ifndef __sun
inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
#      else
inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
#      endif
#    else
inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
#    endif
inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
#    if !defined (_STLP_NO_LONG_DOUBLE)
#      if !defined(_STLP_NO_VENDOR_MATH_L)
#        ifndef __sun
inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
#        else
#          ifndef __SUNPRO_CC
inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
#          else
inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
#          endif
#        endif
#      else
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))); }
#      endif
#    endif
#  else
//The MS native pow version has a bugged overload so it is not imported
//in the STLport namespace.
//Here is the bugged version:
//inline double pow(int __x, int __y)            { return (_Pow_int(__x, __y)); }
inline double      pow(double __x, int __y)      { return (_Pow_int(__x, __y)); }
inline float       pow(float __x, int __y)       { return (_Pow_int(__x, __y)); }
inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
#  endif
#endif

#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
#  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
#    pragma warning (push)
#    pragma warning (disable : 4996) // hypot is deprecated.
#  endif
_STLP_MATH_INLINE2XX(float, hypot, hypot)
inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
#  if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
#    pragma warning (pop)
#  endif
#else
#  if defined (_STLP_USE_UCLIBC)
inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
_STLP_DEF_MATH_INLINE2(hypot, hypot)
#  elif defined (_STLP_WCE)
   /* CE has a double _hypot(double,double) which we use */
inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
_STLP_DEF_MATH_INLINE2(hypot, _hypot)
#  endif
#endif

#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
//restoration of the default intrinsic status of those functions:
#  pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
#  if defined (_STLP_WCE)
#    pragma intrinsic (ceil, floor)
#  endif
#  pragma warning(pop)
#  undef _STLP_RESTORE_FUNCTION_INTRINSIC
#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS

/* C++ Standard is unclear about several call to 'using ::func' if new overloads
 * of ::func appears between 2 successive 'using' calls. To avoid this potential
 * problem we provide all abs overload before the 'using' call.
 * Beware: This header inclusion has to be after all abs overload of this file.
 *         The first 'using ::abs' call is going to be in the other header.
 */
#ifndef _STLP_INTERNAL_CSTDLIB
#  include <stl/_cstdlib.h>
#endif

#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
#if defined (__ANDROID__)
namespace __captured {
template<typename _Tp> inline int __capture_isfinite(_Tp __f) { return isfinite(__f); }
template<typename _Tp> inline int __capture_isinf(_Tp __f) { return isinf(__f); }
template<typename _Tp> inline int __capture_isnan(_Tp __f) { return isnan(__f); }
template<typename _Tp> inline int __capture_signbit(_Tp __f) { return signbit(__f); }
}
#undef isfinite
#undef isinf
#undef isnan
#undef signbit
namespace __captured {
template<typename _Tp> inline int isfinite(_Tp __f) { return __capture_isfinite(__f); }
template<typename _Tp> inline int isinf(_Tp __f) { return __capture_isinf(__f); }
template<typename _Tp> inline int isnan(_Tp __f) { return __capture_isnan(__f); }
template<typename _Tp> inline int signbit(_Tp __f) { return __capture_signbit(__f); }
}
#endif
_STLP_BEGIN_NAMESPACE
using ::abs;
using ::acos;
using ::asin;
using ::atan;
using ::atan2;
using ::ceil;
using ::cos;
using ::cosh;
using ::exp;
using ::fabs;
using ::floor;
using ::fmod;
using ::frexp;
/*
   Because of some weird interaction between STLport headers
   and native HP-UX headers, when compiled with _STLP_DEBUG
   macro defined with aC++, hypot() is not declared.
   At some point we'll need to get to the bottom line of
   this problem.
*/
#if !(defined(__HP_aCC) && defined(_STLP_DEBUG))
using ::hypot;
#endif
#if defined (__ANDROID__)
using __captured::isfinite;
using __captured::isinf;
using __captured::isnan;
#endif
using ::ldexp;
using ::log;
using ::log10;
using ::modf;
using ::pow;
#if defined (__ANDROID__)
using __captured::signbit;
#endif
using ::sin;
using ::sinh;
using ::sqrt;
using ::tan;
using ::tanh;
_STLP_END_NAMESPACE
#  if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560) && !defined (__linux__)
using _STLP_VENDOR_CSTD::_ecvt;
using _STLP_VENDOR_CSTD::_fcvt;
#  endif
#endif

#endif /* _STLP_INTERNAL_CMATH */

// Local Variables:
// mode:C++
// End: