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