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