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