2 //===---------------------------- math.h ----------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_MATH_H
11 #define _LIBCPP_MATH_H
35 math_errhandling // C99
44 floating_point abs(floating_point x);
46 floating_point acos (arithmetic x);
48 long double acosl(long double x);
50 floating_point asin (arithmetic x);
52 long double asinl(long double x);
54 floating_point atan (arithmetic x);
56 long double atanl(long double x);
58 floating_point atan2 (arithmetic y, arithmetic x);
59 float atan2f(float y, float x);
60 long double atan2l(long double y, long double x);
62 floating_point ceil (arithmetic x);
64 long double ceill(long double x);
66 floating_point cos (arithmetic x);
68 long double cosl(long double x);
70 floating_point cosh (arithmetic x);
72 long double coshl(long double x);
74 floating_point exp (arithmetic x);
76 long double expl(long double x);
78 floating_point fabs (arithmetic x);
80 long double fabsl(long double x);
82 floating_point floor (arithmetic x);
83 float floorf(float x);
84 long double floorl(long double x);
86 floating_point fmod (arithmetic x, arithmetic y);
87 float fmodf(float x, float y);
88 long double fmodl(long double x, long double y);
90 floating_point frexp (arithmetic value, int* exp);
91 float frexpf(float value, int* exp);
92 long double frexpl(long double value, int* exp);
94 floating_point ldexp (arithmetic value, int exp);
95 float ldexpf(float value, int exp);
96 long double ldexpl(long double value, int exp);
98 floating_point log (arithmetic x);
100 long double logl(long double x);
102 floating_point log10 (arithmetic x);
103 float log10f(float x);
104 long double log10l(long double x);
106 floating_point modf (floating_point value, floating_point* iptr);
107 float modff(float value, float* iptr);
108 long double modfl(long double value, long double* iptr);
110 floating_point pow (arithmetic x, arithmetic y);
111 float powf(float x, float y);
112 long double powl(long double x, long double y);
114 floating_point sin (arithmetic x);
116 long double sinl(long double x);
118 floating_point sinh (arithmetic x);
119 float sinhf(float x);
120 long double sinhl(long double x);
122 floating_point sqrt (arithmetic x);
123 float sqrtf(float x);
124 long double sqrtl(long double x);
126 floating_point tan (arithmetic x);
128 long double tanl(long double x);
130 floating_point tanh (arithmetic x);
131 float tanhf(float x);
132 long double tanhl(long double x);
136 bool signbit(arithmetic x);
138 int fpclassify(arithmetic x);
140 bool isfinite(arithmetic x);
141 bool isinf(arithmetic x);
142 bool isnan(arithmetic x);
143 bool isnormal(arithmetic x);
145 bool isgreater(arithmetic x, arithmetic y);
146 bool isgreaterequal(arithmetic x, arithmetic y);
147 bool isless(arithmetic x, arithmetic y);
148 bool islessequal(arithmetic x, arithmetic y);
149 bool islessgreater(arithmetic x, arithmetic y);
150 bool isunordered(arithmetic x, arithmetic y);
152 floating_point acosh (arithmetic x);
153 float acoshf(float x);
154 long double acoshl(long double x);
156 floating_point asinh (arithmetic x);
157 float asinhf(float x);
158 long double asinhl(long double x);
160 floating_point atanh (arithmetic x);
161 float atanhf(float x);
162 long double atanhl(long double x);
164 floating_point cbrt (arithmetic x);
165 float cbrtf(float x);
166 long double cbrtl(long double x);
168 floating_point copysign (arithmetic x, arithmetic y);
169 float copysignf(float x, float y);
170 long double copysignl(long double x, long double y);
172 floating_point erf (arithmetic x);
174 long double erfl(long double x);
176 floating_point erfc (arithmetic x);
177 float erfcf(float x);
178 long double erfcl(long double x);
180 floating_point exp2 (arithmetic x);
181 float exp2f(float x);
182 long double exp2l(long double x);
184 floating_point expm1 (arithmetic x);
185 float expm1f(float x);
186 long double expm1l(long double x);
188 floating_point fdim (arithmetic x, arithmetic y);
189 float fdimf(float x, float y);
190 long double fdiml(long double x, long double y);
192 floating_point fma (arithmetic x, arithmetic y, arithmetic z);
193 float fmaf(float x, float y, float z);
194 long double fmal(long double x, long double y, long double z);
196 floating_point fmax (arithmetic x, arithmetic y);
197 float fmaxf(float x, float y);
198 long double fmaxl(long double x, long double y);
200 floating_point fmin (arithmetic x, arithmetic y);
201 float fminf(float x, float y);
202 long double fminl(long double x, long double y);
204 floating_point hypot (arithmetic x, arithmetic y);
205 float hypotf(float x, float y);
206 long double hypotl(long double x, long double y);
208 int ilogb (arithmetic x);
210 int ilogbl(long double x);
212 floating_point lgamma (arithmetic x);
213 float lgammaf(float x);
214 long double lgammal(long double x);
216 long long llrint (arithmetic x);
217 long long llrintf(float x);
218 long long llrintl(long double x);
220 long long llround (arithmetic x);
221 long long llroundf(float x);
222 long long llroundl(long double x);
224 floating_point log1p (arithmetic x);
225 float log1pf(float x);
226 long double log1pl(long double x);
228 floating_point log2 (arithmetic x);
229 float log2f(float x);
230 long double log2l(long double x);
232 floating_point logb (arithmetic x);
233 float logbf(float x);
234 long double logbl(long double x);
236 long lrint (arithmetic x);
237 long lrintf(float x);
238 long lrintl(long double x);
240 long lround (arithmetic x);
241 long lroundf(float x);
242 long lroundl(long double x);
244 double nan (const char* str);
245 float nanf(const char* str);
246 long double nanl(const char* str);
248 floating_point nearbyint (arithmetic x);
249 float nearbyintf(float x);
250 long double nearbyintl(long double x);
252 floating_point nextafter (arithmetic x, arithmetic y);
253 float nextafterf(float x, float y);
254 long double nextafterl(long double x, long double y);
256 floating_point nexttoward (arithmetic x, long double y);
257 float nexttowardf(float x, long double y);
258 long double nexttowardl(long double x, long double y);
260 floating_point remainder (arithmetic x, arithmetic y);
261 float remainderf(float x, float y);
262 long double remainderl(long double x, long double y);
264 floating_point remquo (arithmetic x, arithmetic y, int* pquo);
265 float remquof(float x, float y, int* pquo);
266 long double remquol(long double x, long double y, int* pquo);
268 floating_point rint (arithmetic x);
269 float rintf(float x);
270 long double rintl(long double x);
272 floating_point round (arithmetic x);
273 float roundf(float x);
274 long double roundl(long double x);
276 floating_point scalbln (arithmetic x, long ex);
277 float scalblnf(float x, long ex);
278 long double scalblnl(long double x, long ex);
280 floating_point scalbn (arithmetic x, int ex);
281 float scalbnf(float x, int ex);
282 long double scalbnl(long double x, int ex);
284 floating_point tgamma (arithmetic x);
285 float tgammaf(float x);
286 long double tgammal(long double x);
288 floating_point trunc (arithmetic x);
289 float truncf(float x);
290 long double truncl(long double x);
296 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
297 #pragma GCC system_header
300 #define _LIBCPP_STDLIB_INCLUDE_NEXT
303 #include_next <math.h>
307 // We support including .h headers inside 'extern "C"' contexts, so switch
308 // back to C++ linkage before including these C++ headers.
311 #include <type_traits>
319 _LIBCPP_INLINE_VISIBILITY
321 __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
323 return signbit(__lcpp_x);
329 inline _LIBCPP_INLINE_VISIBILITY
330 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
331 signbit(_A1 __lcpp_x) _NOEXCEPT
333 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
337 inline _LIBCPP_INLINE_VISIBILITY
338 typename std::enable_if<
339 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
340 signbit(_A1 __lcpp_x) _NOEXCEPT
341 { return __lcpp_x < 0; }
344 inline _LIBCPP_INLINE_VISIBILITY
345 typename std::enable_if<
346 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
347 signbit(_A1) _NOEXCEPT
350 #elif defined(_LIBCPP_MSVCRT)
352 template <typename _A1>
353 inline _LIBCPP_INLINE_VISIBILITY
354 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
355 signbit(_A1 __lcpp_x) _NOEXCEPT
357 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
361 inline _LIBCPP_INLINE_VISIBILITY
362 typename std::enable_if<
363 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
364 signbit(_A1 __lcpp_x) _NOEXCEPT
365 { return __lcpp_x < 0; }
368 inline _LIBCPP_INLINE_VISIBILITY
369 typename std::enable_if<
370 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
371 signbit(_A1) _NOEXCEPT
381 _LIBCPP_INLINE_VISIBILITY
383 __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
385 return fpclassify(__lcpp_x);
391 inline _LIBCPP_INLINE_VISIBILITY
392 typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
393 fpclassify(_A1 __lcpp_x) _NOEXCEPT
395 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
399 inline _LIBCPP_INLINE_VISIBILITY
400 typename std::enable_if<std::is_integral<_A1>::value, int>::type
401 fpclassify(_A1 __lcpp_x) _NOEXCEPT
402 { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
404 #elif defined(_LIBCPP_MSVCRT)
406 template <typename _A1>
407 inline _LIBCPP_INLINE_VISIBILITY
408 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
409 fpclassify(_A1 __lcpp_x) _NOEXCEPT
411 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
415 inline _LIBCPP_INLINE_VISIBILITY
416 typename std::enable_if<std::is_integral<_A1>::value, int>::type
417 fpclassify(_A1 __lcpp_x) _NOEXCEPT
418 { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
427 _LIBCPP_INLINE_VISIBILITY
429 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
431 return isfinite(__lcpp_x);
437 inline _LIBCPP_INLINE_VISIBILITY
438 typename std::enable_if<
439 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
441 isfinite(_A1 __lcpp_x) _NOEXCEPT
443 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
447 inline _LIBCPP_INLINE_VISIBILITY
448 typename std::enable_if<
449 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
451 isfinite(_A1) _NOEXCEPT
461 _LIBCPP_INLINE_VISIBILITY
463 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
465 return isinf(__lcpp_x);
471 inline _LIBCPP_INLINE_VISIBILITY
472 typename std::enable_if<
473 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
475 isinf(_A1 __lcpp_x) _NOEXCEPT
477 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
481 inline _LIBCPP_INLINE_VISIBILITY
482 typename std::enable_if<
483 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
488 #ifdef _LIBCPP_PREFERRED_OVERLOAD
489 inline _LIBCPP_INLINE_VISIBILITY
491 isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
493 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
495 isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
497 inline _LIBCPP_INLINE_VISIBILITY
499 isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
509 _LIBCPP_INLINE_VISIBILITY
511 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
513 #if __has_builtin(__builtin_isnan)
514 return __builtin_isnan(__lcpp_x);
516 return isnan(__lcpp_x);
523 inline _LIBCPP_INLINE_VISIBILITY
524 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
525 isnan(_A1 __lcpp_x) _NOEXCEPT
527 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
531 inline _LIBCPP_INLINE_VISIBILITY
532 typename std::enable_if<std::is_integral<_A1>::value, bool>::type
536 #ifdef _LIBCPP_PREFERRED_OVERLOAD
537 inline _LIBCPP_INLINE_VISIBILITY
539 isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
541 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
543 isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
545 inline _LIBCPP_INLINE_VISIBILITY
547 isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
557 _LIBCPP_INLINE_VISIBILITY
559 __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
561 return isnormal(__lcpp_x);
567 inline _LIBCPP_INLINE_VISIBILITY
568 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
569 isnormal(_A1 __lcpp_x) _NOEXCEPT
571 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
575 inline _LIBCPP_INLINE_VISIBILITY
576 typename std::enable_if<std::is_integral<_A1>::value, bool>::type
577 isnormal(_A1 __lcpp_x) _NOEXCEPT
578 { return __lcpp_x != 0; }
586 template <class _A1, class _A2>
587 _LIBCPP_INLINE_VISIBILITY
589 __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
591 return isgreater(__lcpp_x, __lcpp_y);
596 template <class _A1, class _A2>
597 inline _LIBCPP_INLINE_VISIBILITY
598 typename std::enable_if
600 std::is_arithmetic<_A1>::value &&
601 std::is_arithmetic<_A2>::value,
604 isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
606 typedef typename std::__promote<_A1, _A2>::type type;
607 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
614 #ifdef isgreaterequal
616 template <class _A1, class _A2>
617 _LIBCPP_INLINE_VISIBILITY
619 __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
621 return isgreaterequal(__lcpp_x, __lcpp_y);
624 #undef isgreaterequal
626 template <class _A1, class _A2>
627 inline _LIBCPP_INLINE_VISIBILITY
628 typename std::enable_if
630 std::is_arithmetic<_A1>::value &&
631 std::is_arithmetic<_A2>::value,
634 isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
636 typedef typename std::__promote<_A1, _A2>::type type;
637 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
640 #endif // isgreaterequal
646 template <class _A1, class _A2>
647 _LIBCPP_INLINE_VISIBILITY
649 __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
651 return isless(__lcpp_x, __lcpp_y);
656 template <class _A1, class _A2>
657 inline _LIBCPP_INLINE_VISIBILITY
658 typename std::enable_if
660 std::is_arithmetic<_A1>::value &&
661 std::is_arithmetic<_A2>::value,
664 isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
666 typedef typename std::__promote<_A1, _A2>::type type;
667 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
676 template <class _A1, class _A2>
677 _LIBCPP_INLINE_VISIBILITY
679 __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
681 return islessequal(__lcpp_x, __lcpp_y);
686 template <class _A1, class _A2>
687 inline _LIBCPP_INLINE_VISIBILITY
688 typename std::enable_if
690 std::is_arithmetic<_A1>::value &&
691 std::is_arithmetic<_A2>::value,
694 islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
696 typedef typename std::__promote<_A1, _A2>::type type;
697 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
700 #endif // islessequal
706 template <class _A1, class _A2>
707 _LIBCPP_INLINE_VISIBILITY
709 __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
711 return islessgreater(__lcpp_x, __lcpp_y);
716 template <class _A1, class _A2>
717 inline _LIBCPP_INLINE_VISIBILITY
718 typename std::enable_if
720 std::is_arithmetic<_A1>::value &&
721 std::is_arithmetic<_A2>::value,
724 islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
726 typedef typename std::__promote<_A1, _A2>::type type;
727 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
730 #endif // islessgreater
736 template <class _A1, class _A2>
737 _LIBCPP_INLINE_VISIBILITY
739 __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
741 return isunordered(__lcpp_x, __lcpp_y);
746 template <class _A1, class _A2>
747 inline _LIBCPP_INLINE_VISIBILITY
748 typename std::enable_if
750 std::is_arithmetic<_A1>::value &&
751 std::is_arithmetic<_A2>::value,
754 isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
756 typedef typename std::__promote<_A1, _A2>::type type;
757 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
760 #endif // isunordered
766 #ifndef _LIBCPP_HAS_NO_LONG_LONG
770 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
771 #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
772 inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
775 #ifndef _LIBCPP_HAS_NO_LONG_LONG
776 inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
779 #endif // _LIBCPP_HAS_NO_LONG_LONG
780 #endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
783 #if !(defined(_AIX) || defined(__sun__))
784 inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
785 return ::fabsf(__lcpp_x);
788 inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
789 return ::fabs(__lcpp_x);
792 inline _LIBCPP_INLINE_VISIBILITY long double
793 abs(long double __lcpp_x) _NOEXCEPT {
794 return ::fabsl(__lcpp_x);
796 #endif // !(defined(_AIX) || defined(__sun__))
802 #ifndef _LIBCPP_HAS_NO_LONG_LONG
806 // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
807 #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
808 inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
809 return ::ldiv(__x, __y);
811 #ifndef _LIBCPP_HAS_NO_LONG_LONG
812 inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
813 long long __y) _NOEXCEPT {
814 return ::lldiv(__x, __y);
816 #endif // _LIBCPP_HAS_NO_LONG_LONG
817 #endif // _LIBCPP_MSVCRT / __sun__ / _AIX
821 #if !(defined(_AIX) || defined(__sun__))
822 inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
823 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
827 inline _LIBCPP_INLINE_VISIBILITY
828 typename std::enable_if<std::is_integral<_A1>::value, double>::type
829 acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
833 #if !(defined(_AIX) || defined(__sun__))
834 inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
835 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
839 inline _LIBCPP_INLINE_VISIBILITY
840 typename std::enable_if<std::is_integral<_A1>::value, double>::type
841 asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
845 #if !(defined(_AIX) || defined(__sun__))
846 inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
847 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
851 inline _LIBCPP_INLINE_VISIBILITY
852 typename std::enable_if<std::is_integral<_A1>::value, double>::type
853 atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
857 #if !(defined(_AIX) || defined(__sun__))
858 inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
859 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
862 template <class _A1, class _A2>
863 inline _LIBCPP_INLINE_VISIBILITY
864 typename std::_EnableIf
866 std::is_arithmetic<_A1>::value &&
867 std::is_arithmetic<_A2>::value,
868 std::__promote<_A1, _A2>
870 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
872 typedef typename std::__promote<_A1, _A2>::type __result_type;
873 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
874 std::_IsSame<_A2, __result_type>::value)), "");
875 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
880 #if !(defined(_AIX) || defined(__sun__))
881 inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
882 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
886 inline _LIBCPP_INLINE_VISIBILITY
887 typename std::enable_if<std::is_integral<_A1>::value, double>::type
888 ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
892 #if !(defined(_AIX) || defined(__sun__))
893 inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
894 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
898 inline _LIBCPP_INLINE_VISIBILITY
899 typename std::enable_if<std::is_integral<_A1>::value, double>::type
900 cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
904 #if !(defined(_AIX) || defined(__sun__))
905 inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
906 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
910 inline _LIBCPP_INLINE_VISIBILITY
911 typename std::enable_if<std::is_integral<_A1>::value, double>::type
912 cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
916 #if !(defined(_AIX) || defined(__sun__))
917 inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
918 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
922 inline _LIBCPP_INLINE_VISIBILITY
923 typename std::enable_if<std::is_integral<_A1>::value, double>::type
924 exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
928 #if !(defined(_AIX) || defined(__sun__))
929 inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
930 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
934 inline _LIBCPP_INLINE_VISIBILITY
935 typename std::enable_if<std::is_integral<_A1>::value, double>::type
936 fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
940 #if !(defined(_AIX) || defined(__sun__))
941 inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
942 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
946 inline _LIBCPP_INLINE_VISIBILITY
947 typename std::enable_if<std::is_integral<_A1>::value, double>::type
948 floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
952 #if !(defined(_AIX) || defined(__sun__))
953 inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
954 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
957 template <class _A1, class _A2>
958 inline _LIBCPP_INLINE_VISIBILITY
959 typename std::_EnableIf
961 std::is_arithmetic<_A1>::value &&
962 std::is_arithmetic<_A2>::value,
963 std::__promote<_A1, _A2>
965 fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
967 typedef typename std::__promote<_A1, _A2>::type __result_type;
968 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
969 std::_IsSame<_A2, __result_type>::value)), "");
970 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
975 #if !(defined(_AIX) || defined(__sun__))
976 inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
977 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
981 inline _LIBCPP_INLINE_VISIBILITY
982 typename std::enable_if<std::is_integral<_A1>::value, double>::type
983 frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
987 #if !(defined(_AIX) || defined(__sun__))
988 inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
989 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
993 inline _LIBCPP_INLINE_VISIBILITY
994 typename std::enable_if<std::is_integral<_A1>::value, double>::type
995 ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
999 #if !(defined(_AIX) || defined(__sun__))
1000 inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
1001 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
1004 template <class _A1>
1005 inline _LIBCPP_INLINE_VISIBILITY
1006 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1007 log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
1011 #if !(defined(_AIX) || defined(__sun__))
1012 inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
1013 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
1016 template <class _A1>
1017 inline _LIBCPP_INLINE_VISIBILITY
1018 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1019 log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
1023 #if !(defined(_AIX) || defined(__sun__))
1024 inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
1025 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
1030 #if !(defined(_AIX) || defined(__sun__))
1031 inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
1032 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
1035 template <class _A1, class _A2>
1036 inline _LIBCPP_INLINE_VISIBILITY
1037 typename std::_EnableIf
1039 std::is_arithmetic<_A1>::value &&
1040 std::is_arithmetic<_A2>::value,
1041 std::__promote<_A1, _A2>
1043 pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1045 typedef typename std::__promote<_A1, _A2>::type __result_type;
1046 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1047 std::_IsSame<_A2, __result_type>::value)), "");
1048 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1053 #if !(defined(_AIX) || defined(__sun__))
1054 inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
1055 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
1058 template <class _A1>
1059 inline _LIBCPP_INLINE_VISIBILITY
1060 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1061 sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
1065 #if !(defined(_AIX) || defined(__sun__))
1066 inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
1067 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
1070 template <class _A1>
1071 inline _LIBCPP_INLINE_VISIBILITY
1072 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1073 sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
1077 #if !(defined(_AIX) || defined(__sun__))
1078 inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1079 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
1082 template <class _A1>
1083 inline _LIBCPP_INLINE_VISIBILITY
1084 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1085 sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
1089 #if !(defined(_AIX) || defined(__sun__))
1090 inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1091 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
1094 template <class _A1>
1095 inline _LIBCPP_INLINE_VISIBILITY
1096 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1097 tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
1101 #if !(defined(_AIX) || defined(__sun__))
1102 inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1103 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
1106 template <class _A1>
1107 inline _LIBCPP_INLINE_VISIBILITY
1108 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1109 tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
1113 inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1114 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
1116 template <class _A1>
1117 inline _LIBCPP_INLINE_VISIBILITY
1118 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1119 acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
1123 inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1124 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
1126 template <class _A1>
1127 inline _LIBCPP_INLINE_VISIBILITY
1128 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1129 asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
1133 inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1134 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
1136 template <class _A1>
1137 inline _LIBCPP_INLINE_VISIBILITY
1138 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1139 atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
1143 inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1144 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
1146 template <class _A1>
1147 inline _LIBCPP_INLINE_VISIBILITY
1148 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1149 cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
1153 inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1154 float __lcpp_y) _NOEXCEPT {
1155 return ::copysignf(__lcpp_x, __lcpp_y);
1157 inline _LIBCPP_INLINE_VISIBILITY long double
1158 copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
1159 return ::copysignl(__lcpp_x, __lcpp_y);
1162 template <class _A1, class _A2>
1163 inline _LIBCPP_INLINE_VISIBILITY
1164 typename std::_EnableIf
1166 std::is_arithmetic<_A1>::value &&
1167 std::is_arithmetic<_A2>::value,
1168 std::__promote<_A1, _A2>
1170 copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1172 typedef typename std::__promote<_A1, _A2>::type __result_type;
1173 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1174 std::_IsSame<_A2, __result_type>::value)), "");
1175 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1180 inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1181 inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
1183 template <class _A1>
1184 inline _LIBCPP_INLINE_VISIBILITY
1185 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1186 erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
1190 inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1191 inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
1193 template <class _A1>
1194 inline _LIBCPP_INLINE_VISIBILITY
1195 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1196 erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
1200 inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1201 inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
1203 template <class _A1>
1204 inline _LIBCPP_INLINE_VISIBILITY
1205 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1206 exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
1210 inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1211 inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
1213 template <class _A1>
1214 inline _LIBCPP_INLINE_VISIBILITY
1215 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1216 expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
1220 inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1221 inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
1223 template <class _A1, class _A2>
1224 inline _LIBCPP_INLINE_VISIBILITY
1225 typename std::_EnableIf
1227 std::is_arithmetic<_A1>::value &&
1228 std::is_arithmetic<_A2>::value,
1229 std::__promote<_A1, _A2>
1231 fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1233 typedef typename std::__promote<_A1, _A2>::type __result_type;
1234 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1235 std::_IsSame<_A2, __result_type>::value)), "");
1236 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1241 inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1242 inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
1244 template <class _A1, class _A2, class _A3>
1245 inline _LIBCPP_INLINE_VISIBILITY
1246 typename std::_EnableIf
1248 std::is_arithmetic<_A1>::value &&
1249 std::is_arithmetic<_A2>::value &&
1250 std::is_arithmetic<_A3>::value,
1251 std::__promote<_A1, _A2, _A3>
1253 fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1255 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1256 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1257 std::_IsSame<_A2, __result_type>::value &&
1258 std::_IsSame<_A3, __result_type>::value)), "");
1259 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1264 inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1265 inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
1267 template <class _A1, class _A2>
1268 inline _LIBCPP_INLINE_VISIBILITY
1269 typename std::_EnableIf
1271 std::is_arithmetic<_A1>::value &&
1272 std::is_arithmetic<_A2>::value,
1273 std::__promote<_A1, _A2>
1275 fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1277 typedef typename std::__promote<_A1, _A2>::type __result_type;
1278 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1279 std::_IsSame<_A2, __result_type>::value)), "");
1280 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1285 inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1286 inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
1288 template <class _A1, class _A2>
1289 inline _LIBCPP_INLINE_VISIBILITY
1290 typename std::_EnableIf
1292 std::is_arithmetic<_A1>::value &&
1293 std::is_arithmetic<_A2>::value,
1294 std::__promote<_A1, _A2>
1296 fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1298 typedef typename std::__promote<_A1, _A2>::type __result_type;
1299 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1300 std::_IsSame<_A2, __result_type>::value)), "");
1301 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1306 inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1307 inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
1309 template <class _A1, class _A2>
1310 inline _LIBCPP_INLINE_VISIBILITY
1311 typename std::_EnableIf
1313 std::is_arithmetic<_A1>::value &&
1314 std::is_arithmetic<_A2>::value,
1315 std::__promote<_A1, _A2>
1317 hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1319 typedef typename std::__promote<_A1, _A2>::type __result_type;
1320 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1321 std::_IsSame<_A2, __result_type>::value)), "");
1322 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1327 inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1328 inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
1330 template <class _A1>
1331 inline _LIBCPP_INLINE_VISIBILITY
1332 typename std::enable_if<std::is_integral<_A1>::value, int>::type
1333 ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
1337 inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1338 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
1340 template <class _A1>
1341 inline _LIBCPP_INLINE_VISIBILITY
1342 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1343 lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
1347 inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1348 inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
1350 template <class _A1>
1351 inline _LIBCPP_INLINE_VISIBILITY
1352 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
1353 llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
1357 inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1358 inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
1360 template <class _A1>
1361 inline _LIBCPP_INLINE_VISIBILITY
1362 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
1363 llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
1367 inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1368 inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
1370 template <class _A1>
1371 inline _LIBCPP_INLINE_VISIBILITY
1372 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1373 log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
1377 inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1378 inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
1380 template <class _A1>
1381 inline _LIBCPP_INLINE_VISIBILITY
1382 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1383 log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
1387 inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1388 inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
1390 template <class _A1>
1391 inline _LIBCPP_INLINE_VISIBILITY
1392 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1393 logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
1397 inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1398 inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
1400 template <class _A1>
1401 inline _LIBCPP_INLINE_VISIBILITY
1402 typename std::enable_if<std::is_integral<_A1>::value, long>::type
1403 lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
1407 inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1408 inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
1410 template <class _A1>
1411 inline _LIBCPP_INLINE_VISIBILITY
1412 typename std::enable_if<std::is_integral<_A1>::value, long>::type
1413 lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
1419 inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1420 inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
1422 template <class _A1>
1423 inline _LIBCPP_INLINE_VISIBILITY
1424 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1425 nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
1429 inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1430 inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
1432 template <class _A1, class _A2>
1433 inline _LIBCPP_INLINE_VISIBILITY
1434 typename std::_EnableIf
1436 std::is_arithmetic<_A1>::value &&
1437 std::is_arithmetic<_A2>::value,
1438 std::__promote<_A1, _A2>
1440 nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1442 typedef typename std::__promote<_A1, _A2>::type __result_type;
1443 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1444 std::_IsSame<_A2, __result_type>::value)), "");
1445 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1450 inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1451 inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
1453 template <class _A1>
1454 inline _LIBCPP_INLINE_VISIBILITY
1455 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1456 nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
1460 inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1461 inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
1463 template <class _A1, class _A2>
1464 inline _LIBCPP_INLINE_VISIBILITY
1465 typename std::_EnableIf
1467 std::is_arithmetic<_A1>::value &&
1468 std::is_arithmetic<_A2>::value,
1469 std::__promote<_A1, _A2>
1471 remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1473 typedef typename std::__promote<_A1, _A2>::type __result_type;
1474 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1475 std::_IsSame<_A2, __result_type>::value)), "");
1476 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1481 inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1482 inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
1484 template <class _A1, class _A2>
1485 inline _LIBCPP_INLINE_VISIBILITY
1486 typename std::_EnableIf
1488 std::is_arithmetic<_A1>::value &&
1489 std::is_arithmetic<_A2>::value,
1490 std::__promote<_A1, _A2>
1492 remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1494 typedef typename std::__promote<_A1, _A2>::type __result_type;
1495 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1496 std::_IsSame<_A2, __result_type>::value)), "");
1497 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
1502 inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1503 inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
1505 template <class _A1>
1506 inline _LIBCPP_INLINE_VISIBILITY
1507 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1508 rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
1512 inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1513 inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
1515 template <class _A1>
1516 inline _LIBCPP_INLINE_VISIBILITY
1517 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1518 round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
1522 inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1523 inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
1525 template <class _A1>
1526 inline _LIBCPP_INLINE_VISIBILITY
1527 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1528 scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
1532 inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1533 inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
1535 template <class _A1>
1536 inline _LIBCPP_INLINE_VISIBILITY
1537 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1538 scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
1542 inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1543 inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
1545 template <class _A1>
1546 inline _LIBCPP_INLINE_VISIBILITY
1547 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1548 tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
1552 inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1553 inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
1555 template <class _A1>
1556 inline _LIBCPP_INLINE_VISIBILITY
1557 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1558 trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
1562 #endif // __cplusplus
1564 #else // _LIBCPP_MATH_H
1566 // This include lives outside the header guard in order to support an MSVC
1567 // extension which allows users to do:
1569 // #define _USE_MATH_DEFINES
1570 // #include <math.h>
1572 // and receive the definitions of mathematical constants, even if <math.h>
1573 // has previously been included.
1574 #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1575 #include_next <math.h>
1578 #endif // _LIBCPP_MATH_H