2 //===---------------------------- cmath -----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
36 math_errhandling // C99
48 floating_point abs(floating_point x);
50 floating_point acos (arithmetic x);
52 long double acosl(long double x);
54 floating_point asin (arithmetic x);
56 long double asinl(long double x);
58 floating_point atan (arithmetic x);
60 long double atanl(long double x);
62 floating_point atan2 (arithmetic y, arithmetic x);
63 float atan2f(float y, float x);
64 long double atan2l(long double y, long double x);
66 floating_point ceil (arithmetic x);
68 long double ceill(long double x);
70 floating_point cos (arithmetic x);
72 long double cosl(long double x);
74 floating_point cosh (arithmetic x);
76 long double coshl(long double x);
78 floating_point exp (arithmetic x);
80 long double expl(long double x);
82 floating_point fabs (arithmetic x);
84 long double fabsl(long double x);
86 floating_point floor (arithmetic x);
87 float floorf(float x);
88 long double floorl(long double x);
90 floating_point fmod (arithmetic x, arithmetic y);
91 float fmodf(float x, float y);
92 long double fmodl(long double x, long double y);
94 floating_point frexp (arithmetic value, int* exp);
95 float frexpf(float value, int* exp);
96 long double frexpl(long double value, int* exp);
98 floating_point ldexp (arithmetic value, int exp);
99 float ldexpf(float value, int exp);
100 long double ldexpl(long double value, int exp);
102 floating_point log (arithmetic x);
104 long double logl(long double x);
106 floating_point log10 (arithmetic x);
107 float log10f(float x);
108 long double log10l(long double x);
110 floating_point modf (floating_point value, floating_point* iptr);
111 float modff(float value, float* iptr);
112 long double modfl(long double value, long double* iptr);
114 floating_point pow (arithmetic x, arithmetic y);
115 float powf(float x, float y);
116 long double powl(long double x, long double y);
118 floating_point sin (arithmetic x);
120 long double sinl(long double x);
122 floating_point sinh (arithmetic x);
123 float sinhf(float x);
124 long double sinhl(long double x);
126 floating_point sqrt (arithmetic x);
127 float sqrtf(float x);
128 long double sqrtl(long double x);
130 floating_point tan (arithmetic x);
132 long double tanl(long double x);
134 floating_point tanh (arithmetic x);
135 float tanhf(float x);
136 long double tanhl(long double x);
140 bool signbit(floating_point x);
142 int fpclassify(floating_point x);
144 bool isfinite(floating_point x);
145 bool isinf(floating_point x);
146 bool isnan(floating_point x);
147 bool isnormal(floating_point x);
149 bool isgreater(floating_point x, floating_point y);
150 bool isgreaterequal(floating_point x, floating_point y);
151 bool isless(floating_point x, floating_point y);
152 bool islessequal(floating_point x, floating_point y);
153 bool islessgreater(floating_point x, floating_point y);
154 bool isunordered(floating_point x, floating_point y);
156 floating_point acosh (arithmetic x);
157 float acoshf(float x);
158 long double acoshl(long double x);
160 floating_point asinh (arithmetic x);
161 float asinhf(float x);
162 long double asinhl(long double x);
164 floating_point atanh (arithmetic x);
165 float atanhf(float x);
166 long double atanhl(long double x);
168 floating_point cbrt (arithmetic x);
169 float cbrtf(float x);
170 long double cbrtl(long double x);
172 floating_point copysign (arithmetic x, arithmetic y);
173 float copysignf(float x, float y);
174 long double copysignl(long double x, long double y);
176 floating_point erf (arithmetic x);
178 long double erfl(long double x);
180 floating_point erfc (arithmetic x);
181 float erfcf(float x);
182 long double erfcl(long double x);
184 floating_point exp2 (arithmetic x);
185 float exp2f(float x);
186 long double exp2l(long double x);
188 floating_point expm1 (arithmetic x);
189 float expm1f(float x);
190 long double expm1l(long double x);
192 floating_point fdim (arithmetic x, arithmetic y);
193 float fdimf(float x, float y);
194 long double fdiml(long double x, long double y);
196 floating_point fma (arithmetic x, arithmetic y, arithmetic z);
197 float fmaf(float x, float y, float z);
198 long double fmal(long double x, long double y, long double z);
200 floating_point fmax (arithmetic x, arithmetic y);
201 float fmaxf(float x, float y);
202 long double fmaxl(long double x, long double y);
204 floating_point fmin (arithmetic x, arithmetic y);
205 float fminf(float x, float y);
206 long double fminl(long double x, long double y);
208 floating_point hypot (arithmetic x, arithmetic y);
209 float hypotf(float x, float y);
210 long double hypotl(long double x, long double y);
212 int ilogb (arithmetic x);
214 int ilogbl(long double x);
216 floating_point lgamma (arithmetic x);
217 float lgammaf(float x);
218 long double lgammal(long double x);
220 long long llrint (arithmetic x);
221 long long llrintf(float x);
222 long long llrintl(long double x);
224 long long llround (arithmetic x);
225 long long llroundf(float x);
226 long long llroundl(long double x);
228 floating_point log1p (arithmetic x);
229 float log1pf(float x);
230 long double log1pl(long double x);
232 floating_point log2 (arithmetic x);
233 float log2f(float x);
234 long double log2l(long double x);
236 floating_point logb (arithmetic x);
237 float logbf(float x);
238 long double logbl(long double x);
240 long lrint (arithmetic x);
241 long lrintf(float x);
242 long lrintl(long double x);
244 long lround (arithmetic x);
245 long lroundf(float x);
246 long lroundl(long double x);
248 double nan (const char* str);
249 float nanf(const char* str);
250 long double nanl(const char* str);
252 floating_point nearbyint (arithmetic x);
253 float nearbyintf(float x);
254 long double nearbyintl(long double x);
256 floating_point nextafter (arithmetic x, arithmetic y);
257 float nextafterf(float x, float y);
258 long double nextafterl(long double x, long double y);
260 floating_point nexttoward (arithmetic x, long double y);
261 float nexttowardf(float x, long double y);
262 long double nexttowardl(long double x, long double y);
264 floating_point remainder (arithmetic x, arithmetic y);
265 float remainderf(float x, float y);
266 long double remainderl(long double x, long double y);
268 floating_point remquo (arithmetic x, arithmetic y, int* pquo);
269 float remquof(float x, float y, int* pquo);
270 long double remquol(long double x, long double y, int* pquo);
272 floating_point rint (arithmetic x);
273 float rintf(float x);
274 long double rintl(long double x);
276 floating_point round (arithmetic x);
277 float roundf(float x);
278 long double roundl(long double x);
280 floating_point scalbln (arithmetic x, long ex);
281 float scalblnf(float x, long ex);
282 long double scalblnl(long double x, long ex);
284 floating_point scalbn (arithmetic x, int ex);
285 float scalbnf(float x, int ex);
286 long double scalbnl(long double x, int ex);
288 floating_point tgamma (arithmetic x);
289 float tgammaf(float x);
290 long double tgammal(long double x);
292 floating_point trunc (arithmetic x);
293 float truncf(float x);
294 long double truncl(long double x);
302 #include <type_traits>
305 #include "support/win32/math_win32.h"
308 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
309 #pragma GCC system_header
317 _LIBCPP_ALWAYS_INLINE
319 __libcpp_signbit(_A1 __x)
327 inline _LIBCPP_INLINE_VISIBILITY
328 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
331 return __libcpp_signbit(__x);
341 _LIBCPP_ALWAYS_INLINE
343 __libcpp_fpclassify(_A1 __x)
345 return fpclassify(__x);
351 inline _LIBCPP_INLINE_VISIBILITY
352 typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
355 return __libcpp_fpclassify(__x);
365 _LIBCPP_ALWAYS_INLINE
367 __libcpp_isfinite(_A1 __x)
369 return isfinite(__x);
375 inline _LIBCPP_INLINE_VISIBILITY
376 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
379 return __libcpp_isfinite(__x);
389 _LIBCPP_ALWAYS_INLINE
391 __libcpp_isinf(_A1 __x)
399 inline _LIBCPP_INLINE_VISIBILITY
400 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
403 return __libcpp_isinf(__x);
413 _LIBCPP_ALWAYS_INLINE
415 __libcpp_isnan(_A1 __x)
423 inline _LIBCPP_INLINE_VISIBILITY
424 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
427 return __libcpp_isnan(__x);
437 _LIBCPP_ALWAYS_INLINE
439 __libcpp_isnormal(_A1 __x)
441 return isnormal(__x);
447 inline _LIBCPP_INLINE_VISIBILITY
448 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
451 return __libcpp_isnormal(__x);
460 template <class _A1, class _A2>
461 _LIBCPP_ALWAYS_INLINE
463 __libcpp_isgreater(_A1 __x, _A2 __y)
465 return isgreater(__x, __y);
470 template <class _A1, class _A2>
471 inline _LIBCPP_INLINE_VISIBILITY
472 typename std::enable_if
474 std::is_floating_point<_A1>::value &&
475 std::is_floating_point<_A2>::value,
478 isgreater(_A1 __x, _A2 __y)
480 return __libcpp_isgreater(__x, __y);
487 #ifdef isgreaterequal
489 template <class _A1, class _A2>
490 _LIBCPP_ALWAYS_INLINE
492 __libcpp_isgreaterequal(_A1 __x, _A2 __y)
494 return isgreaterequal(__x, __y);
497 #undef isgreaterequal
499 template <class _A1, class _A2>
500 inline _LIBCPP_INLINE_VISIBILITY
501 typename std::enable_if
503 std::is_floating_point<_A1>::value &&
504 std::is_floating_point<_A2>::value,
507 isgreaterequal(_A1 __x, _A2 __y)
509 return __libcpp_isgreaterequal(__x, __y);
512 #endif // isgreaterequal
518 template <class _A1, class _A2>
519 _LIBCPP_ALWAYS_INLINE
521 __libcpp_isless(_A1 __x, _A2 __y)
523 return isless(__x, __y);
528 template <class _A1, class _A2>
529 inline _LIBCPP_INLINE_VISIBILITY
530 typename std::enable_if
532 std::is_floating_point<_A1>::value &&
533 std::is_floating_point<_A2>::value,
536 isless(_A1 __x, _A2 __y)
538 return __libcpp_isless(__x, __y);
547 template <class _A1, class _A2>
548 _LIBCPP_ALWAYS_INLINE
550 __libcpp_islessequal(_A1 __x, _A2 __y)
552 return islessequal(__x, __y);
557 template <class _A1, class _A2>
558 inline _LIBCPP_INLINE_VISIBILITY
559 typename std::enable_if
561 std::is_floating_point<_A1>::value &&
562 std::is_floating_point<_A2>::value,
565 islessequal(_A1 __x, _A2 __y)
567 return __libcpp_islessequal(__x, __y);
570 #endif // islessequal
576 template <class _A1, class _A2>
577 _LIBCPP_ALWAYS_INLINE
579 __libcpp_islessgreater(_A1 __x, _A2 __y)
581 return islessgreater(__x, __y);
586 template <class _A1, class _A2>
587 inline _LIBCPP_INLINE_VISIBILITY
588 typename std::enable_if
590 std::is_floating_point<_A1>::value &&
591 std::is_floating_point<_A2>::value,
594 islessgreater(_A1 __x, _A2 __y)
596 return __libcpp_islessgreater(__x, __y);
599 #endif // islessgreater
605 template <class _A1, class _A2>
606 _LIBCPP_ALWAYS_INLINE
608 __libcpp_isunordered(_A1 __x, _A2 __y)
610 return isunordered(__x, __y);
615 template <class _A1, class _A2>
616 inline _LIBCPP_INLINE_VISIBILITY
617 typename std::enable_if
619 std::is_floating_point<_A1>::value &&
620 std::is_floating_point<_A2>::value,
623 isunordered(_A1 __x, _A2 __y)
625 return __libcpp_isunordered(__x, __y);
628 #endif // isunordered
630 _LIBCPP_BEGIN_NAMESPACE_STD
639 using ::isgreaterequal;
642 using ::islessgreater;
651 inline _LIBCPP_INLINE_VISIBILITY
653 abs(float __x) {return fabsf(__x);}
655 inline _LIBCPP_INLINE_VISIBILITY
657 abs(double __x) {return fabs(__x);}
659 inline _LIBCPP_INLINE_VISIBILITY
661 abs(long double __x) {return fabsl(__x);}
671 inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);}
672 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);}
676 inline _LIBCPP_INLINE_VISIBILITY
677 typename enable_if<is_integral<_A1>::value, double>::type
678 acos(_A1 __x) {return acos((double)__x);}
686 inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);}
687 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);}
691 inline _LIBCPP_INLINE_VISIBILITY
692 typename enable_if<is_integral<_A1>::value, double>::type
693 asin(_A1 __x) {return asin((double)__x);}
701 inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);}
702 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);}
706 inline _LIBCPP_INLINE_VISIBILITY
707 typename enable_if<is_integral<_A1>::value, double>::type
708 atan(_A1 __x) {return atan((double)__x);}
716 inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) {return atan2f(__y, __x);}
717 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);}
720 template <class _A1, class _A2>
721 inline _LIBCPP_INLINE_VISIBILITY
724 is_arithmetic<_A1>::value &&
725 is_arithmetic<_A2>::value,
726 typename __promote<_A1, _A2>::type
728 atan2(_A1 __y, _A2 __x)
730 typedef typename __promote<_A1, _A2>::type __result_type;
731 static_assert((!(is_same<_A1, __result_type>::value &&
732 is_same<_A2, __result_type>::value)), "");
733 return atan2((__result_type)__y, (__result_type)__x);
742 inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);}
743 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);}
747 inline _LIBCPP_INLINE_VISIBILITY
748 typename enable_if<is_integral<_A1>::value, double>::type
749 ceil(_A1 __x) {return ceil((double)__x);}
757 inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);}
758 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);}
762 inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
763 typename enable_if<is_integral<_A1>::value, double>::type
764 cos(_A1 __x) {return cos((double)__x);}
772 inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);}
773 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);}
777 inline _LIBCPP_INLINE_VISIBILITY
778 typename enable_if<is_integral<_A1>::value, double>::type
779 cosh(_A1 __x) {return cosh((double)__x);}
790 inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);}
791 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
796 inline _LIBCPP_INLINE_VISIBILITY
797 typename enable_if<is_integral<_A1>::value, double>::type
798 exp(_A1 __x) {return exp((double)__x);}
806 inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);}
807 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);}
811 inline _LIBCPP_INLINE_VISIBILITY
812 typename enable_if<is_integral<_A1>::value, double>::type
813 fabs(_A1 __x) {return fabs((double)__x);}
821 inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);}
822 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);}
826 inline _LIBCPP_INLINE_VISIBILITY
827 typename enable_if<is_integral<_A1>::value, double>::type
828 floor(_A1 __x) {return floor((double)__x);}
838 inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);}
839 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);}
842 template <class _A1, class _A2>
843 inline _LIBCPP_INLINE_VISIBILITY
846 is_arithmetic<_A1>::value &&
847 is_arithmetic<_A2>::value,
848 typename __promote<_A1, _A2>::type
850 fmod(_A1 __x, _A2 __y)
852 typedef typename __promote<_A1, _A2>::type __result_type;
853 static_assert((!(is_same<_A1, __result_type>::value &&
854 is_same<_A2, __result_type>::value)), "");
855 return fmod((__result_type)__x, (__result_type)__y);
865 inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {return frexpf(__x, __e);}
866 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);}
870 inline _LIBCPP_INLINE_VISIBILITY
871 typename enable_if<is_integral<_A1>::value, double>::type
872 frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);}
880 inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {return ldexpf(__x, __e);}
881 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);}
885 inline _LIBCPP_INLINE_VISIBILITY
886 typename enable_if<is_integral<_A1>::value, double>::type
887 ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
897 inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);}
898 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);}
902 inline _LIBCPP_INLINE_VISIBILITY
903 typename enable_if<is_integral<_A1>::value, double>::type
904 log(_A1 __x) {return log((double)__x);}
913 inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);}
914 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);}
918 inline _LIBCPP_INLINE_VISIBILITY
919 typename enable_if<is_integral<_A1>::value, double>::type
920 log10(_A1 __x) {return log10((double)__x);}
928 inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) {return modff(__x, __y);}
929 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) {return modfl(__x, __y);}
941 inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) {return powf(__x, __y);}
942 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
945 template <class _A1, class _A2>
946 inline _LIBCPP_INLINE_VISIBILITY
949 is_arithmetic<_A1>::value &&
950 is_arithmetic<_A2>::value,
951 typename __promote<_A1, _A2>::type
953 pow(_A1 __x, _A2 __y)
955 typedef typename __promote<_A1, _A2>::type __result_type;
956 static_assert((!(is_same<_A1, __result_type>::value &&
957 is_same<_A2, __result_type>::value)), "");
958 return pow((__result_type)__x, (__result_type)__y);
968 inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);}
969 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);}
973 inline _LIBCPP_INLINE_VISIBILITY
974 typename enable_if<is_integral<_A1>::value, double>::type
975 sin(_A1 __x) {return sin((double)__x);}
983 inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);}
984 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);}
988 inline _LIBCPP_INLINE_VISIBILITY
989 typename enable_if<is_integral<_A1>::value, double>::type
990 sinh(_A1 __x) {return sinh((double)__x);}
999 #if !(defined(_MSC_VER) || defined(__sun__))
1000 inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);}
1001 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
1004 template <class _A1>
1005 inline _LIBCPP_INLINE_VISIBILITY
1006 typename enable_if<is_integral<_A1>::value, double>::type
1007 sqrt(_A1 __x) {return sqrt((double)__x);}
1016 inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);}
1017 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);}
1020 template <class _A1>
1021 inline _LIBCPP_INLINE_VISIBILITY
1022 typename enable_if<is_integral<_A1>::value, double>::type
1023 tan(_A1 __x) {return tan((double)__x);}
1031 inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);}
1032 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);}
1035 template <class _A1>
1036 inline _LIBCPP_INLINE_VISIBILITY
1037 typename enable_if<is_integral<_A1>::value, double>::type
1038 tanh(_A1 __x) {return tanh((double)__x);}
1046 inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) {return acoshf(__x);}
1047 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) {return acoshl(__x);}
1049 template <class _A1>
1050 inline _LIBCPP_INLINE_VISIBILITY
1051 typename enable_if<is_integral<_A1>::value, double>::type
1052 acosh(_A1 __x) {return acosh((double)__x);}
1061 inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) {return asinhf(__x);}
1062 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) {return asinhl(__x);}
1064 template <class _A1>
1065 inline _LIBCPP_INLINE_VISIBILITY
1066 typename enable_if<is_integral<_A1>::value, double>::type
1067 asinh(_A1 __x) {return asinh((double)__x);}
1076 inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) {return atanhf(__x);}
1077 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) {return atanhl(__x);}
1079 template <class _A1>
1080 inline _LIBCPP_INLINE_VISIBILITY
1081 typename enable_if<is_integral<_A1>::value, double>::type
1082 atanh(_A1 __x) {return atanh((double)__x);}
1091 inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) {return cbrtf(__x);}
1092 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) {return cbrtl(__x);}
1094 template <class _A1>
1095 inline _LIBCPP_INLINE_VISIBILITY
1096 typename enable_if<is_integral<_A1>::value, double>::type
1097 cbrt(_A1 __x) {return cbrt((double)__x);}
1105 inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) {return copysignf(__x, __y);}
1106 inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) {return copysignl(__x, __y);}
1108 template <class _A1, class _A2>
1109 inline _LIBCPP_INLINE_VISIBILITY
1112 is_arithmetic<_A1>::value &&
1113 is_arithmetic<_A2>::value,
1114 typename __promote<_A1, _A2>::type
1116 copysign(_A1 __x, _A2 __y)
1118 typedef typename __promote<_A1, _A2>::type __result_type;
1119 static_assert((!(is_same<_A1, __result_type>::value &&
1120 is_same<_A2, __result_type>::value)), "");
1121 return copysign((__result_type)__x, (__result_type)__y);
1131 inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) {return erff(__x);}
1132 inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) {return erfl(__x);}
1134 template <class _A1>
1135 inline _LIBCPP_INLINE_VISIBILITY
1136 typename enable_if<is_integral<_A1>::value, double>::type
1137 erf(_A1 __x) {return erf((double)__x);}
1144 inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) {return erfcf(__x);}
1145 inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) {return erfcl(__x);}
1147 template <class _A1>
1148 inline _LIBCPP_INLINE_VISIBILITY
1149 typename enable_if<is_integral<_A1>::value, double>::type
1150 erfc(_A1 __x) {return erfc((double)__x);}
1157 inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) {return exp2f(__x);}
1158 inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) {return exp2l(__x);}
1160 template <class _A1>
1161 inline _LIBCPP_INLINE_VISIBILITY
1162 typename enable_if<is_integral<_A1>::value, double>::type
1163 exp2(_A1 __x) {return exp2((double)__x);}
1170 inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) {return expm1f(__x);}
1171 inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) {return expm1l(__x);}
1173 template <class _A1>
1174 inline _LIBCPP_INLINE_VISIBILITY
1175 typename enable_if<is_integral<_A1>::value, double>::type
1176 expm1(_A1 __x) {return expm1((double)__x);}
1183 inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) {return fdimf(__x, __y);}
1184 inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) {return fdiml(__x, __y);}
1186 template <class _A1, class _A2>
1187 inline _LIBCPP_INLINE_VISIBILITY
1190 is_arithmetic<_A1>::value &&
1191 is_arithmetic<_A2>::value,
1192 typename __promote<_A1, _A2>::type
1194 fdim(_A1 __x, _A2 __y)
1196 typedef typename __promote<_A1, _A2>::type __result_type;
1197 static_assert((!(is_same<_A1, __result_type>::value &&
1198 is_same<_A2, __result_type>::value)), "");
1199 return fdim((__result_type)__x, (__result_type)__y);
1204 inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) {return (float)((double)__x*__y + __z);}
1205 #define FP_FAST_FMAF
1209 inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) {return fmaf(__x, __y, __z);}
1210 inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) {return fmal(__x, __y, __z);}
1212 template <class _A1, class _A2, class _A3>
1213 inline _LIBCPP_INLINE_VISIBILITY
1216 is_arithmetic<_A1>::value &&
1217 is_arithmetic<_A2>::value &&
1218 is_arithmetic<_A3>::value,
1219 typename __promote<_A1, _A2, _A3>::type
1221 fma(_A1 __x, _A2 __y, _A3 __z)
1223 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1224 static_assert((!(is_same<_A1, __result_type>::value &&
1225 is_same<_A2, __result_type>::value &&
1226 is_same<_A3, __result_type>::value)), "");
1227 return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1235 inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) {return fmaxf(__x, __y);}
1236 inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
1238 template <class _A1, class _A2>
1239 inline _LIBCPP_INLINE_VISIBILITY
1242 is_arithmetic<_A1>::value &&
1243 is_arithmetic<_A2>::value,
1244 typename __promote<_A1, _A2>::type
1246 fmax(_A1 __x, _A2 __y)
1248 typedef typename __promote<_A1, _A2>::type __result_type;
1249 static_assert((!(is_same<_A1, __result_type>::value &&
1250 is_same<_A2, __result_type>::value)), "");
1251 return fmax((__result_type)__x, (__result_type)__y);
1259 inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) {return fminf(__x, __y);}
1260 inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) {return fminl(__x, __y);}
1262 template <class _A1, class _A2>
1263 inline _LIBCPP_INLINE_VISIBILITY
1266 is_arithmetic<_A1>::value &&
1267 is_arithmetic<_A2>::value,
1268 typename __promote<_A1, _A2>::type
1270 fmin(_A1 __x, _A2 __y)
1272 typedef typename __promote<_A1, _A2>::type __result_type;
1273 static_assert((!(is_same<_A1, __result_type>::value &&
1274 is_same<_A2, __result_type>::value)), "");
1275 return fmin((__result_type)__x, (__result_type)__y);
1283 inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) {return hypotf(__x, __y);}
1284 inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) {return hypotl(__x, __y);}
1286 template <class _A1, class _A2>
1287 inline _LIBCPP_INLINE_VISIBILITY
1290 is_arithmetic<_A1>::value &&
1291 is_arithmetic<_A2>::value,
1292 typename __promote<_A1, _A2>::type
1294 hypot(_A1 __x, _A2 __y)
1296 typedef typename __promote<_A1, _A2>::type __result_type;
1297 static_assert((!(is_same<_A1, __result_type>::value &&
1298 is_same<_A2, __result_type>::value)), "");
1299 return hypot((__result_type)__x, (__result_type)__y);
1307 inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) {return ilogbf(__x);}
1308 inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) {return ilogbl(__x);}
1310 template <class _A1>
1311 inline _LIBCPP_INLINE_VISIBILITY
1312 typename enable_if<is_integral<_A1>::value, int>::type
1313 ilogb(_A1 __x) {return ilogb((double)__x);}
1320 inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) {return lgammaf(__x);}
1321 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) {return lgammal(__x);}
1324 template <class _A1>
1325 inline _LIBCPP_INLINE_VISIBILITY
1326 typename enable_if<is_integral<_A1>::value, double>::type
1327 lgamma(_A1 __x) {return lgamma((double)__x);}
1335 inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) {return llrintf(__x);}
1336 inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) {return llrintl(__x);}
1338 template <class _A1>
1339 inline _LIBCPP_INLINE_VISIBILITY
1340 typename enable_if<is_integral<_A1>::value, long long>::type
1341 llrint(_A1 __x) {return llrint((double)__x);}
1348 inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) {return llroundf(__x);}
1349 inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) {return llroundl(__x);}
1351 template <class _A1>
1352 inline _LIBCPP_INLINE_VISIBILITY
1353 typename enable_if<is_integral<_A1>::value, long long>::type
1354 llround(_A1 __x) {return llround((double)__x);}
1361 inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) {return log1pf(__x);}
1362 inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) {return log1pl(__x);}
1364 template <class _A1>
1365 inline _LIBCPP_INLINE_VISIBILITY
1366 typename enable_if<is_integral<_A1>::value, double>::type
1367 log1p(_A1 __x) {return log1p((double)__x);}
1374 inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) {return log2f(__x);}
1375 inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) {return log2l(__x);}
1377 template <class _A1>
1378 inline _LIBCPP_INLINE_VISIBILITY
1379 typename enable_if<is_integral<_A1>::value, double>::type
1380 log2(_A1 __x) {return log2((double)__x);}
1387 inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) {return logbf(__x);}
1388 inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) {return logbl(__x);}
1390 template <class _A1>
1391 inline _LIBCPP_INLINE_VISIBILITY
1392 typename enable_if<is_integral<_A1>::value, double>::type
1393 logb(_A1 __x) {return logb((double)__x);}
1400 inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) {return lrintf(__x);}
1401 inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) {return lrintl(__x);}
1403 template <class _A1>
1404 inline _LIBCPP_INLINE_VISIBILITY
1405 typename enable_if<is_integral<_A1>::value, long>::type
1406 lrint(_A1 __x) {return lrint((double)__x);}
1413 inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) {return lroundf(__x);}
1414 inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) {return lroundl(__x);}
1416 template <class _A1>
1417 inline _LIBCPP_INLINE_VISIBILITY
1418 typename enable_if<is_integral<_A1>::value, long>::type
1419 lround(_A1 __x) {return lround((double)__x);}
1434 inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) {return nearbyintf(__x);}
1435 inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) {return nearbyintl(__x);}
1437 template <class _A1>
1438 inline _LIBCPP_INLINE_VISIBILITY
1439 typename enable_if<is_integral<_A1>::value, double>::type
1440 nearbyint(_A1 __x) {return nearbyint((double)__x);}
1447 inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) {return nextafterf(__x, __y);}
1448 inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
1450 template <class _A1, class _A2>
1451 inline _LIBCPP_INLINE_VISIBILITY
1454 is_arithmetic<_A1>::value &&
1455 is_arithmetic<_A2>::value,
1456 typename __promote<_A1, _A2>::type
1458 nextafter(_A1 __x, _A2 __y)
1460 typedef typename __promote<_A1, _A2>::type __result_type;
1461 static_assert((!(is_same<_A1, __result_type>::value &&
1462 is_same<_A2, __result_type>::value)), "");
1463 return nextafter((__result_type)__x, (__result_type)__y);
1469 using ::nexttowardf;
1471 inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
1472 inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
1474 template <class _A1>
1475 inline _LIBCPP_INLINE_VISIBILITY
1476 typename enable_if<is_integral<_A1>::value, double>::type
1477 nexttoward(_A1 __x, long double __y) {return nexttoward((double)__x, __y);}
1484 inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) {return remainderf(__x, __y);}
1485 inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) {return remainderl(__x, __y);}
1487 template <class _A1, class _A2>
1488 inline _LIBCPP_INLINE_VISIBILITY
1491 is_arithmetic<_A1>::value &&
1492 is_arithmetic<_A2>::value,
1493 typename __promote<_A1, _A2>::type
1495 remainder(_A1 __x, _A2 __y)
1497 typedef typename __promote<_A1, _A2>::type __result_type;
1498 static_assert((!(is_same<_A1, __result_type>::value &&
1499 is_same<_A2, __result_type>::value)), "");
1500 return remainder((__result_type)__x, (__result_type)__y);
1508 inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) {return remquof(__x, __y, __z);}
1509 inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) {return remquol(__x, __y, __z);}
1511 template <class _A1, class _A2>
1512 inline _LIBCPP_INLINE_VISIBILITY
1515 is_arithmetic<_A1>::value &&
1516 is_arithmetic<_A2>::value,
1517 typename __promote<_A1, _A2>::type
1519 remquo(_A1 __x, _A2 __y, int* __z)
1521 typedef typename __promote<_A1, _A2>::type __result_type;
1522 static_assert((!(is_same<_A1, __result_type>::value &&
1523 is_same<_A2, __result_type>::value)), "");
1524 return remquo((__result_type)__x, (__result_type)__y, __z);
1532 inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) {return rintf(__x);}
1533 inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) {return rintl(__x);}
1535 template <class _A1>
1536 inline _LIBCPP_INLINE_VISIBILITY
1537 typename enable_if<is_integral<_A1>::value, double>::type
1538 rint(_A1 __x) {return rint((double)__x);}
1545 inline _LIBCPP_INLINE_VISIBILITY float round(float __x) {return roundf(__x);}
1546 inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) {return roundl(__x);}
1548 template <class _A1>
1549 inline _LIBCPP_INLINE_VISIBILITY
1550 typename enable_if<is_integral<_A1>::value, double>::type
1551 round(_A1 __x) {return round((double)__x);}
1558 inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) {return scalblnf(__x, __y);}
1559 inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
1561 template <class _A1>
1562 inline _LIBCPP_INLINE_VISIBILITY
1563 typename enable_if<is_integral<_A1>::value, double>::type
1564 scalbln(_A1 __x, long __y) {return scalbln((double)__x, __y);}
1571 inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) {return scalbnf(__x, __y);}
1572 inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
1574 template <class _A1>
1575 inline _LIBCPP_INLINE_VISIBILITY
1576 typename enable_if<is_integral<_A1>::value, double>::type
1577 scalbn(_A1 __x, int __y) {return scalbn((double)__x, __y);}
1584 inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) {return tgammaf(__x);}
1585 inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) {return tgammal(__x);}
1587 template <class _A1>
1588 inline _LIBCPP_INLINE_VISIBILITY
1589 typename enable_if<is_integral<_A1>::value, double>::type
1590 tgamma(_A1 __x) {return tgamma((double)__x);}
1597 inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) {return truncf(__x);}
1598 inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) {return truncl(__x);}
1600 template <class _A1>
1601 inline _LIBCPP_INLINE_VISIBILITY
1602 typename enable_if<is_integral<_A1>::value, double>::type
1603 trunc(_A1 __x) {return trunc((double)__x);}
1658 using ::nexttowardl;
1673 _LIBCPP_END_NAMESPACE_STD
1675 #endif // _LIBCPP_CMATH