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