xref: /freebsd/contrib/llvm-project/libcxx/include/math.h (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
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
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef _LIBCPP_MATH_H
11 #define _LIBCPP_MATH_H
12 
13 /*
14     math.h synopsis
15 
16 Macros:
17 
18     HUGE_VAL
19     HUGE_VALF               // C99
20     HUGE_VALL               // C99
21     INFINITY                // C99
22     NAN                     // C99
23     FP_INFINITE             // C99
24     FP_NAN                  // C99
25     FP_NORMAL               // C99
26     FP_SUBNORMAL            // C99
27     FP_ZERO                 // C99
28     FP_FAST_FMA             // C99
29     FP_FAST_FMAF            // C99
30     FP_FAST_FMAL            // C99
31     FP_ILOGB0               // C99
32     FP_ILOGBNAN             // C99
33     MATH_ERRNO              // C99
34     MATH_ERREXCEPT          // C99
35     math_errhandling        // C99
36 
37 Types:
38 
39     float_t                 // C99
40     double_t                // C99
41 
42 // C90
43 
44 floating_point abs(floating_point x);
45 
46 floating_point acos (arithmetic x);
47 float          acosf(float x);
48 long double    acosl(long double x);
49 
50 floating_point asin (arithmetic x);
51 float          asinf(float x);
52 long double    asinl(long double x);
53 
54 floating_point atan (arithmetic x);
55 float          atanf(float x);
56 long double    atanl(long double x);
57 
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);
61 
62 floating_point ceil (arithmetic x);
63 float          ceilf(float x);
64 long double    ceill(long double x);
65 
66 floating_point cos (arithmetic x);
67 float          cosf(float x);
68 long double    cosl(long double x);
69 
70 floating_point cosh (arithmetic x);
71 float          coshf(float x);
72 long double    coshl(long double x);
73 
74 floating_point exp (arithmetic x);
75 float          expf(float x);
76 long double    expl(long double x);
77 
78 floating_point fabs (arithmetic x);
79 float          fabsf(float x);
80 long double    fabsl(long double x);
81 
82 floating_point floor (arithmetic x);
83 float          floorf(float x);
84 long double    floorl(long double x);
85 
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);
89 
90 floating_point frexp (arithmetic value, int* exp);
91 float          frexpf(float value, int* exp);
92 long double    frexpl(long double value, int* exp);
93 
94 floating_point ldexp (arithmetic value, int exp);
95 float          ldexpf(float value, int exp);
96 long double    ldexpl(long double value, int exp);
97 
98 floating_point log (arithmetic x);
99 float          logf(float x);
100 long double    logl(long double x);
101 
102 floating_point log10 (arithmetic x);
103 float          log10f(float x);
104 long double    log10l(long double x);
105 
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);
109 
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);
113 
114 floating_point sin (arithmetic x);
115 float          sinf(float x);
116 long double    sinl(long double x);
117 
118 floating_point sinh (arithmetic x);
119 float          sinhf(float x);
120 long double    sinhl(long double x);
121 
122 floating_point sqrt (arithmetic x);
123 float          sqrtf(float x);
124 long double    sqrtl(long double x);
125 
126 floating_point tan (arithmetic x);
127 float          tanf(float x);
128 long double    tanl(long double x);
129 
130 floating_point tanh (arithmetic x);
131 float          tanhf(float x);
132 long double    tanhl(long double x);
133 
134 //  C99
135 
136 bool signbit(arithmetic x);
137 
138 int fpclassify(arithmetic x);
139 
140 bool isfinite(arithmetic x);
141 bool isinf(arithmetic x);
142 bool isnan(arithmetic x);
143 bool isnormal(arithmetic x);
144 
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);
151 
152 floating_point acosh (arithmetic x);
153 float          acoshf(float x);
154 long double    acoshl(long double x);
155 
156 floating_point asinh (arithmetic x);
157 float          asinhf(float x);
158 long double    asinhl(long double x);
159 
160 floating_point atanh (arithmetic x);
161 float          atanhf(float x);
162 long double    atanhl(long double x);
163 
164 floating_point cbrt (arithmetic x);
165 float          cbrtf(float x);
166 long double    cbrtl(long double x);
167 
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);
171 
172 floating_point erf (arithmetic x);
173 float          erff(float x);
174 long double    erfl(long double x);
175 
176 floating_point erfc (arithmetic x);
177 float          erfcf(float x);
178 long double    erfcl(long double x);
179 
180 floating_point exp2 (arithmetic x);
181 float          exp2f(float x);
182 long double    exp2l(long double x);
183 
184 floating_point expm1 (arithmetic x);
185 float          expm1f(float x);
186 long double    expm1l(long double x);
187 
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);
191 
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);
195 
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);
199 
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);
203 
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);
207 
208 int ilogb (arithmetic x);
209 int ilogbf(float x);
210 int ilogbl(long double x);
211 
212 floating_point lgamma (arithmetic x);
213 float          lgammaf(float x);
214 long double    lgammal(long double x);
215 
216 long long llrint (arithmetic x);
217 long long llrintf(float x);
218 long long llrintl(long double x);
219 
220 long long llround (arithmetic x);
221 long long llroundf(float x);
222 long long llroundl(long double x);
223 
224 floating_point log1p (arithmetic x);
225 float          log1pf(float x);
226 long double    log1pl(long double x);
227 
228 floating_point log2 (arithmetic x);
229 float          log2f(float x);
230 long double    log2l(long double x);
231 
232 floating_point logb (arithmetic x);
233 float          logbf(float x);
234 long double    logbl(long double x);
235 
236 long lrint (arithmetic x);
237 long lrintf(float x);
238 long lrintl(long double x);
239 
240 long lround (arithmetic x);
241 long lroundf(float x);
242 long lroundl(long double x);
243 
244 double      nan (const char* str);
245 float       nanf(const char* str);
246 long double nanl(const char* str);
247 
248 floating_point nearbyint (arithmetic x);
249 float          nearbyintf(float x);
250 long double    nearbyintl(long double x);
251 
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);
255 
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);
259 
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);
263 
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);
267 
268 floating_point rint (arithmetic x);
269 float          rintf(float x);
270 long double    rintl(long double x);
271 
272 floating_point round (arithmetic x);
273 float          roundf(float x);
274 long double    roundl(long double x);
275 
276 floating_point scalbln (arithmetic x, long ex);
277 float          scalblnf(float x, long ex);
278 long double    scalblnl(long double x, long ex);
279 
280 floating_point scalbn (arithmetic x, int ex);
281 float          scalbnf(float x, int ex);
282 long double    scalbnl(long double x, int ex);
283 
284 floating_point tgamma (arithmetic x);
285 float          tgammaf(float x);
286 long double    tgammal(long double x);
287 
288 floating_point trunc (arithmetic x);
289 float          truncf(float x);
290 long double    truncl(long double x);
291 
292 */
293 
294 #include <__config>
295 
296 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
297 #  pragma GCC system_header
298 #endif
299 
300 #  if __has_include_next(<math.h>)
301 #    include_next <math.h>
302 #  endif
303 
304 #ifdef __cplusplus
305 
306 // We support including .h headers inside 'extern "C"' contexts, so switch
307 // back to C++ linkage before including these C++ headers.
308 extern "C++" {
309 
310 #include <__type_traits/enable_if.h>
311 #include <__type_traits/is_floating_point.h>
312 #include <__type_traits/is_integral.h>
313 #include <__type_traits/is_same.h>
314 #include <__type_traits/promote.h>
315 #include <limits>
316 #include <stdlib.h>
317 
318 
319 #    ifdef fpclassify
320 #      undef fpclassify
321 #    endif
322 
323 #    ifdef signbit
324 #      undef signbit
325 #    endif
326 
327 #    ifdef isfinite
328 #      undef isfinite
329 #    endif
330 
331 #    ifdef isinf
332 #      undef isinf
333 #    endif
334 
335 #    ifdef isnan
336 #      undef isnan
337 #    endif
338 
339 #    ifdef isnormal
340 #      undef isnormal
341 #    endif
342 
343 #    ifdef isgreater
344 #      undef isgreater
345 #    endif
346 
347 #    ifdef isgreaterequal
348 #      undef isgreaterequal
349 #    endif
350 
351 #    ifdef isless
352 #      undef isless
353 #    endif
354 
355 #    ifdef islessequal
356 #      undef islessequal
357 #    endif
358 
359 #    ifdef islessgreater
360 #      undef islessgreater
361 #    endif
362 
363 #    ifdef isunordered
364 #      undef isunordered
365 #    endif
366 
367 // signbit
368 
369 template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0>
370 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
371   return __builtin_signbit(__x);
372 }
373 
374 template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && std::is_signed<_A1>::value, int> = 0>
375 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
376   return __x < 0;
377 }
378 
379 template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && !std::is_signed<_A1>::value, int> = 0>
380 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT {
381   return false;
382 }
383 
384 // fpclassify
385 
386 template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0>
387 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT {
388   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
389 }
390 
391 template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0>
392 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT {
393   return __x == 0 ? FP_ZERO : FP_NORMAL;
394 }
395 
396 // The MSVC runtime already provides these functions as templates
397 #ifndef _LIBCPP_MSVCRT
398 
399 // isfinite
400 
401 template <class _A1,
402           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0>
403 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT {
404   return __builtin_isfinite((typename std::__promote<_A1>::type)__x);
405 }
406 
407 template <class _A1,
408           std::__enable_if_t<std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, int> = 0>
409 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT {
410   return true;
411 }
412 
413 // isinf
414 
415 template <class _A1,
416           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0>
417 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT {
418   return __builtin_isinf((typename std::__promote<_A1>::type)__x);
419 }
420 
421 template <class _A1>
422 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI
423     typename std::enable_if< std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, bool>::type
424     isinf(_A1) _NOEXCEPT {
425   return false;
426 }
427 
428 #      ifdef _LIBCPP_PREFERRED_OVERLOAD
429 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT {
430   return __builtin_isinf(__x);
431 }
432 
433 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __x) _NOEXCEPT {
434   return __builtin_isinf(__x);
435 }
436 
437 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT {
438   return __builtin_isinf(__x);
439 }
440 #      endif
441 
442 // isnan
443 
444 template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0>
445 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT {
446   return __builtin_isnan(__x);
447 }
448 
449 template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0>
450 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT {
451   return false;
452 }
453 
454 #      ifdef _LIBCPP_PREFERRED_OVERLOAD
455 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT {
456   return __builtin_isnan(__x);
457 }
458 
459 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __x) _NOEXCEPT {
460   return __builtin_isnan(__x);
461 }
462 
463 _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT {
464   return __builtin_isnan(__x);
465 }
466 #      endif
467 
468 // isnormal
469 
470 template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0>
471 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT {
472   return __builtin_isnormal(__x);
473 }
474 
475 template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0>
476 _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT {
477   return __x != 0;
478 }
479 
480 // isgreater
481 
482 template <class _A1,
483           class _A2,
484           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
485 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT {
486   typedef typename std::__promote<_A1, _A2>::type type;
487   return __builtin_isgreater((type)__x, (type)__y);
488 }
489 
490 // isgreaterequal
491 
492 template <class _A1,
493           class _A2,
494           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
495 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT {
496   typedef typename std::__promote<_A1, _A2>::type type;
497   return __builtin_isgreaterequal((type)__x, (type)__y);
498 }
499 
500 // isless
501 
502 template <class _A1,
503           class _A2,
504           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
505 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT {
506   typedef typename std::__promote<_A1, _A2>::type type;
507   return __builtin_isless((type)__x, (type)__y);
508 }
509 
510 // islessequal
511 
512 template <class _A1,
513           class _A2,
514           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
515 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT {
516   typedef typename std::__promote<_A1, _A2>::type type;
517   return __builtin_islessequal((type)__x, (type)__y);
518 }
519 
520 // islessgreater
521 
522 template <class _A1,
523           class _A2,
524           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
525 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT {
526   typedef typename std::__promote<_A1, _A2>::type type;
527   return __builtin_islessgreater((type)__x, (type)__y);
528 }
529 
530 // isunordered
531 
532 template <class _A1,
533           class _A2,
534           std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0>
535 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT {
536   typedef typename std::__promote<_A1, _A2>::type type;
537   return __builtin_isunordered((type)__x, (type)__y);
538 }
539 
540 #endif // _LIBCPP_MSVCRT
541 
542 // abs
543 //
544 // handled in stdlib.h
545 
546 // div
547 //
548 // handled in stdlib.h
549 
550 // We have to provide double overloads for <math.h> to work on platforms that don't provide the full set of math
551 // functions. To make the overload set work with multiple functions that take the same arguments, we make our overloads
552 // templates. Functions are preferred over function templates during overload resolution, which means that our overload
553 // will only be selected when the C library doesn't provide one.
554 
555 // acos
556 
557 inline _LIBCPP_HIDE_FROM_ABI float       acos(float __x) _NOEXCEPT       {return __builtin_acosf(__x);}
558 
559 template <class = int>
560 _LIBCPP_HIDE_FROM_ABI double acos(double __x) _NOEXCEPT {
561   return __builtin_acos(__x);
562 }
563 
564 inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT {return __builtin_acosl(__x);}
565 
566 template <class _A1>
567 inline _LIBCPP_HIDE_FROM_ABI
568 typename std::enable_if<std::is_integral<_A1>::value, double>::type
569 acos(_A1 __x) _NOEXCEPT {return __builtin_acos((double)__x);}
570 
571 // asin
572 
573 inline _LIBCPP_HIDE_FROM_ABI float       asin(float __x) _NOEXCEPT       {return __builtin_asinf(__x);}
574 
575 template <class = int>
576 _LIBCPP_HIDE_FROM_ABI double asin(double __x) _NOEXCEPT {
577   return __builtin_asin(__x);
578 }
579 
580 inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT {return __builtin_asinl(__x);}
581 
582 template <class _A1>
583 inline _LIBCPP_HIDE_FROM_ABI
584 typename std::enable_if<std::is_integral<_A1>::value, double>::type
585 asin(_A1 __x) _NOEXCEPT {return __builtin_asin((double)__x);}
586 
587 // atan
588 
589 inline _LIBCPP_HIDE_FROM_ABI float       atan(float __x) _NOEXCEPT       {return __builtin_atanf(__x);}
590 
591 template <class = int>
592 _LIBCPP_HIDE_FROM_ABI double atan(double __x) _NOEXCEPT {
593   return __builtin_atan(__x);
594 }
595 
596 inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT {return __builtin_atanl(__x);}
597 
598 template <class _A1>
599 inline _LIBCPP_HIDE_FROM_ABI
600 typename std::enable_if<std::is_integral<_A1>::value, double>::type
601 atan(_A1 __x) _NOEXCEPT {return __builtin_atan((double)__x);}
602 
603 // atan2
604 
605 inline _LIBCPP_HIDE_FROM_ABI float       atan2(float __y, float __x) _NOEXCEPT             {return __builtin_atan2f(__y, __x);}
606 
607 template <class = int>
608 _LIBCPP_HIDE_FROM_ABI double atan2(double __x, double __y) _NOEXCEPT {
609   return __builtin_atan2(__x, __y);
610 }
611 
612 inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x) _NOEXCEPT {return __builtin_atan2l(__y, __x);}
613 
614 template <class _A1, class _A2>
615 inline _LIBCPP_HIDE_FROM_ABI
616 typename std::__enable_if_t
617 <
618     std::is_arithmetic<_A1>::value &&
619     std::is_arithmetic<_A2>::value,
620     std::__promote<_A1, _A2>
621 >::type
622 atan2(_A1 __y, _A2 __x) _NOEXCEPT
623 {
624     typedef typename std::__promote<_A1, _A2>::type __result_type;
625     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
626                      std::_IsSame<_A2, __result_type>::value)), "");
627     return ::atan2((__result_type)__y, (__result_type)__x);
628 }
629 
630 // ceil
631 
632 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       ceil(float __x) _NOEXCEPT       {return __builtin_ceilf(__x);}
633 
634 template <class = int>
635 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT {
636   return __builtin_ceil(__x);
637 }
638 
639 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);}
640 
641 template <class _A1>
642 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
643 typename std::enable_if<std::is_integral<_A1>::value, double>::type
644 ceil(_A1 __x) _NOEXCEPT {return __builtin_ceil((double)__x);}
645 
646 // cos
647 
648 inline _LIBCPP_HIDE_FROM_ABI float       cos(float __x) _NOEXCEPT       {return __builtin_cosf(__x);}
649 
650 template <class = int>
651 _LIBCPP_HIDE_FROM_ABI double cos(double __x) _NOEXCEPT {
652   return __builtin_cos(__x);
653 }
654 
655 inline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT {return __builtin_cosl(__x);}
656 
657 template <class _A1>
658 inline _LIBCPP_HIDE_FROM_ABI
659 typename std::enable_if<std::is_integral<_A1>::value, double>::type
660 cos(_A1 __x) _NOEXCEPT {return __builtin_cos((double)__x);}
661 
662 // cosh
663 
664 inline _LIBCPP_HIDE_FROM_ABI float       cosh(float __x) _NOEXCEPT       {return __builtin_coshf(__x);}
665 
666 template <class = int>
667 _LIBCPP_HIDE_FROM_ABI double cosh(double __x) _NOEXCEPT {
668   return __builtin_cosh(__x);
669 }
670 
671 inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT {return __builtin_coshl(__x);}
672 
673 template <class _A1>
674 inline _LIBCPP_HIDE_FROM_ABI
675 typename std::enable_if<std::is_integral<_A1>::value, double>::type
676 cosh(_A1 __x) _NOEXCEPT {return __builtin_cosh((double)__x);}
677 
678 // exp
679 
680 inline _LIBCPP_HIDE_FROM_ABI float       exp(float __x) _NOEXCEPT       {return __builtin_expf(__x);}
681 
682 template <class = int>
683 _LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT {
684   return __builtin_exp(__x);
685 }
686 
687 inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT {return __builtin_expl(__x);}
688 
689 template <class _A1>
690 inline _LIBCPP_HIDE_FROM_ABI
691 typename std::enable_if<std::is_integral<_A1>::value, double>::type
692 exp(_A1 __x) _NOEXCEPT {return __builtin_exp((double)__x);}
693 
694 // fabs
695 
696 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       fabs(float __x) _NOEXCEPT       {return __builtin_fabsf(__x);}
697 
698 template <class = int>
699 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT {
700   return __builtin_fabs(__x);
701 }
702 
703 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);}
704 
705 template <class _A1>
706 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
707 typename std::enable_if<std::is_integral<_A1>::value, double>::type
708 fabs(_A1 __x) _NOEXCEPT {return __builtin_fabs((double)__x);}
709 
710 // floor
711 
712 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       floor(float __x) _NOEXCEPT       {return __builtin_floorf(__x);}
713 
714 template <class = int>
715 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT {
716   return __builtin_floor(__x);
717 }
718 
719 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);}
720 
721 template <class _A1>
722 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
723 typename std::enable_if<std::is_integral<_A1>::value, double>::type
724 floor(_A1 __x) _NOEXCEPT {return __builtin_floor((double)__x);}
725 
726 // fmod
727 
728 inline _LIBCPP_HIDE_FROM_ABI float       fmod(float __x, float __y) _NOEXCEPT             {return __builtin_fmodf(__x, __y);}
729 
730 template <class = int>
731 _LIBCPP_HIDE_FROM_ABI double fmod(double __x, double __y) _NOEXCEPT {
732   return __builtin_fmod(__x, __y);
733 }
734 
735 inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y) _NOEXCEPT {return __builtin_fmodl(__x, __y);}
736 
737 template <class _A1, class _A2>
738 inline _LIBCPP_HIDE_FROM_ABI
739 typename std::__enable_if_t
740 <
741     std::is_arithmetic<_A1>::value &&
742     std::is_arithmetic<_A2>::value,
743     std::__promote<_A1, _A2>
744 >::type
745 fmod(_A1 __x, _A2 __y) _NOEXCEPT
746 {
747     typedef typename std::__promote<_A1, _A2>::type __result_type;
748     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
749                      std::_IsSame<_A2, __result_type>::value)), "");
750     return ::fmod((__result_type)__x, (__result_type)__y);
751 }
752 
753 // frexp
754 
755 inline _LIBCPP_HIDE_FROM_ABI float       frexp(float __x, int* __e) _NOEXCEPT       {return __builtin_frexpf(__x, __e);}
756 
757 template <class = int>
758 _LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __e) _NOEXCEPT {
759   return __builtin_frexp(__x, __e);
760 }
761 
762 inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {return __builtin_frexpl(__x, __e);}
763 
764 template <class _A1>
765 inline _LIBCPP_HIDE_FROM_ABI
766 typename std::enable_if<std::is_integral<_A1>::value, double>::type
767 frexp(_A1 __x, int* __e) _NOEXCEPT {return __builtin_frexp((double)__x, __e);}
768 
769 // ldexp
770 
771 inline _LIBCPP_HIDE_FROM_ABI float       ldexp(float __x, int __e) _NOEXCEPT       {return __builtin_ldexpf(__x, __e);}
772 
773 template <class = int>
774 _LIBCPP_HIDE_FROM_ABI double ldexp(double __x, int __e) _NOEXCEPT {
775   return __builtin_ldexp(__x, __e);
776 }
777 
778 inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {return __builtin_ldexpl(__x, __e);}
779 
780 template <class _A1>
781 inline _LIBCPP_HIDE_FROM_ABI
782 typename std::enable_if<std::is_integral<_A1>::value, double>::type
783 ldexp(_A1 __x, int __e) _NOEXCEPT {return __builtin_ldexp((double)__x, __e);}
784 
785 // log
786 
787 inline _LIBCPP_HIDE_FROM_ABI float       log(float __x) _NOEXCEPT       {return __builtin_logf(__x);}
788 
789 template <class = int>
790 _LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT {
791   return __builtin_log(__x);
792 }
793 
794 inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT {return __builtin_logl(__x);}
795 
796 template <class _A1>
797 inline _LIBCPP_HIDE_FROM_ABI
798 typename std::enable_if<std::is_integral<_A1>::value, double>::type
799 log(_A1 __x) _NOEXCEPT {return __builtin_log((double)__x);}
800 
801 // log10
802 
803 inline _LIBCPP_HIDE_FROM_ABI float       log10(float __x) _NOEXCEPT       {return __builtin_log10f(__x);}
804 
805 
806 template <class = int>
807 _LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT {
808   return __builtin_log10(__x);
809 }
810 
811 inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT {return __builtin_log10l(__x);}
812 
813 template <class _A1>
814 inline _LIBCPP_HIDE_FROM_ABI
815 typename std::enable_if<std::is_integral<_A1>::value, double>::type
816 log10(_A1 __x) _NOEXCEPT {return __builtin_log10((double)__x);}
817 
818 // modf
819 
820 inline _LIBCPP_HIDE_FROM_ABI float       modf(float __x, float* __y) _NOEXCEPT             {return __builtin_modff(__x, __y);}
821 
822 template <class = int>
823 _LIBCPP_HIDE_FROM_ABI double modf(double __x, double* __y) _NOEXCEPT {
824   return __builtin_modf(__x, __y);
825 }
826 
827 inline _LIBCPP_HIDE_FROM_ABI long double modf(long double __x, long double* __y) _NOEXCEPT {return __builtin_modfl(__x, __y);}
828 
829 // pow
830 
831 inline _LIBCPP_HIDE_FROM_ABI float       pow(float __x, float __y) _NOEXCEPT             {return __builtin_powf(__x, __y);}
832 
833 template <class = int>
834 _LIBCPP_HIDE_FROM_ABI double pow(double __x, double __y) _NOEXCEPT {
835   return __builtin_pow(__x, __y);
836 }
837 
838 inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {return __builtin_powl(__x, __y);}
839 
840 template <class _A1, class _A2>
841 inline _LIBCPP_HIDE_FROM_ABI
842 typename std::__enable_if_t
843 <
844     std::is_arithmetic<_A1>::value &&
845     std::is_arithmetic<_A2>::value,
846     std::__promote<_A1, _A2>
847 >::type
848 pow(_A1 __x, _A2 __y) _NOEXCEPT
849 {
850     typedef typename std::__promote<_A1, _A2>::type __result_type;
851     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
852                      std::_IsSame<_A2, __result_type>::value)), "");
853     return ::pow((__result_type)__x, (__result_type)__y);
854 }
855 
856 // sin
857 
858 inline _LIBCPP_HIDE_FROM_ABI float       sin(float __x) _NOEXCEPT       {return __builtin_sinf(__x);}
859 
860 template <class = int>
861 _LIBCPP_HIDE_FROM_ABI double sin(double __x) _NOEXCEPT {
862   return __builtin_sin(__x);
863 }
864 
865 inline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT {return __builtin_sinl(__x);}
866 
867 template <class _A1>
868 inline _LIBCPP_HIDE_FROM_ABI
869 typename std::enable_if<std::is_integral<_A1>::value, double>::type
870 sin(_A1 __x) _NOEXCEPT {return __builtin_sin((double)__x);}
871 
872 // sinh
873 
874 inline _LIBCPP_HIDE_FROM_ABI float       sinh(float __x) _NOEXCEPT       {return __builtin_sinhf(__x);}
875 
876 template <class = int>
877 _LIBCPP_HIDE_FROM_ABI double sinh(double __x) _NOEXCEPT {
878   return __builtin_sinh(__x);
879 }
880 
881 inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT {return __builtin_sinhl(__x);}
882 
883 template <class _A1>
884 inline _LIBCPP_HIDE_FROM_ABI
885 typename std::enable_if<std::is_integral<_A1>::value, double>::type
886 sinh(_A1 __x) _NOEXCEPT {return __builtin_sinh((double)__x);}
887 
888 // sqrt
889 
890 inline _LIBCPP_HIDE_FROM_ABI float       sqrt(float __x) _NOEXCEPT       {return __builtin_sqrtf(__x);}
891 
892 template <class = int>
893 _LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT {
894   return __builtin_sqrt(__x);
895 }
896 
897 inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT {return __builtin_sqrtl(__x);}
898 
899 template <class _A1>
900 inline _LIBCPP_HIDE_FROM_ABI
901 typename std::enable_if<std::is_integral<_A1>::value, double>::type
902 sqrt(_A1 __x) _NOEXCEPT {return __builtin_sqrt((double)__x);}
903 
904 // tan
905 
906 inline _LIBCPP_HIDE_FROM_ABI float       tan(float __x) _NOEXCEPT       {return __builtin_tanf(__x);}
907 
908 template <class = int>
909 _LIBCPP_HIDE_FROM_ABI double tan(double __x) _NOEXCEPT {
910   return __builtin_tan(__x);
911 }
912 
913 inline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT {return __builtin_tanl(__x);}
914 
915 template <class _A1>
916 inline _LIBCPP_HIDE_FROM_ABI
917 typename std::enable_if<std::is_integral<_A1>::value, double>::type
918 tan(_A1 __x) _NOEXCEPT {return __builtin_tan((double)__x);}
919 
920 // tanh
921 
922 inline _LIBCPP_HIDE_FROM_ABI float       tanh(float __x) _NOEXCEPT       {return __builtin_tanhf(__x);}
923 
924 template <class = int>
925 _LIBCPP_HIDE_FROM_ABI double tanh(double __x) _NOEXCEPT {
926   return __builtin_tanh(__x);
927 }
928 
929 inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT {return __builtin_tanhl(__x);}
930 
931 template <class _A1>
932 inline _LIBCPP_HIDE_FROM_ABI
933 typename std::enable_if<std::is_integral<_A1>::value, double>::type
934 tanh(_A1 __x) _NOEXCEPT {return __builtin_tanh((double)__x);}
935 
936 // acosh
937 
938 inline _LIBCPP_HIDE_FROM_ABI float       acosh(float __x) _NOEXCEPT       {return __builtin_acoshf(__x);}
939 
940 template <class = int>
941 _LIBCPP_HIDE_FROM_ABI double acosh(double __x) _NOEXCEPT {
942   return __builtin_acosh(__x);
943 }
944 
945 inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT {return __builtin_acoshl(__x);}
946 
947 template <class _A1>
948 inline _LIBCPP_HIDE_FROM_ABI
949 typename std::enable_if<std::is_integral<_A1>::value, double>::type
950 acosh(_A1 __x) _NOEXCEPT {return __builtin_acosh((double)__x);}
951 
952 // asinh
953 
954 inline _LIBCPP_HIDE_FROM_ABI float       asinh(float __x) _NOEXCEPT       {return __builtin_asinhf(__x);}
955 
956 template <class = int>
957 _LIBCPP_HIDE_FROM_ABI double asinh(double __x) _NOEXCEPT {
958   return __builtin_asinh(__x);
959 }
960 
961 inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT {return __builtin_asinhl(__x);}
962 
963 template <class _A1>
964 inline _LIBCPP_HIDE_FROM_ABI
965 typename std::enable_if<std::is_integral<_A1>::value, double>::type
966 asinh(_A1 __x) _NOEXCEPT {return __builtin_asinh((double)__x);}
967 
968 // atanh
969 
970 inline _LIBCPP_HIDE_FROM_ABI float       atanh(float __x) _NOEXCEPT       {return __builtin_atanhf(__x);}
971 
972 template <class = int>
973 _LIBCPP_HIDE_FROM_ABI double atanh(double __x) _NOEXCEPT {
974   return __builtin_atanh(__x);
975 }
976 
977 inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT {return __builtin_atanhl(__x);}
978 
979 template <class _A1>
980 inline _LIBCPP_HIDE_FROM_ABI
981 typename std::enable_if<std::is_integral<_A1>::value, double>::type
982 atanh(_A1 __x) _NOEXCEPT {return __builtin_atanh((double)__x);}
983 
984 // cbrt
985 
986 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       cbrt(float __x) _NOEXCEPT       {return __builtin_cbrtf(__x);}
987 
988 template <class = int>
989 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT {
990   return __builtin_cbrt(__x);
991 }
992 
993 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return __builtin_cbrtl(__x);}
994 
995 template <class _A1>
996 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
997 typename std::enable_if<std::is_integral<_A1>::value, double>::type
998 cbrt(_A1 __x) _NOEXCEPT {return __builtin_cbrt((double)__x);}
999 
1000 // copysign
1001 
1002 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT {
1003   return ::__builtin_copysignf(__x, __y);
1004 }
1005 
1006 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT {
1007   return ::__builtin_copysignl(__x, __y);
1008 }
1009 
1010 template <class _A1, class _A2>
1011 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1012 typename std::__enable_if_t
1013 <
1014     std::is_arithmetic<_A1>::value &&
1015     std::is_arithmetic<_A2>::value,
1016     std::__promote<_A1, _A2>
1017 >::type
1018     copysign(_A1 __x, _A2 __y) _NOEXCEPT {
1019   return ::__builtin_copysign(__x, __y);
1020 }
1021 
1022 // erf
1023 
1024 inline _LIBCPP_HIDE_FROM_ABI float       erf(float __x) _NOEXCEPT       {return __builtin_erff(__x);}
1025 
1026 template <class = int>
1027 _LIBCPP_HIDE_FROM_ABI double erf(double __x) _NOEXCEPT {
1028   return __builtin_erf(__x);
1029 }
1030 
1031 inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT {return __builtin_erfl(__x);}
1032 
1033 template <class _A1>
1034 inline _LIBCPP_HIDE_FROM_ABI
1035 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1036 erf(_A1 __x) _NOEXCEPT {return __builtin_erf((double)__x);}
1037 
1038 // erfc
1039 
1040 inline _LIBCPP_HIDE_FROM_ABI float       erfc(float __x) _NOEXCEPT       {return __builtin_erfcf(__x);}
1041 
1042 template <class = int>
1043 _LIBCPP_HIDE_FROM_ABI double erfc(double __x) _NOEXCEPT {
1044   return __builtin_erfc(__x);
1045 }
1046 
1047 inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT {return __builtin_erfcl(__x);}
1048 
1049 template <class _A1>
1050 inline _LIBCPP_HIDE_FROM_ABI
1051 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1052 erfc(_A1 __x) _NOEXCEPT {return __builtin_erfc((double)__x);}
1053 
1054 // exp2
1055 
1056 inline _LIBCPP_HIDE_FROM_ABI float       exp2(float __x) _NOEXCEPT       {return __builtin_exp2f(__x);}
1057 
1058 template <class = int>
1059 _LIBCPP_HIDE_FROM_ABI double exp2(double __x) _NOEXCEPT {
1060   return __builtin_exp2(__x);
1061 }
1062 
1063 inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT {return __builtin_exp2l(__x);}
1064 
1065 template <class _A1>
1066 inline _LIBCPP_HIDE_FROM_ABI
1067 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1068 exp2(_A1 __x) _NOEXCEPT {return __builtin_exp2((double)__x);}
1069 
1070 // expm1
1071 
1072 inline _LIBCPP_HIDE_FROM_ABI float       expm1(float __x) _NOEXCEPT       {return __builtin_expm1f(__x);}
1073 
1074 template <class = int>
1075 _LIBCPP_HIDE_FROM_ABI double expm1(double __x) _NOEXCEPT {
1076   return __builtin_expm1(__x);
1077 }
1078 
1079 inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT {return __builtin_expm1l(__x);}
1080 
1081 template <class _A1>
1082 inline _LIBCPP_HIDE_FROM_ABI
1083 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1084 expm1(_A1 __x) _NOEXCEPT {return __builtin_expm1((double)__x);}
1085 
1086 // fdim
1087 
1088 inline _LIBCPP_HIDE_FROM_ABI float       fdim(float __x, float __y) _NOEXCEPT             {return __builtin_fdimf(__x, __y);}
1089 
1090 template <class = int>
1091 _LIBCPP_HIDE_FROM_ABI double fdim(double __x, double __y) _NOEXCEPT {
1092   return __builtin_fdim(__x, __y);
1093 }
1094 
1095 inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y) _NOEXCEPT {return __builtin_fdiml(__x, __y);}
1096 
1097 template <class _A1, class _A2>
1098 inline _LIBCPP_HIDE_FROM_ABI
1099 typename std::__enable_if_t
1100 <
1101     std::is_arithmetic<_A1>::value &&
1102     std::is_arithmetic<_A2>::value,
1103     std::__promote<_A1, _A2>
1104 >::type
1105 fdim(_A1 __x, _A2 __y) _NOEXCEPT
1106 {
1107     typedef typename std::__promote<_A1, _A2>::type __result_type;
1108     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1109                      std::_IsSame<_A2, __result_type>::value)), "");
1110     return ::fdim((__result_type)__x, (__result_type)__y);
1111 }
1112 
1113 // fma
1114 
1115 inline _LIBCPP_HIDE_FROM_ABI float       fma(float __x, float __y, float __z) _NOEXCEPT
1116 {
1117     return __builtin_fmaf(__x, __y, __z);
1118 }
1119 
1120 
1121 template <class = int>
1122 _LIBCPP_HIDE_FROM_ABI double fma(double __x, double __y, double __z) _NOEXCEPT {
1123   return __builtin_fma(__x, __y, __z);
1124 }
1125 
1126 inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT
1127 {
1128     return __builtin_fmal(__x, __y, __z);
1129 }
1130 
1131 template <class _A1, class _A2, class _A3>
1132 inline _LIBCPP_HIDE_FROM_ABI
1133 typename std::__enable_if_t
1134 <
1135     std::is_arithmetic<_A1>::value &&
1136     std::is_arithmetic<_A2>::value &&
1137     std::is_arithmetic<_A3>::value,
1138     std::__promote<_A1, _A2, _A3>
1139 >::type
1140 fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
1141 {
1142     typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1143     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1144                      std::_IsSame<_A2, __result_type>::value &&
1145                      std::_IsSame<_A3, __result_type>::value)), "");
1146     return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1147 }
1148 
1149 // fmax
1150 
1151 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       fmax(float __x, float __y) _NOEXCEPT             {return __builtin_fmaxf(__x, __y);}
1152 
1153 template <class = int>
1154 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT {
1155   return __builtin_fmax(__x, __y);
1156 }
1157 
1158 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return __builtin_fmaxl(__x, __y);}
1159 
1160 template <class _A1, class _A2>
1161 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1162 typename std::__enable_if_t
1163 <
1164     std::is_arithmetic<_A1>::value &&
1165     std::is_arithmetic<_A2>::value,
1166     std::__promote<_A1, _A2>
1167 >::type
1168 fmax(_A1 __x, _A2 __y) _NOEXCEPT
1169 {
1170     typedef typename std::__promote<_A1, _A2>::type __result_type;
1171     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1172                      std::_IsSame<_A2, __result_type>::value)), "");
1173     return ::fmax((__result_type)__x, (__result_type)__y);
1174 }
1175 
1176 // fmin
1177 
1178 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       fmin(float __x, float __y) _NOEXCEPT             {return __builtin_fminf(__x, __y);}
1179 
1180 template <class = int>
1181 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT {
1182   return __builtin_fmin(__x, __y);
1183 }
1184 
1185 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return __builtin_fminl(__x, __y);}
1186 
1187 template <class _A1, class _A2>
1188 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1189 typename std::__enable_if_t
1190 <
1191     std::is_arithmetic<_A1>::value &&
1192     std::is_arithmetic<_A2>::value,
1193     std::__promote<_A1, _A2>
1194 >::type
1195 fmin(_A1 __x, _A2 __y) _NOEXCEPT
1196 {
1197     typedef typename std::__promote<_A1, _A2>::type __result_type;
1198     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1199                      std::_IsSame<_A2, __result_type>::value)), "");
1200     return ::fmin((__result_type)__x, (__result_type)__y);
1201 }
1202 
1203 // hypot
1204 
1205 inline _LIBCPP_HIDE_FROM_ABI float       hypot(float __x, float __y) _NOEXCEPT             {return __builtin_hypotf(__x, __y);}
1206 
1207 template <class = int>
1208 _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y) _NOEXCEPT {
1209   return __builtin_hypot(__x, __y);
1210 }
1211 
1212 inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y) _NOEXCEPT {return __builtin_hypotl(__x, __y);}
1213 
1214 template <class _A1, class _A2>
1215 inline _LIBCPP_HIDE_FROM_ABI
1216 typename std::__enable_if_t
1217 <
1218     std::is_arithmetic<_A1>::value &&
1219     std::is_arithmetic<_A2>::value,
1220     std::__promote<_A1, _A2>
1221 >::type
1222 hypot(_A1 __x, _A2 __y) _NOEXCEPT
1223 {
1224     typedef typename std::__promote<_A1, _A2>::type __result_type;
1225     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1226                      std::_IsSame<_A2, __result_type>::value)), "");
1227     return ::hypot((__result_type)__x, (__result_type)__y);
1228 }
1229 
1230 // ilogb
1231 
1232 inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT       {return __builtin_ilogbf(__x);}
1233 
1234 template <class = int>
1235 _LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
1236   return __builtin_ilogb(__x);
1237 }
1238 
1239 inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT {return __builtin_ilogbl(__x);}
1240 
1241 template <class _A1>
1242 inline _LIBCPP_HIDE_FROM_ABI
1243 typename std::enable_if<std::is_integral<_A1>::value, int>::type
1244 ilogb(_A1 __x) _NOEXCEPT {return __builtin_ilogb((double)__x);}
1245 
1246 // lgamma
1247 
1248 inline _LIBCPP_HIDE_FROM_ABI float       lgamma(float __x) _NOEXCEPT       {return __builtin_lgammaf(__x);}
1249 
1250 template <class = int>
1251 _LIBCPP_HIDE_FROM_ABI double lgamma(double __x) _NOEXCEPT {
1252   return __builtin_lgamma(__x);
1253 }
1254 
1255 inline _LIBCPP_HIDE_FROM_ABI long double lgamma(long double __x) _NOEXCEPT {return __builtin_lgammal(__x);}
1256 
1257 template <class _A1>
1258 inline _LIBCPP_HIDE_FROM_ABI
1259 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1260 lgamma(_A1 __x) _NOEXCEPT {return __builtin_lgamma((double)__x);}
1261 
1262 // llrint
1263 
1264 inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT
1265 {
1266     return __builtin_llrintf(__x);
1267 }
1268 
1269 template <class = int>
1270 _LIBCPP_HIDE_FROM_ABI long long llrint(double __x) _NOEXCEPT {
1271   return __builtin_llrint(__x);
1272 }
1273 
1274 inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT
1275 {
1276     return __builtin_llrintl(__x);
1277 }
1278 
1279 template <class _A1>
1280 inline _LIBCPP_HIDE_FROM_ABI
1281 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
1282 llrint(_A1 __x) _NOEXCEPT
1283 {
1284     return __builtin_llrint((double)__x);
1285 }
1286 
1287 // llround
1288 
1289 inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT
1290 {
1291     return __builtin_llroundf(__x);
1292 }
1293 
1294 template <class = int>
1295 _LIBCPP_HIDE_FROM_ABI long long llround(double __x) _NOEXCEPT {
1296   return __builtin_llround(__x);
1297 }
1298 
1299 inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT
1300 {
1301     return __builtin_llroundl(__x);
1302 }
1303 
1304 template <class _A1>
1305 inline _LIBCPP_HIDE_FROM_ABI
1306 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
1307 llround(_A1 __x) _NOEXCEPT
1308 {
1309     return __builtin_llround((double)__x);
1310 }
1311 
1312 // log1p
1313 
1314 inline _LIBCPP_HIDE_FROM_ABI float       log1p(float __x) _NOEXCEPT       {return __builtin_log1pf(__x);}
1315 
1316 template <class = int>
1317 _LIBCPP_HIDE_FROM_ABI double log1p(double __x) _NOEXCEPT {
1318   return __builtin_log1p(__x);
1319 }
1320 
1321 inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT {return __builtin_log1pl(__x);}
1322 
1323 template <class _A1>
1324 inline _LIBCPP_HIDE_FROM_ABI
1325 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1326 log1p(_A1 __x) _NOEXCEPT {return __builtin_log1p((double)__x);}
1327 
1328 // log2
1329 
1330 inline _LIBCPP_HIDE_FROM_ABI float       log2(float __x) _NOEXCEPT       {return __builtin_log2f(__x);}
1331 
1332 template <class = int>
1333 _LIBCPP_HIDE_FROM_ABI double log2(double __x) _NOEXCEPT {
1334   return __builtin_log2(__x);
1335 }
1336 
1337 inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT {return __builtin_log2l(__x);}
1338 
1339 template <class _A1>
1340 inline _LIBCPP_HIDE_FROM_ABI
1341 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1342 log2(_A1 __x) _NOEXCEPT {return __builtin_log2((double)__x);}
1343 
1344 // logb
1345 
1346 inline _LIBCPP_HIDE_FROM_ABI float       logb(float __x) _NOEXCEPT       {return __builtin_logbf(__x);}
1347 
1348 template <class = int>
1349 _LIBCPP_HIDE_FROM_ABI double logb(double __x) _NOEXCEPT {
1350   return __builtin_logb(__x);
1351 }
1352 
1353 inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT {return __builtin_logbl(__x);}
1354 
1355 template <class _A1>
1356 inline _LIBCPP_HIDE_FROM_ABI
1357 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1358 logb(_A1 __x) _NOEXCEPT {return __builtin_logb((double)__x);}
1359 
1360 // lrint
1361 
1362 inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT
1363 {
1364     return __builtin_lrintf(__x);
1365 }
1366 
1367 template <class = int>
1368 _LIBCPP_HIDE_FROM_ABI long lrint(double __x) _NOEXCEPT {
1369   return __builtin_lrint(__x);
1370 }
1371 
1372 inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT
1373 {
1374     return __builtin_lrintl(__x);
1375 }
1376 
1377 template <class _A1>
1378 inline _LIBCPP_HIDE_FROM_ABI
1379 typename std::enable_if<std::is_integral<_A1>::value, long>::type
1380 lrint(_A1 __x) _NOEXCEPT
1381 {
1382     return __builtin_lrint((double)__x);
1383 }
1384 
1385 // lround
1386 
1387 inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT
1388 {
1389     return __builtin_lroundf(__x);
1390 }
1391 
1392 template <class = int>
1393 _LIBCPP_HIDE_FROM_ABI long lround(double __x) _NOEXCEPT {
1394   return __builtin_lround(__x);
1395 }
1396 
1397 inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT
1398 {
1399     return __builtin_lroundl(__x);
1400 }
1401 
1402 template <class _A1>
1403 inline _LIBCPP_HIDE_FROM_ABI
1404 typename std::enable_if<std::is_integral<_A1>::value, long>::type
1405 lround(_A1 __x) _NOEXCEPT
1406 {
1407     return __builtin_lround((double)__x);
1408 }
1409 
1410 // nan
1411 
1412 // nearbyint
1413 
1414 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       nearbyint(float __x) _NOEXCEPT       {return __builtin_nearbyintf(__x);}
1415 
1416 template <class = int>
1417 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT {
1418   return __builtin_nearbyint(__x);
1419 }
1420 
1421 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return __builtin_nearbyintl(__x);}
1422 
1423 template <class _A1>
1424 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1425 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1426 nearbyint(_A1 __x) _NOEXCEPT {return __builtin_nearbyint((double)__x);}
1427 
1428 // nextafter
1429 
1430 inline _LIBCPP_HIDE_FROM_ABI float       nextafter(float __x, float __y) _NOEXCEPT             {return __builtin_nextafterf(__x, __y);}
1431 
1432 template <class = int>
1433 _LIBCPP_HIDE_FROM_ABI double nextafter(double __x, double __y) _NOEXCEPT {
1434   return __builtin_nextafter(__x, __y);
1435 }
1436 
1437 inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double __y) _NOEXCEPT {return __builtin_nextafterl(__x, __y);}
1438 
1439 template <class _A1, class _A2>
1440 inline _LIBCPP_HIDE_FROM_ABI
1441 typename std::__enable_if_t
1442 <
1443     std::is_arithmetic<_A1>::value &&
1444     std::is_arithmetic<_A2>::value,
1445     std::__promote<_A1, _A2>
1446 >::type
1447 nextafter(_A1 __x, _A2 __y) _NOEXCEPT
1448 {
1449     typedef typename std::__promote<_A1, _A2>::type __result_type;
1450     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1451                      std::_IsSame<_A2, __result_type>::value)), "");
1452     return ::nextafter((__result_type)__x, (__result_type)__y);
1453 }
1454 
1455 // nexttoward
1456 
1457 inline _LIBCPP_HIDE_FROM_ABI float       nexttoward(float __x, long double __y) _NOEXCEPT       {return __builtin_nexttowardf(__x, __y);}
1458 
1459 template <class = int>
1460 _LIBCPP_HIDE_FROM_ABI double nexttoward(double __x, long double __y) _NOEXCEPT {
1461   return __builtin_nexttoward(__x, __y);
1462 }
1463 
1464 inline _LIBCPP_HIDE_FROM_ABI long double nexttoward(long double __x, long double __y) _NOEXCEPT {return __builtin_nexttowardl(__x, __y);}
1465 
1466 template <class _A1>
1467 inline _LIBCPP_HIDE_FROM_ABI
1468 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1469 nexttoward(_A1 __x, long double __y) _NOEXCEPT {return __builtin_nexttoward((double)__x, __y);}
1470 
1471 // remainder
1472 
1473 inline _LIBCPP_HIDE_FROM_ABI float       remainder(float __x, float __y) _NOEXCEPT             {return __builtin_remainderf(__x, __y);}
1474 
1475 template <class = int>
1476 _LIBCPP_HIDE_FROM_ABI double remainder(double __x, double __y) _NOEXCEPT {
1477   return __builtin_remainder(__x, __y);
1478 }
1479 
1480 inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double __y) _NOEXCEPT {return __builtin_remainderl(__x, __y);}
1481 
1482 template <class _A1, class _A2>
1483 inline _LIBCPP_HIDE_FROM_ABI
1484 typename std::__enable_if_t
1485 <
1486     std::is_arithmetic<_A1>::value &&
1487     std::is_arithmetic<_A2>::value,
1488     std::__promote<_A1, _A2>
1489 >::type
1490 remainder(_A1 __x, _A2 __y) _NOEXCEPT
1491 {
1492     typedef typename std::__promote<_A1, _A2>::type __result_type;
1493     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1494                      std::_IsSame<_A2, __result_type>::value)), "");
1495     return ::remainder((__result_type)__x, (__result_type)__y);
1496 }
1497 
1498 // remquo
1499 
1500 inline _LIBCPP_HIDE_FROM_ABI float       remquo(float __x, float __y, int* __z) _NOEXCEPT             {return __builtin_remquof(__x, __y, __z);}
1501 
1502 template <class = int>
1503 _LIBCPP_HIDE_FROM_ABI double remquo(double __x, double __y, int* __z) _NOEXCEPT {
1504   return __builtin_remquo(__x, __y, __z);
1505 }
1506 
1507 inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return __builtin_remquol(__x, __y, __z);}
1508 
1509 template <class _A1, class _A2>
1510 inline _LIBCPP_HIDE_FROM_ABI
1511 typename std::__enable_if_t
1512 <
1513     std::is_arithmetic<_A1>::value &&
1514     std::is_arithmetic<_A2>::value,
1515     std::__promote<_A1, _A2>
1516 >::type
1517 remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
1518 {
1519     typedef typename std::__promote<_A1, _A2>::type __result_type;
1520     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1521                      std::_IsSame<_A2, __result_type>::value)), "");
1522     return ::remquo((__result_type)__x, (__result_type)__y, __z);
1523 }
1524 
1525 // rint
1526 
1527 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       rint(float __x) _NOEXCEPT
1528 {
1529     return __builtin_rintf(__x);
1530 }
1531 
1532 template <class = int>
1533 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT {
1534   return __builtin_rint(__x);
1535 }
1536 
1537 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT
1538 {
1539     return __builtin_rintl(__x);
1540 }
1541 
1542 template <class _A1>
1543 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1544 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1545 rint(_A1 __x) _NOEXCEPT
1546 {
1547     return __builtin_rint((double)__x);
1548 }
1549 
1550 // round
1551 
1552 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       round(float __x) _NOEXCEPT
1553 {
1554     return __builtin_round(__x);
1555 }
1556 
1557 template <class = int>
1558 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT {
1559   return __builtin_round(__x);
1560 }
1561 
1562 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT
1563 {
1564     return __builtin_roundl(__x);
1565 }
1566 
1567 template <class _A1>
1568 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1569 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1570 round(_A1 __x) _NOEXCEPT
1571 {
1572     return __builtin_round((double)__x);
1573 }
1574 
1575 // scalbln
1576 
1577 inline _LIBCPP_HIDE_FROM_ABI float       scalbln(float __x, long __y) _NOEXCEPT       {return __builtin_scalblnf(__x, __y);}
1578 
1579 template <class = int>
1580 _LIBCPP_HIDE_FROM_ABI double scalbln(double __x, long __y) _NOEXCEPT {
1581   return __builtin_scalbln(__x, __y);
1582 }
1583 
1584 inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOEXCEPT {return __builtin_scalblnl(__x, __y);}
1585 
1586 template <class _A1>
1587 inline _LIBCPP_HIDE_FROM_ABI
1588 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1589 scalbln(_A1 __x, long __y) _NOEXCEPT {return __builtin_scalbln((double)__x, __y);}
1590 
1591 // scalbn
1592 
1593 inline _LIBCPP_HIDE_FROM_ABI float       scalbn(float __x, int __y) _NOEXCEPT       {return __builtin_scalbnf(__x, __y);}
1594 
1595 template <class = int>
1596 _LIBCPP_HIDE_FROM_ABI double scalbn(double __x, int __y) _NOEXCEPT {
1597   return __builtin_scalbn(__x, __y);
1598 }
1599 
1600 inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXCEPT {return __builtin_scalbnl(__x, __y);}
1601 
1602 template <class _A1>
1603 inline _LIBCPP_HIDE_FROM_ABI
1604 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1605 scalbn(_A1 __x, int __y) _NOEXCEPT {return __builtin_scalbn((double)__x, __y);}
1606 
1607 // tgamma
1608 
1609 inline _LIBCPP_HIDE_FROM_ABI float       tgamma(float __x) _NOEXCEPT       {return __builtin_tgammaf(__x);}
1610 
1611 template <class = int>
1612 _LIBCPP_HIDE_FROM_ABI double tgamma(double __x) _NOEXCEPT {
1613   return __builtin_tgamma(__x);
1614 }
1615 
1616 inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return __builtin_tgammal(__x);}
1617 
1618 template <class _A1>
1619 inline _LIBCPP_HIDE_FROM_ABI
1620 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1621 tgamma(_A1 __x) _NOEXCEPT {return __builtin_tgamma((double)__x);}
1622 
1623 // trunc
1624 
1625 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float       trunc(float __x) _NOEXCEPT
1626 {
1627     return __builtin_trunc(__x);
1628 }
1629 
1630 template <class = int>
1631 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT {
1632   return __builtin_trunc(__x);
1633 }
1634 
1635 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT
1636 {
1637     return __builtin_truncl(__x);
1638 }
1639 
1640 template <class _A1>
1641 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
1642 typename std::enable_if<std::is_integral<_A1>::value, double>::type
1643 trunc(_A1 __x) _NOEXCEPT
1644 {
1645     return __builtin_trunc((double)__x);
1646 }
1647 
1648 } // extern "C++"
1649 
1650 #endif // __cplusplus
1651 
1652 #else // _LIBCPP_MATH_H
1653 
1654 // This include lives outside the header guard in order to support an MSVC
1655 // extension which allows users to do:
1656 //
1657 // #define _USE_MATH_DEFINES
1658 // #include <math.h>
1659 //
1660 // and receive the definitions of mathematical constants, even if <math.h>
1661 // has previously been included.
1662 #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1663 #include_next <math.h>
1664 #endif
1665 
1666 #endif // _LIBCPP_MATH_H
1667