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