]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/libc++/include/cmath
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / libc++ / include / cmath
1 // -*- C++ -*-
2 //===---------------------------- cmath -----------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef _LIBCPP_CMATH
12 #define _LIBCPP_CMATH
13
14 /*
15     cmath synopsis
16
17 Macros:
18
19     HUGE_VAL
20     HUGE_VALF               // C99
21     HUGE_VALL               // C99
22     INFINITY                // C99
23     NAN                     // C99
24     FP_INFINITE             // C99
25     FP_NAN                  // C99
26     FP_NORMAL               // C99
27     FP_SUBNORMAL            // C99
28     FP_ZERO                 // C99
29     FP_FAST_FMA             // C99
30     FP_FAST_FMAF            // C99
31     FP_FAST_FMAL            // C99
32     FP_ILOGB0               // C99
33     FP_ILOGBNAN             // C99
34     MATH_ERRNO              // C99
35     MATH_ERREXCEPT          // C99
36     math_errhandling        // C99
37
38 namespace std
39 {
40
41 Types:
42
43     float_t                 // C99
44     double_t                // C99
45
46 // C90
47
48 floating_point abs(floating_point x);
49
50 floating_point acos (arithmetic x);
51 float          acosf(float x);
52 long double    acosl(long double x);
53
54 floating_point asin (arithmetic x);
55 float          asinf(float x);
56 long double    asinl(long double x);
57
58 floating_point atan (arithmetic x);
59 float          atanf(float x);
60 long double    atanl(long double x);
61
62 floating_point atan2 (arithmetic y, arithmetic x);
63 float          atan2f(float y, float x);
64 long double    atan2l(long double y, long double x);
65
66 floating_point ceil (arithmetic x);
67 float          ceilf(float x);
68 long double    ceill(long double x);
69
70 floating_point cos (arithmetic x);
71 float          cosf(float x);
72 long double    cosl(long double x);
73
74 floating_point cosh (arithmetic x);
75 float          coshf(float x);
76 long double    coshl(long double x);
77
78 floating_point exp (arithmetic x);
79 float          expf(float x);
80 long double    expl(long double x);
81
82 floating_point fabs (arithmetic x);
83 float          fabsf(float x);
84 long double    fabsl(long double x);
85
86 floating_point floor (arithmetic x);
87 float          floorf(float x);
88 long double    floorl(long double x);
89
90 floating_point fmod (arithmetic x, arithmetic y);
91 float          fmodf(float x, float y);
92 long double    fmodl(long double x, long double y);
93
94 floating_point frexp (arithmetic value, int* exp);
95 float          frexpf(float value, int* exp);
96 long double    frexpl(long double value, int* exp);
97
98 floating_point ldexp (arithmetic value, int exp);
99 float          ldexpf(float value, int exp);
100 long double    ldexpl(long double value, int exp);
101
102 floating_point log (arithmetic x);
103 float          logf(float x);
104 long double    logl(long double x);
105
106 floating_point log10 (arithmetic x);
107 float          log10f(float x);
108 long double    log10l(long double x);
109
110 floating_point modf (floating_point value, floating_point* iptr);
111 float          modff(float value, float* iptr);
112 long double    modfl(long double value, long double* iptr);
113
114 floating_point pow (arithmetic x, arithmetic y);
115 float          powf(float x, float y);
116 long double    powl(long double x, long double y);
117
118 floating_point sin (arithmetic x);
119 float          sinf(float x);
120 long double    sinl(long double x);
121
122 floating_point sinh (arithmetic x);
123 float          sinhf(float x);
124 long double    sinhl(long double x);
125
126 floating_point sqrt (arithmetic x);
127 float          sqrtf(float x);
128 long double    sqrtl(long double x);
129
130 floating_point tan (arithmetic x);
131 float          tanf(float x);
132 long double    tanl(long double x);
133
134 floating_point tanh (arithmetic x);
135 float          tanhf(float x);
136 long double    tanhl(long double x);
137
138 //  C99
139
140 bool signbit(arithmetic x);
141
142 int fpclassify(arithmetic x);
143
144 bool isfinite(arithmetic x);
145 bool isinf(arithmetic x);
146 bool isnan(arithmetic x);
147 bool isnormal(arithmetic x);
148
149 bool isgreater(arithmetic x, arithmetic y);
150 bool isgreaterequal(arithmetic x, arithmetic y);
151 bool isless(arithmetic x, arithmetic y);
152 bool islessequal(arithmetic x, arithmetic y);
153 bool islessgreater(arithmetic x, arithmetic y);
154 bool isunordered(arithmetic x, arithmetic y);
155
156 floating_point acosh (arithmetic x);
157 float          acoshf(float x);
158 long double    acoshl(long double x);
159
160 floating_point asinh (arithmetic x);
161 float          asinhf(float x);
162 long double    asinhl(long double x);
163
164 floating_point atanh (arithmetic x);
165 float          atanhf(float x);
166 long double    atanhl(long double x);
167
168 floating_point cbrt (arithmetic x);
169 float          cbrtf(float x);
170 long double    cbrtl(long double x);
171
172 floating_point copysign (arithmetic x, arithmetic y);
173 float          copysignf(float x, float y);
174 long double    copysignl(long double x, long double y);
175
176 floating_point erf (arithmetic x);
177 float          erff(float x);
178 long double    erfl(long double x);
179
180 floating_point erfc (arithmetic x);
181 float          erfcf(float x);
182 long double    erfcl(long double x);
183
184 floating_point exp2 (arithmetic x);
185 float          exp2f(float x);
186 long double    exp2l(long double x);
187
188 floating_point expm1 (arithmetic x);
189 float          expm1f(float x);
190 long double    expm1l(long double x);
191
192 floating_point fdim (arithmetic x, arithmetic y);
193 float          fdimf(float x, float y);
194 long double    fdiml(long double x, long double y);
195
196 floating_point fma (arithmetic x, arithmetic y, arithmetic z);
197 float          fmaf(float x, float y, float z);
198 long double    fmal(long double x, long double y, long double z);
199
200 floating_point fmax (arithmetic x, arithmetic y);
201 float          fmaxf(float x, float y);
202 long double    fmaxl(long double x, long double y);
203
204 floating_point fmin (arithmetic x, arithmetic y);
205 float          fminf(float x, float y);
206 long double    fminl(long double x, long double y);
207
208 floating_point hypot (arithmetic x, arithmetic y);
209 float          hypotf(float x, float y);
210 long double    hypotl(long double x, long double y);
211
212 int ilogb (arithmetic x);
213 int ilogbf(float x);
214 int ilogbl(long double x);
215
216 floating_point lgamma (arithmetic x);
217 float          lgammaf(float x);
218 long double    lgammal(long double x);
219
220 long long llrint (arithmetic x);
221 long long llrintf(float x);
222 long long llrintl(long double x);
223
224 long long llround (arithmetic x);
225 long long llroundf(float x);
226 long long llroundl(long double x);
227
228 floating_point log1p (arithmetic x);
229 float          log1pf(float x);
230 long double    log1pl(long double x);
231
232 floating_point log2 (arithmetic x);
233 float          log2f(float x);
234 long double    log2l(long double x);
235
236 floating_point logb (arithmetic x);
237 float          logbf(float x);
238 long double    logbl(long double x);
239
240 long lrint (arithmetic x);
241 long lrintf(float x);
242 long lrintl(long double x);
243
244 long lround (arithmetic x);
245 long lroundf(float x);
246 long lroundl(long double x);
247
248 double      nan (const char* str);
249 float       nanf(const char* str);
250 long double nanl(const char* str);
251
252 floating_point nearbyint (arithmetic x);
253 float          nearbyintf(float x);
254 long double    nearbyintl(long double x);
255
256 floating_point nextafter (arithmetic x, arithmetic y);
257 float          nextafterf(float x, float y);
258 long double    nextafterl(long double x, long double y);
259
260 floating_point nexttoward (arithmetic x, long double y);
261 float          nexttowardf(float x, long double y);
262 long double    nexttowardl(long double x, long double y);
263
264 floating_point remainder (arithmetic x, arithmetic y);
265 float          remainderf(float x, float y);
266 long double    remainderl(long double x, long double y);
267
268 floating_point remquo (arithmetic x, arithmetic y, int* pquo);
269 float          remquof(float x, float y, int* pquo);
270 long double    remquol(long double x, long double y, int* pquo);
271
272 floating_point rint (arithmetic x);
273 float          rintf(float x);
274 long double    rintl(long double x);
275
276 floating_point round (arithmetic x);
277 float          roundf(float x);
278 long double    roundl(long double x);
279
280 floating_point scalbln (arithmetic x, long ex);
281 float          scalblnf(float x, long ex);
282 long double    scalblnl(long double x, long ex);
283
284 floating_point scalbn (arithmetic x, int ex);
285 float          scalbnf(float x, int ex);
286 long double    scalbnl(long double x, int ex);
287
288 floating_point tgamma (arithmetic x);
289 float          tgammaf(float x);
290 long double    tgammal(long double x);
291
292 floating_point trunc (arithmetic x);
293 float          truncf(float x);
294 long double    truncl(long double x);
295
296 }  // std
297
298 */
299
300 #include <__config>
301 #include <math.h>
302 #include <type_traits>
303
304 #ifdef _MSC_VER
305 #include "support/win32/math_win32.h"
306 #endif
307
308 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
309 #pragma GCC system_header
310 #endif
311
312 // signbit
313
314 #ifdef signbit
315
316 template <class _A1>
317 _LIBCPP_ALWAYS_INLINE
318 bool
319 __libcpp_signbit(_A1 __x) _NOEXCEPT
320 {
321     return signbit(__x);
322 }
323
324 #undef signbit
325
326 template <class _A1>
327 inline _LIBCPP_INLINE_VISIBILITY
328 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
329 signbit(_A1 __x) _NOEXCEPT
330 {
331     return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
332 }
333
334 #endif  // signbit
335
336 // fpclassify
337
338 #ifdef fpclassify
339
340 template <class _A1>
341 _LIBCPP_ALWAYS_INLINE
342 int
343 __libcpp_fpclassify(_A1 __x) _NOEXCEPT
344 {
345     return fpclassify(__x);
346 }
347
348 #undef fpclassify
349
350 template <class _A1>
351 inline _LIBCPP_INLINE_VISIBILITY
352 typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
353 fpclassify(_A1 __x) _NOEXCEPT
354 {
355     return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
356 }
357
358 #endif  // fpclassify
359
360 // isfinite
361
362 #ifdef isfinite
363
364 template <class _A1>
365 _LIBCPP_ALWAYS_INLINE
366 bool
367 __libcpp_isfinite(_A1 __x) _NOEXCEPT
368 {
369     return isfinite(__x);
370 }
371
372 #undef isfinite
373
374 template <class _A1>
375 inline _LIBCPP_INLINE_VISIBILITY
376 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
377 isfinite(_A1 __x) _NOEXCEPT
378 {
379     return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
380 }
381
382 #endif  // isfinite
383
384 // isinf
385
386 #ifdef isinf
387
388 template <class _A1>
389 _LIBCPP_ALWAYS_INLINE
390 bool
391 __libcpp_isinf(_A1 __x) _NOEXCEPT
392 {
393     return isinf(__x);
394 }
395
396 #undef isinf
397
398 template <class _A1>
399 inline _LIBCPP_INLINE_VISIBILITY
400 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
401 isinf(_A1 __x) _NOEXCEPT
402 {
403     return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
404 }
405
406 #endif  // isinf
407
408 // isnan
409
410 #ifdef isnan
411
412 template <class _A1>
413 _LIBCPP_ALWAYS_INLINE
414 bool
415 __libcpp_isnan(_A1 __x) _NOEXCEPT
416 {
417     return isnan(__x);
418 }
419
420 #undef isnan
421
422 template <class _A1>
423 inline _LIBCPP_INLINE_VISIBILITY
424 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
425 isnan(_A1 __x) _NOEXCEPT
426 {
427     return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
428 }
429
430 #endif  // isnan
431
432 // isnormal
433
434 #ifdef isnormal
435
436 template <class _A1>
437 _LIBCPP_ALWAYS_INLINE
438 bool
439 __libcpp_isnormal(_A1 __x) _NOEXCEPT
440 {
441     return isnormal(__x);
442 }
443
444 #undef isnormal
445
446 template <class _A1>
447 inline _LIBCPP_INLINE_VISIBILITY
448 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
449 isnormal(_A1 __x) _NOEXCEPT
450 {
451     return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
452 }
453
454 #endif  // isnormal
455
456 // isgreater
457
458 #ifdef isgreater
459
460 template <class _A1, class _A2>
461 _LIBCPP_ALWAYS_INLINE
462 bool
463 __libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
464 {
465     return isgreater(__x, __y);
466 }
467
468 #undef isgreater
469
470 template <class _A1, class _A2>
471 inline _LIBCPP_INLINE_VISIBILITY
472 typename std::enable_if
473 <
474     std::is_arithmetic<_A1>::value &&
475     std::is_arithmetic<_A2>::value,
476     bool
477 >::type
478 isgreater(_A1 __x, _A2 __y) _NOEXCEPT
479 {
480     typedef typename std::__promote<_A1, _A2>::type type;
481     return __libcpp_isgreater((type)__x, (type)__y);
482 }
483
484 #endif  // isgreater
485
486 // isgreaterequal
487
488 #ifdef isgreaterequal
489
490 template <class _A1, class _A2>
491 _LIBCPP_ALWAYS_INLINE
492 bool
493 __libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
494 {
495     return isgreaterequal(__x, __y);
496 }
497
498 #undef isgreaterequal
499
500 template <class _A1, class _A2>
501 inline _LIBCPP_INLINE_VISIBILITY
502 typename std::enable_if
503 <
504     std::is_arithmetic<_A1>::value &&
505     std::is_arithmetic<_A2>::value,
506     bool
507 >::type
508 isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
509 {
510     typedef typename std::__promote<_A1, _A2>::type type;
511     return __libcpp_isgreaterequal((type)__x, (type)__y);
512 }
513
514 #endif  // isgreaterequal
515
516 // isless
517
518 #ifdef isless
519
520 template <class _A1, class _A2>
521 _LIBCPP_ALWAYS_INLINE
522 bool
523 __libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
524 {
525     return isless(__x, __y);
526 }
527
528 #undef isless
529
530 template <class _A1, class _A2>
531 inline _LIBCPP_INLINE_VISIBILITY
532 typename std::enable_if
533 <
534     std::is_arithmetic<_A1>::value &&
535     std::is_arithmetic<_A2>::value,
536     bool
537 >::type
538 isless(_A1 __x, _A2 __y) _NOEXCEPT
539 {
540     typedef typename std::__promote<_A1, _A2>::type type;
541     return __libcpp_isless((type)__x, (type)__y);
542 }
543
544 #endif  // isless
545
546 // islessequal
547
548 #ifdef islessequal
549
550 template <class _A1, class _A2>
551 _LIBCPP_ALWAYS_INLINE
552 bool
553 __libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
554 {
555     return islessequal(__x, __y);
556 }
557
558 #undef islessequal
559
560 template <class _A1, class _A2>
561 inline _LIBCPP_INLINE_VISIBILITY
562 typename std::enable_if
563 <
564     std::is_arithmetic<_A1>::value &&
565     std::is_arithmetic<_A2>::value,
566     bool
567 >::type
568 islessequal(_A1 __x, _A2 __y) _NOEXCEPT
569 {
570     typedef typename std::__promote<_A1, _A2>::type type;
571     return __libcpp_islessequal((type)__x, (type)__y);
572 }
573
574 #endif  // islessequal
575
576 // islessgreater
577
578 #ifdef islessgreater
579
580 template <class _A1, class _A2>
581 _LIBCPP_ALWAYS_INLINE
582 bool
583 __libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
584 {
585     return islessgreater(__x, __y);
586 }
587
588 #undef islessgreater
589
590 template <class _A1, class _A2>
591 inline _LIBCPP_INLINE_VISIBILITY
592 typename std::enable_if
593 <
594     std::is_arithmetic<_A1>::value &&
595     std::is_arithmetic<_A2>::value,
596     bool
597 >::type
598 islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
599 {
600     typedef typename std::__promote<_A1, _A2>::type type;
601     return __libcpp_islessgreater((type)__x, (type)__y);
602 }
603
604 #endif  // islessgreater
605
606 // isunordered
607
608 #ifdef isunordered
609
610 template <class _A1, class _A2>
611 _LIBCPP_ALWAYS_INLINE
612 bool
613 __libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
614 {
615     return isunordered(__x, __y);
616 }
617
618 #undef isunordered
619
620 template <class _A1, class _A2>
621 inline _LIBCPP_INLINE_VISIBILITY
622 typename std::enable_if
623 <
624     std::is_arithmetic<_A1>::value &&
625     std::is_arithmetic<_A2>::value,
626     bool
627 >::type
628 isunordered(_A1 __x, _A2 __y) _NOEXCEPT
629 {
630     typedef typename std::__promote<_A1, _A2>::type type;
631     return __libcpp_isunordered((type)__x, (type)__y);
632 }
633
634 #endif  // isunordered
635
636 _LIBCPP_BEGIN_NAMESPACE_STD
637
638 using ::signbit;
639 using ::fpclassify;
640 using ::isfinite;
641 using ::isinf;
642 using ::isnan;
643 using ::isnormal;
644 using ::isgreater;
645 using ::isgreaterequal;
646 using ::isless;
647 using ::islessequal;
648 using ::islessgreater;
649 using ::isunordered;
650 using ::isunordered;
651
652 using ::float_t;
653 using ::double_t;
654
655 // abs
656
657 inline _LIBCPP_INLINE_VISIBILITY
658 float
659 abs(float __x) _NOEXCEPT {return fabsf(__x);}
660
661 inline _LIBCPP_INLINE_VISIBILITY
662 double
663 abs(double __x) _NOEXCEPT {return fabs(__x);}
664
665 inline _LIBCPP_INLINE_VISIBILITY
666 long double
667 abs(long double __x) _NOEXCEPT {return fabsl(__x);}
668
669 #ifndef __sun__
670
671 // acos
672
673 using ::acos;
674 using ::acosf;
675
676 #ifndef _MSC_VER
677 inline _LIBCPP_INLINE_VISIBILITY float       acos(float __x) _NOEXCEPT       {return acosf(__x);}
678 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
679 #endif
680
681 template <class _A1>
682 inline _LIBCPP_INLINE_VISIBILITY
683 typename enable_if<is_integral<_A1>::value, double>::type
684 acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
685
686 // asin
687
688 using ::asin;
689 using ::asinf;
690
691 #ifndef _MSC_VER
692 inline _LIBCPP_INLINE_VISIBILITY float       asin(float __x) _NOEXCEPT       {return asinf(__x);}
693 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
694 #endif
695
696 template <class _A1>
697 inline _LIBCPP_INLINE_VISIBILITY
698 typename enable_if<is_integral<_A1>::value, double>::type
699 asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
700
701 // atan
702
703 using ::atan;
704 using ::atanf;
705
706 #ifndef _MSC_VER
707 inline _LIBCPP_INLINE_VISIBILITY float       atan(float __x) _NOEXCEPT       {return atanf(__x);}
708 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
709 #endif
710
711 template <class _A1>
712 inline _LIBCPP_INLINE_VISIBILITY
713 typename enable_if<is_integral<_A1>::value, double>::type
714 atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
715
716 // atan2
717
718 using ::atan2;
719 using ::atan2f;
720
721 #ifndef _MSC_VER
722 inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __y, float __x) _NOEXCEPT             {return atan2f(__y, __x);}
723 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
724 #endif
725
726 template <class _A1, class _A2>
727 inline _LIBCPP_INLINE_VISIBILITY
728 typename enable_if
729 <
730     is_arithmetic<_A1>::value &&
731     is_arithmetic<_A2>::value,
732     typename __promote<_A1, _A2>::type
733 >::type
734 atan2(_A1 __y, _A2 __x) _NOEXCEPT
735 {
736     typedef typename __promote<_A1, _A2>::type __result_type;
737     static_assert((!(is_same<_A1, __result_type>::value &&
738                       is_same<_A2, __result_type>::value)), "");
739     return atan2((__result_type)__y, (__result_type)__x);
740 }
741
742 // ceil
743
744 using ::ceil;
745 using ::ceilf;
746
747 #ifndef _MSC_VER
748 inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __x) _NOEXCEPT       {return ceilf(__x);}
749 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
750 #endif
751
752 template <class _A1>
753 inline _LIBCPP_INLINE_VISIBILITY
754 typename enable_if<is_integral<_A1>::value, double>::type
755 ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
756
757 // cos
758
759 using ::cos;
760 using ::cosf;
761
762 #ifndef _MSC_VER
763 inline _LIBCPP_INLINE_VISIBILITY float       cos(float __x) _NOEXCEPT       {return cosf(__x);}
764 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
765 #endif
766
767 template <class _A1>
768 inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
769 typename enable_if<is_integral<_A1>::value, double>::type
770 cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
771
772 // cosh
773
774 using ::cosh;
775 using ::coshf;
776
777 #ifndef _MSC_VER
778 inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __x) _NOEXCEPT       {return coshf(__x);}
779 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
780 #endif
781
782 template <class _A1>
783 inline _LIBCPP_INLINE_VISIBILITY
784 typename enable_if<is_integral<_A1>::value, double>::type
785 cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
786
787 #endif // __sun__
788 // exp
789
790 using ::exp;
791 using ::expf;
792
793 #ifndef __sun__
794
795 #ifndef _MSC_VER
796 inline _LIBCPP_INLINE_VISIBILITY float       exp(float __x) _NOEXCEPT       {return expf(__x);}
797 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
798 #endif
799
800
801 template <class _A1>
802 inline _LIBCPP_INLINE_VISIBILITY
803 typename enable_if<is_integral<_A1>::value, double>::type
804 exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
805
806 // fabs
807
808 using ::fabs;
809 using ::fabsf;
810
811 #ifndef _MSC_VER
812 inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __x) _NOEXCEPT       {return fabsf(__x);}
813 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
814 #endif
815
816 template <class _A1>
817 inline _LIBCPP_INLINE_VISIBILITY
818 typename enable_if<is_integral<_A1>::value, double>::type
819 fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
820
821 // floor
822
823 using ::floor;
824 using ::floorf;
825
826 #ifndef _MSC_VER
827 inline _LIBCPP_INLINE_VISIBILITY float       floor(float __x) _NOEXCEPT       {return floorf(__x);}
828 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
829 #endif
830
831 template <class _A1>
832 inline _LIBCPP_INLINE_VISIBILITY
833 typename enable_if<is_integral<_A1>::value, double>::type
834 floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
835
836 // fmod
837
838 #endif //__sun__
839 using ::fmod;
840 using ::fmodf;
841 #ifndef __sun__
842
843 #ifndef _MSC_VER
844 inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __x, float __y) _NOEXCEPT             {return fmodf(__x, __y);}
845 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
846 #endif
847
848 template <class _A1, class _A2>
849 inline _LIBCPP_INLINE_VISIBILITY
850 typename enable_if
851 <
852     is_arithmetic<_A1>::value &&
853     is_arithmetic<_A2>::value,
854     typename __promote<_A1, _A2>::type
855 >::type
856 fmod(_A1 __x, _A2 __y) _NOEXCEPT
857 {
858     typedef typename __promote<_A1, _A2>::type __result_type;
859     static_assert((!(is_same<_A1, __result_type>::value &&
860                       is_same<_A2, __result_type>::value)), "");
861     return fmod((__result_type)__x, (__result_type)__y);
862 }
863
864
865 // frexp
866
867 using ::frexp;
868 using ::frexpf;
869
870 #ifndef _MSC_VER
871 inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __x, int* __e) _NOEXCEPT       {return frexpf(__x, __e);}
872 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
873 #endif
874
875 template <class _A1>
876 inline _LIBCPP_INLINE_VISIBILITY
877 typename enable_if<is_integral<_A1>::value, double>::type
878 frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
879
880 // ldexp
881
882 using ::ldexp;
883 using ::ldexpf;
884
885 #ifndef _MSC_VER
886 inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __x, int __e) _NOEXCEPT       {return ldexpf(__x, __e);}
887 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
888 #endif
889
890 template <class _A1>
891 inline _LIBCPP_INLINE_VISIBILITY
892 typename enable_if<is_integral<_A1>::value, double>::type
893 ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
894
895 // log
896
897 #endif // __sun__
898 using ::log;
899 using ::logf;
900 #ifndef __sun__
901
902 #ifndef _MSC_VER
903 inline _LIBCPP_INLINE_VISIBILITY float       log(float __x) _NOEXCEPT       {return logf(__x);}
904 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
905 #endif
906
907 template <class _A1>
908 inline _LIBCPP_INLINE_VISIBILITY
909 typename enable_if<is_integral<_A1>::value, double>::type
910 log(_A1 __x) _NOEXCEPT {return log((double)__x);}
911
912
913 // log10
914
915 using ::log10;
916 using ::log10f;
917
918 #ifndef _MSC_VER
919 inline _LIBCPP_INLINE_VISIBILITY float       log10(float __x) _NOEXCEPT       {return log10f(__x);}
920 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
921 #endif
922
923 template <class _A1>
924 inline _LIBCPP_INLINE_VISIBILITY
925 typename enable_if<is_integral<_A1>::value, double>::type
926 log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
927
928 // modf
929
930 using ::modf;
931 using ::modff;
932
933 #ifndef _MSC_VER
934 inline _LIBCPP_INLINE_VISIBILITY float       modf(float __x, float* __y) _NOEXCEPT             {return modff(__x, __y);}
935 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
936 #endif
937
938 // pow
939
940 #endif // __sun__ 
941 using ::pow;
942 using ::powf;
943
944 #ifndef __sun__
945
946 #ifndef _MSC_VER
947 inline _LIBCPP_INLINE_VISIBILITY float       pow(float __x, float __y) _NOEXCEPT             {return powf(__x, __y);}
948 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
949 #endif
950
951 template <class _A1, class _A2>
952 inline _LIBCPP_INLINE_VISIBILITY
953 typename enable_if
954 <
955     is_arithmetic<_A1>::value &&
956     is_arithmetic<_A2>::value,
957     typename __promote<_A1, _A2>::type
958 >::type
959 pow(_A1 __x, _A2 __y) _NOEXCEPT
960 {
961     typedef typename __promote<_A1, _A2>::type __result_type;
962     static_assert((!(is_same<_A1, __result_type>::value &&
963                       is_same<_A2, __result_type>::value)), "");
964     return pow((__result_type)__x, (__result_type)__y);
965 }
966
967
968 // sin
969
970 using ::sin;
971 using ::sinf;
972
973 #ifndef _MSC_VER
974 inline _LIBCPP_INLINE_VISIBILITY float       sin(float __x) _NOEXCEPT       {return sinf(__x);}
975 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
976 #endif
977
978 template <class _A1>
979 inline _LIBCPP_INLINE_VISIBILITY
980 typename enable_if<is_integral<_A1>::value, double>::type
981 sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
982
983 // sinh
984
985 using ::sinh;
986 using ::sinhf;
987
988 #ifndef _MSC_VER
989 inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __x) _NOEXCEPT       {return sinhf(__x);}
990 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
991 #endif
992
993 template <class _A1>
994 inline _LIBCPP_INLINE_VISIBILITY
995 typename enable_if<is_integral<_A1>::value, double>::type
996 sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
997
998 // sqrt
999
1000 #endif // __sun__
1001 using ::sqrt;
1002 using ::sqrtf;
1003
1004
1005 #if !(defined(_MSC_VER) || defined(__sun__))
1006 inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __x) _NOEXCEPT       {return sqrtf(__x);}
1007 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
1008 #endif
1009
1010 template <class _A1>
1011 inline _LIBCPP_INLINE_VISIBILITY
1012 typename enable_if<is_integral<_A1>::value, double>::type
1013 sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
1014
1015 // tan
1016
1017 using ::tan;
1018 using ::tanf;
1019 #ifndef __sun__
1020
1021 #ifndef _MSC_VER
1022 inline _LIBCPP_INLINE_VISIBILITY float       tan(float __x) _NOEXCEPT       {return tanf(__x);}
1023 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
1024 #endif
1025
1026 template <class _A1>
1027 inline _LIBCPP_INLINE_VISIBILITY
1028 typename enable_if<is_integral<_A1>::value, double>::type
1029 tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
1030
1031 // tanh
1032
1033 using ::tanh;
1034 using ::tanhf;
1035
1036 #ifndef _MSC_VER
1037 inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __x) _NOEXCEPT       {return tanhf(__x);}
1038 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
1039 #endif
1040
1041 template <class _A1>
1042 inline _LIBCPP_INLINE_VISIBILITY
1043 typename enable_if<is_integral<_A1>::value, double>::type
1044 tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
1045
1046 // acosh
1047
1048 #ifndef _MSC_VER
1049 using ::acosh;
1050 using ::acoshf;
1051
1052 inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __x) _NOEXCEPT       {return acoshf(__x);}
1053 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
1054
1055 template <class _A1>
1056 inline _LIBCPP_INLINE_VISIBILITY
1057 typename enable_if<is_integral<_A1>::value, double>::type
1058 acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
1059 #endif
1060
1061 // asinh
1062
1063 #ifndef _MSC_VER
1064 using ::asinh;
1065 using ::asinhf;
1066
1067 inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __x) _NOEXCEPT       {return asinhf(__x);}
1068 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
1069
1070 template <class _A1>
1071 inline _LIBCPP_INLINE_VISIBILITY
1072 typename enable_if<is_integral<_A1>::value, double>::type
1073 asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
1074 #endif
1075
1076 // atanh
1077
1078 #ifndef _MSC_VER
1079 using ::atanh;
1080 using ::atanhf;
1081
1082 inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __x) _NOEXCEPT       {return atanhf(__x);}
1083 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
1084
1085 template <class _A1>
1086 inline _LIBCPP_INLINE_VISIBILITY
1087 typename enable_if<is_integral<_A1>::value, double>::type
1088 atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
1089 #endif
1090
1091 // cbrt
1092
1093 #ifndef _MSC_VER
1094 using ::cbrt;
1095 using ::cbrtf;
1096
1097 inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __x) _NOEXCEPT       {return cbrtf(__x);}
1098 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
1099
1100 template <class _A1>
1101 inline _LIBCPP_INLINE_VISIBILITY
1102 typename enable_if<is_integral<_A1>::value, double>::type
1103 cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
1104 #endif
1105
1106 // copysign
1107
1108 using ::copysign;
1109 using ::copysignf;
1110
1111 inline _LIBCPP_INLINE_VISIBILITY float       copysign(float __x, float __y) _NOEXCEPT             {return copysignf(__x, __y);}
1112 inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
1113
1114 template <class _A1, class _A2>
1115 inline _LIBCPP_INLINE_VISIBILITY
1116 typename enable_if
1117 <
1118     is_arithmetic<_A1>::value &&
1119     is_arithmetic<_A2>::value,
1120     typename __promote<_A1, _A2>::type
1121 >::type
1122 copysign(_A1 __x, _A2 __y) _NOEXCEPT
1123 {
1124     typedef typename __promote<_A1, _A2>::type __result_type;
1125     static_assert((!(is_same<_A1, __result_type>::value &&
1126                       is_same<_A2, __result_type>::value)), "");
1127     return copysign((__result_type)__x, (__result_type)__y);
1128 }
1129
1130 #ifndef _MSC_VER
1131
1132 // erf
1133
1134 using ::erf;
1135 using ::erff;
1136
1137 inline _LIBCPP_INLINE_VISIBILITY float       erf(float __x) _NOEXCEPT       {return erff(__x);}
1138 inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
1139
1140 template <class _A1>
1141 inline _LIBCPP_INLINE_VISIBILITY
1142 typename enable_if<is_integral<_A1>::value, double>::type
1143 erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
1144
1145 // erfc
1146
1147 using ::erfc;
1148 using ::erfcf;
1149
1150 inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __x) _NOEXCEPT       {return erfcf(__x);}
1151 inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
1152
1153 template <class _A1>
1154 inline _LIBCPP_INLINE_VISIBILITY
1155 typename enable_if<is_integral<_A1>::value, double>::type
1156 erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
1157
1158 // exp2
1159
1160 using ::exp2;
1161 using ::exp2f;
1162
1163 inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __x) _NOEXCEPT       {return exp2f(__x);}
1164 inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
1165
1166 template <class _A1>
1167 inline _LIBCPP_INLINE_VISIBILITY
1168 typename enable_if<is_integral<_A1>::value, double>::type
1169 exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
1170
1171 // expm1
1172
1173 using ::expm1;
1174 using ::expm1f;
1175
1176 inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __x) _NOEXCEPT       {return expm1f(__x);}
1177 inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
1178
1179 template <class _A1>
1180 inline _LIBCPP_INLINE_VISIBILITY
1181 typename enable_if<is_integral<_A1>::value, double>::type
1182 expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
1183
1184 // fdim
1185
1186 using ::fdim;
1187 using ::fdimf;
1188
1189 inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __x, float __y) _NOEXCEPT             {return fdimf(__x, __y);}
1190 inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
1191
1192 template <class _A1, class _A2>
1193 inline _LIBCPP_INLINE_VISIBILITY
1194 typename enable_if
1195 <
1196     is_arithmetic<_A1>::value &&
1197     is_arithmetic<_A2>::value,
1198     typename __promote<_A1, _A2>::type
1199 >::type
1200 fdim(_A1 __x, _A2 __y) _NOEXCEPT
1201 {
1202     typedef typename __promote<_A1, _A2>::type __result_type;
1203     static_assert((!(is_same<_A1, __result_type>::value &&
1204                       is_same<_A2, __result_type>::value)), "");
1205     return fdim((__result_type)__x, (__result_type)__y);
1206 }
1207
1208 // fma
1209
1210 inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
1211 #ifndef FP_FAST_FMAF
1212 #define FP_FAST_FMAF
1213 #endif
1214
1215 using ::fma;
1216
1217 inline _LIBCPP_INLINE_VISIBILITY float       fma(float __x, float __y, float __z) _NOEXCEPT                   {return fmaf(__x, __y, __z);}
1218 inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
1219
1220 template <class _A1, class _A2, class _A3>
1221 inline _LIBCPP_INLINE_VISIBILITY
1222 typename enable_if
1223 <
1224     is_arithmetic<_A1>::value &&
1225     is_arithmetic<_A2>::value &&
1226     is_arithmetic<_A3>::value,
1227     typename __promote<_A1, _A2, _A3>::type
1228 >::type
1229 fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
1230 {
1231     typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1232     static_assert((!(is_same<_A1, __result_type>::value &&
1233                       is_same<_A2, __result_type>::value &&
1234                       is_same<_A3, __result_type>::value)), "");
1235     return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1236 }
1237
1238 // fmax
1239
1240 using ::fmax;
1241 using ::fmaxf;
1242
1243 inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __x, float __y) _NOEXCEPT             {return fmaxf(__x, __y);}
1244 inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
1245
1246 template <class _A1, class _A2>
1247 inline _LIBCPP_INLINE_VISIBILITY
1248 typename enable_if
1249 <
1250     is_arithmetic<_A1>::value &&
1251     is_arithmetic<_A2>::value,
1252     typename __promote<_A1, _A2>::type
1253 >::type
1254 fmax(_A1 __x, _A2 __y) _NOEXCEPT
1255 {
1256     typedef typename __promote<_A1, _A2>::type __result_type;
1257     static_assert((!(is_same<_A1, __result_type>::value &&
1258                       is_same<_A2, __result_type>::value)), "");
1259     return fmax((__result_type)__x, (__result_type)__y);
1260 }
1261
1262 // fmin
1263
1264 using ::fmin;
1265 using ::fminf;
1266
1267 inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __x, float __y) _NOEXCEPT             {return fminf(__x, __y);}
1268 inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
1269
1270 template <class _A1, class _A2>
1271 inline _LIBCPP_INLINE_VISIBILITY
1272 typename enable_if
1273 <
1274     is_arithmetic<_A1>::value &&
1275     is_arithmetic<_A2>::value,
1276     typename __promote<_A1, _A2>::type
1277 >::type
1278 fmin(_A1 __x, _A2 __y) _NOEXCEPT
1279 {
1280     typedef typename __promote<_A1, _A2>::type __result_type;
1281     static_assert((!(is_same<_A1, __result_type>::value &&
1282                       is_same<_A2, __result_type>::value)), "");
1283     return fmin((__result_type)__x, (__result_type)__y);
1284 }
1285
1286 // hypot
1287
1288 using ::hypot;
1289 using ::hypotf;
1290
1291 inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __x, float __y) _NOEXCEPT             {return hypotf(__x, __y);}
1292 inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
1293
1294 template <class _A1, class _A2>
1295 inline _LIBCPP_INLINE_VISIBILITY
1296 typename enable_if
1297 <
1298     is_arithmetic<_A1>::value &&
1299     is_arithmetic<_A2>::value,
1300     typename __promote<_A1, _A2>::type
1301 >::type
1302 hypot(_A1 __x, _A2 __y) _NOEXCEPT
1303 {
1304     typedef typename __promote<_A1, _A2>::type __result_type;
1305     static_assert((!(is_same<_A1, __result_type>::value &&
1306                       is_same<_A2, __result_type>::value)), "");
1307     return hypot((__result_type)__x, (__result_type)__y);
1308 }
1309
1310 // ilogb
1311
1312 using ::ilogb;
1313 using ::ilogbf;
1314
1315 inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT       {return ilogbf(__x);}
1316 inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
1317
1318 template <class _A1>
1319 inline _LIBCPP_INLINE_VISIBILITY
1320 typename enable_if<is_integral<_A1>::value, int>::type
1321 ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
1322
1323 // lgamma
1324
1325 using ::lgamma;
1326 using ::lgammaf;
1327
1328 inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __x) _NOEXCEPT       {return lgammaf(__x);}
1329 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
1330
1331
1332 template <class _A1>
1333 inline _LIBCPP_INLINE_VISIBILITY
1334 typename enable_if<is_integral<_A1>::value, double>::type
1335 lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
1336
1337
1338 // llrint
1339
1340 using ::llrint;
1341 using ::llrintf;
1342
1343 inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT       {return llrintf(__x);}
1344 inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
1345
1346 template <class _A1>
1347 inline _LIBCPP_INLINE_VISIBILITY
1348 typename enable_if<is_integral<_A1>::value, long long>::type
1349 llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
1350
1351 // llround
1352
1353 using ::llround;
1354 using ::llroundf;
1355
1356 inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT       {return llroundf(__x);}
1357 inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
1358
1359 template <class _A1>
1360 inline _LIBCPP_INLINE_VISIBILITY
1361 typename enable_if<is_integral<_A1>::value, long long>::type
1362 llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
1363
1364 // log1p
1365
1366 using ::log1p;
1367 using ::log1pf;
1368
1369 inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __x) _NOEXCEPT       {return log1pf(__x);}
1370 inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
1371
1372 template <class _A1>
1373 inline _LIBCPP_INLINE_VISIBILITY
1374 typename enable_if<is_integral<_A1>::value, double>::type
1375 log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
1376
1377 // log2
1378
1379 using ::log2;
1380 using ::log2f;
1381
1382 inline _LIBCPP_INLINE_VISIBILITY float       log2(float __x) _NOEXCEPT       {return log2f(__x);}
1383 inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
1384
1385 template <class _A1>
1386 inline _LIBCPP_INLINE_VISIBILITY
1387 typename enable_if<is_integral<_A1>::value, double>::type
1388 log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
1389
1390 // logb
1391
1392 using ::logb;
1393 using ::logbf;
1394
1395 inline _LIBCPP_INLINE_VISIBILITY float       logb(float __x) _NOEXCEPT       {return logbf(__x);}
1396 inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
1397
1398 template <class _A1>
1399 inline _LIBCPP_INLINE_VISIBILITY
1400 typename enable_if<is_integral<_A1>::value, double>::type
1401 logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
1402
1403 // lrint
1404
1405 using ::lrint;
1406 using ::lrintf;
1407
1408 inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT       {return lrintf(__x);}
1409 inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
1410
1411 template <class _A1>
1412 inline _LIBCPP_INLINE_VISIBILITY
1413 typename enable_if<is_integral<_A1>::value, long>::type
1414 lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
1415
1416 // lround
1417
1418 using ::lround;
1419 using ::lroundf;
1420
1421 inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT       {return lroundf(__x);}
1422 inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
1423
1424 template <class _A1>
1425 inline _LIBCPP_INLINE_VISIBILITY
1426 typename enable_if<is_integral<_A1>::value, long>::type
1427 lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
1428
1429 // nan
1430 #endif // _MSC_VER
1431 #endif // __sun__
1432 using ::nan;
1433 using ::nanf;
1434 #ifndef __sun__
1435 #ifndef _MSC_VER
1436
1437 // nearbyint
1438
1439 using ::nearbyint;
1440 using ::nearbyintf;
1441
1442 inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __x) _NOEXCEPT       {return nearbyintf(__x);}
1443 inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
1444
1445 template <class _A1>
1446 inline _LIBCPP_INLINE_VISIBILITY
1447 typename enable_if<is_integral<_A1>::value, double>::type
1448 nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
1449
1450 // nextafter
1451
1452 using ::nextafter;
1453 using ::nextafterf;
1454
1455 inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __x, float __y) _NOEXCEPT             {return nextafterf(__x, __y);}
1456 inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
1457
1458 template <class _A1, class _A2>
1459 inline _LIBCPP_INLINE_VISIBILITY
1460 typename enable_if
1461 <
1462     is_arithmetic<_A1>::value &&
1463     is_arithmetic<_A2>::value,
1464     typename __promote<_A1, _A2>::type
1465 >::type
1466 nextafter(_A1 __x, _A2 __y) _NOEXCEPT
1467 {
1468     typedef typename __promote<_A1, _A2>::type __result_type;
1469     static_assert((!(is_same<_A1, __result_type>::value &&
1470                       is_same<_A2, __result_type>::value)), "");
1471     return nextafter((__result_type)__x, (__result_type)__y);
1472 }
1473
1474 // nexttoward
1475
1476 using ::nexttoward;
1477 using ::nexttowardf;
1478
1479 inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __x, long double __y) _NOEXCEPT       {return nexttowardf(__x, __y);}
1480 inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
1481
1482 template <class _A1>
1483 inline _LIBCPP_INLINE_VISIBILITY
1484 typename enable_if<is_integral<_A1>::value, double>::type
1485 nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
1486
1487 // remainder
1488
1489 using ::remainder;
1490 using ::remainderf;
1491
1492 inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __x, float __y) _NOEXCEPT             {return remainderf(__x, __y);}
1493 inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
1494
1495 template <class _A1, class _A2>
1496 inline _LIBCPP_INLINE_VISIBILITY
1497 typename enable_if
1498 <
1499     is_arithmetic<_A1>::value &&
1500     is_arithmetic<_A2>::value,
1501     typename __promote<_A1, _A2>::type
1502 >::type
1503 remainder(_A1 __x, _A2 __y) _NOEXCEPT
1504 {
1505     typedef typename __promote<_A1, _A2>::type __result_type;
1506     static_assert((!(is_same<_A1, __result_type>::value &&
1507                       is_same<_A2, __result_type>::value)), "");
1508     return remainder((__result_type)__x, (__result_type)__y);
1509 }
1510
1511 // remquo
1512
1513 using ::remquo;
1514 using ::remquof;
1515
1516 inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __x, float __y, int* __z) _NOEXCEPT             {return remquof(__x, __y, __z);}
1517 inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
1518
1519 template <class _A1, class _A2>
1520 inline _LIBCPP_INLINE_VISIBILITY
1521 typename enable_if
1522 <
1523     is_arithmetic<_A1>::value &&
1524     is_arithmetic<_A2>::value,
1525     typename __promote<_A1, _A2>::type
1526 >::type
1527 remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
1528 {
1529     typedef typename __promote<_A1, _A2>::type __result_type;
1530     static_assert((!(is_same<_A1, __result_type>::value &&
1531                       is_same<_A2, __result_type>::value)), "");
1532     return remquo((__result_type)__x, (__result_type)__y, __z);
1533 }
1534
1535 // rint
1536
1537 using ::rint;
1538 using ::rintf;
1539
1540 inline _LIBCPP_INLINE_VISIBILITY float       rint(float __x) _NOEXCEPT       {return rintf(__x);}
1541 inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
1542
1543 template <class _A1>
1544 inline _LIBCPP_INLINE_VISIBILITY
1545 typename enable_if<is_integral<_A1>::value, double>::type
1546 rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
1547
1548 // round
1549
1550 using ::round;
1551 using ::roundf;
1552
1553 inline _LIBCPP_INLINE_VISIBILITY float       round(float __x) _NOEXCEPT       {return roundf(__x);}
1554 inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
1555
1556 template <class _A1>
1557 inline _LIBCPP_INLINE_VISIBILITY
1558 typename enable_if<is_integral<_A1>::value, double>::type
1559 round(_A1 __x) _NOEXCEPT {return round((double)__x);}
1560
1561 // scalbln
1562
1563 using ::scalbln;
1564 using ::scalblnf;
1565
1566 inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __x, long __y) _NOEXCEPT       {return scalblnf(__x, __y);}
1567 inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
1568
1569 template <class _A1>
1570 inline _LIBCPP_INLINE_VISIBILITY
1571 typename enable_if<is_integral<_A1>::value, double>::type
1572 scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
1573
1574 // scalbn
1575
1576 using ::scalbn;
1577 using ::scalbnf;
1578
1579 inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __x, int __y) _NOEXCEPT       {return scalbnf(__x, __y);}
1580 inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
1581
1582 template <class _A1>
1583 inline _LIBCPP_INLINE_VISIBILITY
1584 typename enable_if<is_integral<_A1>::value, double>::type
1585 scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
1586
1587 // tgamma
1588
1589 using ::tgamma;
1590 using ::tgammaf;
1591
1592 inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __x) _NOEXCEPT       {return tgammaf(__x);}
1593 inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
1594
1595 template <class _A1>
1596 inline _LIBCPP_INLINE_VISIBILITY
1597 typename enable_if<is_integral<_A1>::value, double>::type
1598 tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
1599
1600 // trunc
1601
1602 using ::trunc;
1603 using ::truncf;
1604
1605 inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __x) _NOEXCEPT       {return truncf(__x);}
1606 inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
1607
1608 template <class _A1>
1609 inline _LIBCPP_INLINE_VISIBILITY
1610 typename enable_if<is_integral<_A1>::value, double>::type
1611 trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
1612
1613 #endif // !_MSC_VER
1614
1615 using ::acosl;
1616 using ::asinl;
1617 using ::atanl;
1618 using ::atan2l;
1619 using ::ceill;
1620 using ::cosl;
1621 using ::coshl;
1622 using ::expl;
1623 using ::fabsl;
1624 using ::floorl;
1625 using ::fmodl;
1626 using ::frexpl;
1627 using ::ldexpl;
1628 using ::logl;
1629 using ::log10l;
1630 using ::modfl;
1631 using ::powl;
1632 using ::sinl;
1633 using ::sinhl;
1634 using ::sqrtl;
1635 using ::tanl;
1636 #ifndef _MSC_VER
1637 using ::tanhl;
1638 using ::acoshl;
1639 using ::asinhl;
1640 using ::atanhl;
1641 using ::cbrtl;
1642 #endif  // !_MSC_VER
1643 using ::copysignl;
1644 #ifndef _MSC_VER
1645 using ::erfl;
1646 using ::erfcl;
1647 using ::exp2l;
1648 using ::expm1l;
1649 using ::fdiml;
1650 using ::fmal;
1651 using ::fmaxl;
1652 using ::fminl;
1653 using ::hypotl;
1654 using ::ilogbl;
1655 using ::lgammal;
1656 using ::llrintl;
1657 using ::llroundl;
1658 using ::log1pl;
1659 using ::log2l;
1660 using ::logbl;
1661 using ::lrintl;
1662 using ::lroundl;
1663 using ::nanl;
1664 using ::nearbyintl;
1665 using ::nextafterl;
1666 using ::nexttowardl;
1667 using ::remainderl;
1668 using ::remquol;
1669 using ::rintl;
1670 using ::roundl;
1671 using ::scalblnl;
1672 using ::scalbnl;
1673 using ::tgammal;
1674 using ::truncl;
1675 #endif // !_MSC_VER
1676
1677 #else 
1678 using ::lgamma;
1679 using ::lgammaf;
1680 #endif // __sun__
1681 _LIBCPP_END_NAMESPACE_STD
1682
1683 #endif  // _LIBCPP_CMATH