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