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 297 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 298 #pragma GCC system_header 299 #endif 300 301 #include_next <math.h> 302 303 #ifdef __cplusplus 304 305 // We support including .h headers inside 'extern "C"' contexts, so switch 306 // back to C++ linkage before including these C++ headers. 307 extern "C++" { 308 309 #include <type_traits> 310 311 // signbit 312 313 #ifdef signbit 314 315 template <class _A1> 316 _LIBCPP_ALWAYS_INLINE 317 bool 318 __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT 319 { 320 return signbit(__lcpp_x); 321 } 322 323 #undef signbit 324 325 template <class _A1> 326 inline _LIBCPP_INLINE_VISIBILITY 327 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type 328 signbit(_A1 __lcpp_x) _NOEXCEPT 329 { 330 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); 331 } 332 333 #endif // signbit 334 335 // fpclassify 336 337 #ifdef fpclassify 338 339 template <class _A1> 340 _LIBCPP_ALWAYS_INLINE 341 int 342 __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT 343 { 344 return fpclassify(__lcpp_x); 345 } 346 347 #undef fpclassify 348 349 template <class _A1> 350 inline _LIBCPP_INLINE_VISIBILITY 351 typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type 352 fpclassify(_A1 __lcpp_x) _NOEXCEPT 353 { 354 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); 355 } 356 357 #endif // fpclassify 358 359 // isfinite 360 361 #ifdef isfinite 362 363 template <class _A1> 364 _LIBCPP_ALWAYS_INLINE 365 bool 366 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT 367 { 368 return isfinite(__lcpp_x); 369 } 370 371 #undef isfinite 372 373 template <class _A1> 374 inline _LIBCPP_INLINE_VISIBILITY 375 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type 376 isfinite(_A1 __lcpp_x) _NOEXCEPT 377 { 378 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); 379 } 380 381 #endif // isfinite 382 383 // isinf 384 385 #ifdef isinf 386 387 template <class _A1> 388 _LIBCPP_ALWAYS_INLINE 389 bool 390 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT 391 { 392 return isinf(__lcpp_x); 393 } 394 395 #undef isinf 396 397 template <class _A1> 398 inline _LIBCPP_INLINE_VISIBILITY 399 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type 400 isinf(_A1 __lcpp_x) _NOEXCEPT 401 { 402 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); 403 } 404 405 #endif // isinf 406 407 // isnan 408 409 #ifdef isnan 410 411 template <class _A1> 412 _LIBCPP_ALWAYS_INLINE 413 bool 414 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT 415 { 416 return isnan(__lcpp_x); 417 } 418 419 #undef isnan 420 421 template <class _A1> 422 inline _LIBCPP_INLINE_VISIBILITY 423 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type 424 isnan(_A1 __lcpp_x) _NOEXCEPT 425 { 426 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); 427 } 428 429 #endif // isnan 430 431 // isnormal 432 433 #ifdef isnormal 434 435 template <class _A1> 436 _LIBCPP_ALWAYS_INLINE 437 bool 438 __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT 439 { 440 return isnormal(__lcpp_x); 441 } 442 443 #undef isnormal 444 445 template <class _A1> 446 inline _LIBCPP_INLINE_VISIBILITY 447 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type 448 isnormal(_A1 __lcpp_x) _NOEXCEPT 449 { 450 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); 451 } 452 453 #endif // isnormal 454 455 // isgreater 456 457 #ifdef isgreater 458 459 template <class _A1, class _A2> 460 _LIBCPP_ALWAYS_INLINE 461 bool 462 __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 463 { 464 return isgreater(__lcpp_x, __lcpp_y); 465 } 466 467 #undef isgreater 468 469 template <class _A1, class _A2> 470 inline _LIBCPP_INLINE_VISIBILITY 471 typename std::enable_if 472 < 473 std::is_arithmetic<_A1>::value && 474 std::is_arithmetic<_A2>::value, 475 bool 476 >::type 477 isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 478 { 479 typedef typename std::__promote<_A1, _A2>::type type; 480 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); 481 } 482 483 #endif // isgreater 484 485 // isgreaterequal 486 487 #ifdef isgreaterequal 488 489 template <class _A1, class _A2> 490 _LIBCPP_ALWAYS_INLINE 491 bool 492 __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 493 { 494 return isgreaterequal(__lcpp_x, __lcpp_y); 495 } 496 497 #undef isgreaterequal 498 499 template <class _A1, class _A2> 500 inline _LIBCPP_INLINE_VISIBILITY 501 typename std::enable_if 502 < 503 std::is_arithmetic<_A1>::value && 504 std::is_arithmetic<_A2>::value, 505 bool 506 >::type 507 isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 508 { 509 typedef typename std::__promote<_A1, _A2>::type type; 510 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); 511 } 512 513 #endif // isgreaterequal 514 515 // isless 516 517 #ifdef isless 518 519 template <class _A1, class _A2> 520 _LIBCPP_ALWAYS_INLINE 521 bool 522 __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 523 { 524 return isless(__lcpp_x, __lcpp_y); 525 } 526 527 #undef isless 528 529 template <class _A1, class _A2> 530 inline _LIBCPP_INLINE_VISIBILITY 531 typename std::enable_if 532 < 533 std::is_arithmetic<_A1>::value && 534 std::is_arithmetic<_A2>::value, 535 bool 536 >::type 537 isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 538 { 539 typedef typename std::__promote<_A1, _A2>::type type; 540 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); 541 } 542 543 #endif // isless 544 545 // islessequal 546 547 #ifdef islessequal 548 549 template <class _A1, class _A2> 550 _LIBCPP_ALWAYS_INLINE 551 bool 552 __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 553 { 554 return islessequal(__lcpp_x, __lcpp_y); 555 } 556 557 #undef islessequal 558 559 template <class _A1, class _A2> 560 inline _LIBCPP_INLINE_VISIBILITY 561 typename std::enable_if 562 < 563 std::is_arithmetic<_A1>::value && 564 std::is_arithmetic<_A2>::value, 565 bool 566 >::type 567 islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 568 { 569 typedef typename std::__promote<_A1, _A2>::type type; 570 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); 571 } 572 573 #endif // islessequal 574 575 // islessgreater 576 577 #ifdef islessgreater 578 579 template <class _A1, class _A2> 580 _LIBCPP_ALWAYS_INLINE 581 bool 582 __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 583 { 584 return islessgreater(__lcpp_x, __lcpp_y); 585 } 586 587 #undef islessgreater 588 589 template <class _A1, class _A2> 590 inline _LIBCPP_INLINE_VISIBILITY 591 typename std::enable_if 592 < 593 std::is_arithmetic<_A1>::value && 594 std::is_arithmetic<_A2>::value, 595 bool 596 >::type 597 islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 598 { 599 typedef typename std::__promote<_A1, _A2>::type type; 600 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); 601 } 602 603 #endif // islessgreater 604 605 // isunordered 606 607 #ifdef isunordered 608 609 template <class _A1, class _A2> 610 _LIBCPP_ALWAYS_INLINE 611 bool 612 __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 613 { 614 return isunordered(__lcpp_x, __lcpp_y); 615 } 616 617 #undef isunordered 618 619 template <class _A1, class _A2> 620 inline _LIBCPP_INLINE_VISIBILITY 621 typename std::enable_if 622 < 623 std::is_arithmetic<_A1>::value && 624 std::is_arithmetic<_A2>::value, 625 bool 626 >::type 627 isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 628 { 629 typedef typename std::__promote<_A1, _A2>::type type; 630 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); 631 } 632 633 #endif // isunordered 634 635 // abs 636 637 #if !(defined(_AIX) || defined(__sun__)) 638 inline _LIBCPP_INLINE_VISIBILITY 639 float 640 abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} 641 642 inline _LIBCPP_INLINE_VISIBILITY 643 double 644 abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);} 645 646 inline _LIBCPP_INLINE_VISIBILITY 647 long double 648 abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} 649 #endif // !(defined(_AIX) || defined(__sun__)) 650 651 // acos 652 653 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 654 inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);} 655 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);} 656 #endif 657 658 template <class _A1> 659 inline _LIBCPP_INLINE_VISIBILITY 660 typename std::enable_if<std::is_integral<_A1>::value, double>::type 661 acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);} 662 663 // asin 664 665 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 666 inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);} 667 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);} 668 #endif 669 670 template <class _A1> 671 inline _LIBCPP_INLINE_VISIBILITY 672 typename std::enable_if<std::is_integral<_A1>::value, double>::type 673 asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);} 674 675 // atan 676 677 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 678 inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);} 679 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);} 680 #endif 681 682 template <class _A1> 683 inline _LIBCPP_INLINE_VISIBILITY 684 typename std::enable_if<std::is_integral<_A1>::value, double>::type 685 atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);} 686 687 // atan2 688 689 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 690 inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);} 691 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);} 692 #endif 693 694 template <class _A1, class _A2> 695 inline _LIBCPP_INLINE_VISIBILITY 696 typename std::__lazy_enable_if 697 < 698 std::is_arithmetic<_A1>::value && 699 std::is_arithmetic<_A2>::value, 700 std::__promote<_A1, _A2> 701 >::type 702 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT 703 { 704 typedef typename std::__promote<_A1, _A2>::type __result_type; 705 static_assert((!(std::is_same<_A1, __result_type>::value && 706 std::is_same<_A2, __result_type>::value)), ""); 707 return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); 708 } 709 710 // ceil 711 712 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 713 inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);} 714 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);} 715 #endif 716 717 template <class _A1> 718 inline _LIBCPP_INLINE_VISIBILITY 719 typename std::enable_if<std::is_integral<_A1>::value, double>::type 720 ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);} 721 722 // cos 723 724 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 725 inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return cosf(__lcpp_x);} 726 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);} 727 #endif 728 729 template <class _A1> 730 inline _LIBCPP_INLINE_VISIBILITY 731 typename std::enable_if<std::is_integral<_A1>::value, double>::type 732 cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);} 733 734 // cosh 735 736 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 737 inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return coshf(__lcpp_x);} 738 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);} 739 #endif 740 741 template <class _A1> 742 inline _LIBCPP_INLINE_VISIBILITY 743 typename std::enable_if<std::is_integral<_A1>::value, double>::type 744 cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);} 745 746 // exp 747 748 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 749 inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return expf(__lcpp_x);} 750 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);} 751 #endif 752 753 template <class _A1> 754 inline _LIBCPP_INLINE_VISIBILITY 755 typename std::enable_if<std::is_integral<_A1>::value, double>::type 756 exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);} 757 758 // fabs 759 760 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 761 inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} 762 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} 763 #endif 764 765 template <class _A1> 766 inline _LIBCPP_INLINE_VISIBILITY 767 typename std::enable_if<std::is_integral<_A1>::value, double>::type 768 fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);} 769 770 // floor 771 772 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 773 inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return floorf(__lcpp_x);} 774 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);} 775 #endif 776 777 template <class _A1> 778 inline _LIBCPP_INLINE_VISIBILITY 779 typename std::enable_if<std::is_integral<_A1>::value, double>::type 780 floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);} 781 782 // fmod 783 784 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 785 inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmodf(__lcpp_x, __lcpp_y);} 786 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);} 787 #endif 788 789 template <class _A1, class _A2> 790 inline _LIBCPP_INLINE_VISIBILITY 791 typename std::__lazy_enable_if 792 < 793 std::is_arithmetic<_A1>::value && 794 std::is_arithmetic<_A2>::value, 795 std::__promote<_A1, _A2> 796 >::type 797 fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 798 { 799 typedef typename std::__promote<_A1, _A2>::type __result_type; 800 static_assert((!(std::is_same<_A1, __result_type>::value && 801 std::is_same<_A2, __result_type>::value)), ""); 802 return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); 803 } 804 805 // frexp 806 807 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 808 inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpf(__lcpp_x, __lcpp_e);} 809 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);} 810 #endif 811 812 template <class _A1> 813 inline _LIBCPP_INLINE_VISIBILITY 814 typename std::enable_if<std::is_integral<_A1>::value, double>::type 815 frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);} 816 817 // ldexp 818 819 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 820 inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpf(__lcpp_x, __lcpp_e);} 821 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);} 822 #endif 823 824 template <class _A1> 825 inline _LIBCPP_INLINE_VISIBILITY 826 typename std::enable_if<std::is_integral<_A1>::value, double>::type 827 ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);} 828 829 // log 830 831 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 832 inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return logf(__lcpp_x);} 833 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);} 834 #endif 835 836 template <class _A1> 837 inline _LIBCPP_INLINE_VISIBILITY 838 typename std::enable_if<std::is_integral<_A1>::value, double>::type 839 log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);} 840 841 // log10 842 843 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 844 inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return log10f(__lcpp_x);} 845 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);} 846 #endif 847 848 template <class _A1> 849 inline _LIBCPP_INLINE_VISIBILITY 850 typename std::enable_if<std::is_integral<_A1>::value, double>::type 851 log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);} 852 853 // modf 854 855 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 856 inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);} 857 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);} 858 #endif 859 860 // pow 861 862 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 863 inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return powf(__lcpp_x, __lcpp_y);} 864 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);} 865 #endif 866 867 template <class _A1, class _A2> 868 inline _LIBCPP_INLINE_VISIBILITY 869 typename std::__lazy_enable_if 870 < 871 std::is_arithmetic<_A1>::value && 872 std::is_arithmetic<_A2>::value, 873 std::__promote<_A1, _A2> 874 >::type 875 pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 876 { 877 typedef typename std::__promote<_A1, _A2>::type __result_type; 878 static_assert((!(std::is_same<_A1, __result_type>::value && 879 std::is_same<_A2, __result_type>::value)), ""); 880 return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); 881 } 882 883 // sin 884 885 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 886 inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return sinf(__lcpp_x);} 887 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);} 888 #endif 889 890 template <class _A1> 891 inline _LIBCPP_INLINE_VISIBILITY 892 typename std::enable_if<std::is_integral<_A1>::value, double>::type 893 sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);} 894 895 // sinh 896 897 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 898 inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return sinhf(__lcpp_x);} 899 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);} 900 #endif 901 902 template <class _A1> 903 inline _LIBCPP_INLINE_VISIBILITY 904 typename std::enable_if<std::is_integral<_A1>::value, double>::type 905 sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);} 906 907 // sqrt 908 909 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 910 inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);} 911 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);} 912 #endif 913 914 template <class _A1> 915 inline _LIBCPP_INLINE_VISIBILITY 916 typename std::enable_if<std::is_integral<_A1>::value, double>::type 917 sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);} 918 919 // tan 920 921 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 922 inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return tanf(__lcpp_x);} 923 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);} 924 #endif 925 926 template <class _A1> 927 inline _LIBCPP_INLINE_VISIBILITY 928 typename std::enable_if<std::is_integral<_A1>::value, double>::type 929 tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);} 930 931 // tanh 932 933 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__)) 934 inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return tanhf(__lcpp_x);} 935 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);} 936 #endif 937 938 template <class _A1> 939 inline _LIBCPP_INLINE_VISIBILITY 940 typename std::enable_if<std::is_integral<_A1>::value, double>::type 941 tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);} 942 943 // acosh 944 945 #ifndef _LIBCPP_MSVCRT 946 inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);} 947 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);} 948 949 template <class _A1> 950 inline _LIBCPP_INLINE_VISIBILITY 951 typename std::enable_if<std::is_integral<_A1>::value, double>::type 952 acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);} 953 #endif 954 955 // asinh 956 957 #ifndef _LIBCPP_MSVCRT 958 inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);} 959 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);} 960 961 template <class _A1> 962 inline _LIBCPP_INLINE_VISIBILITY 963 typename std::enable_if<std::is_integral<_A1>::value, double>::type 964 asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);} 965 #endif 966 967 // atanh 968 969 #ifndef _LIBCPP_MSVCRT 970 inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);} 971 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);} 972 973 template <class _A1> 974 inline _LIBCPP_INLINE_VISIBILITY 975 typename std::enable_if<std::is_integral<_A1>::value, double>::type 976 atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);} 977 #endif 978 979 // cbrt 980 981 #ifndef _LIBCPP_MSVCRT 982 inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);} 983 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);} 984 985 template <class _A1> 986 inline _LIBCPP_INLINE_VISIBILITY 987 typename std::enable_if<std::is_integral<_A1>::value, double>::type 988 cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);} 989 #endif 990 991 // copysign 992 993 #if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12) 994 inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, 995 float __lcpp_y) _NOEXCEPT { 996 return copysignf(__lcpp_x, __lcpp_y); 997 } 998 inline _LIBCPP_INLINE_VISIBILITY long double 999 copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { 1000 return copysignl(__lcpp_x, __lcpp_y); 1001 } 1002 #endif 1003 1004 template <class _A1, class _A2> 1005 inline _LIBCPP_INLINE_VISIBILITY 1006 typename std::__lazy_enable_if 1007 < 1008 std::is_arithmetic<_A1>::value && 1009 std::is_arithmetic<_A2>::value, 1010 std::__promote<_A1, _A2> 1011 >::type 1012 copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1013 { 1014 typedef typename std::__promote<_A1, _A2>::type __result_type; 1015 static_assert((!(std::is_same<_A1, __result_type>::value && 1016 std::is_same<_A2, __result_type>::value)), ""); 1017 return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1018 } 1019 1020 #ifndef _LIBCPP_MSVCRT 1021 1022 // erf 1023 1024 inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);} 1025 inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);} 1026 1027 template <class _A1> 1028 inline _LIBCPP_INLINE_VISIBILITY 1029 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1030 erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);} 1031 1032 // erfc 1033 1034 inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return erfcf(__lcpp_x);} 1035 inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);} 1036 1037 template <class _A1> 1038 inline _LIBCPP_INLINE_VISIBILITY 1039 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1040 erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);} 1041 1042 // exp2 1043 1044 inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return exp2f(__lcpp_x);} 1045 inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);} 1046 1047 template <class _A1> 1048 inline _LIBCPP_INLINE_VISIBILITY 1049 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1050 exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);} 1051 1052 // expm1 1053 1054 inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return expm1f(__lcpp_x);} 1055 inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);} 1056 1057 template <class _A1> 1058 inline _LIBCPP_INLINE_VISIBILITY 1059 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1060 expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);} 1061 1062 // fdim 1063 1064 inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fdimf(__lcpp_x, __lcpp_y);} 1065 inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);} 1066 1067 template <class _A1, class _A2> 1068 inline _LIBCPP_INLINE_VISIBILITY 1069 typename std::__lazy_enable_if 1070 < 1071 std::is_arithmetic<_A1>::value && 1072 std::is_arithmetic<_A2>::value, 1073 std::__promote<_A1, _A2> 1074 >::type 1075 fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1076 { 1077 typedef typename std::__promote<_A1, _A2>::type __result_type; 1078 static_assert((!(std::is_same<_A1, __result_type>::value && 1079 std::is_same<_A2, __result_type>::value)), ""); 1080 return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1081 } 1082 1083 // fma 1084 1085 inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);} 1086 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);} 1087 1088 template <class _A1, class _A2, class _A3> 1089 inline _LIBCPP_INLINE_VISIBILITY 1090 typename std::__lazy_enable_if 1091 < 1092 std::is_arithmetic<_A1>::value && 1093 std::is_arithmetic<_A2>::value && 1094 std::is_arithmetic<_A3>::value, 1095 std::__promote<_A1, _A2, _A3> 1096 >::type 1097 fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT 1098 { 1099 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; 1100 static_assert((!(std::is_same<_A1, __result_type>::value && 1101 std::is_same<_A2, __result_type>::value && 1102 std::is_same<_A3, __result_type>::value)), ""); 1103 return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); 1104 } 1105 1106 // fmax 1107 1108 inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmaxf(__lcpp_x, __lcpp_y);} 1109 inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);} 1110 1111 template <class _A1, class _A2> 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::__promote<_A1, _A2> 1118 >::type 1119 fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1120 { 1121 typedef typename std::__promote<_A1, _A2>::type __result_type; 1122 static_assert((!(std::is_same<_A1, __result_type>::value && 1123 std::is_same<_A2, __result_type>::value)), ""); 1124 return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1125 } 1126 1127 // fmin 1128 1129 inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fminf(__lcpp_x, __lcpp_y);} 1130 inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);} 1131 1132 template <class _A1, class _A2> 1133 inline _LIBCPP_INLINE_VISIBILITY 1134 typename std::__lazy_enable_if 1135 < 1136 std::is_arithmetic<_A1>::value && 1137 std::is_arithmetic<_A2>::value, 1138 std::__promote<_A1, _A2> 1139 >::type 1140 fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1141 { 1142 typedef typename std::__promote<_A1, _A2>::type __result_type; 1143 static_assert((!(std::is_same<_A1, __result_type>::value && 1144 std::is_same<_A2, __result_type>::value)), ""); 1145 return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1146 } 1147 1148 // hypot 1149 1150 inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return hypotf(__lcpp_x, __lcpp_y);} 1151 inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);} 1152 1153 template <class _A1, class _A2> 1154 inline _LIBCPP_INLINE_VISIBILITY 1155 typename std::__lazy_enable_if 1156 < 1157 std::is_arithmetic<_A1>::value && 1158 std::is_arithmetic<_A2>::value, 1159 std::__promote<_A1, _A2> 1160 >::type 1161 hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1162 { 1163 typedef typename std::__promote<_A1, _A2>::type __result_type; 1164 static_assert((!(std::is_same<_A1, __result_type>::value && 1165 std::is_same<_A2, __result_type>::value)), ""); 1166 return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1167 } 1168 1169 // ilogb 1170 1171 inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ilogbf(__lcpp_x);} 1172 inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);} 1173 1174 template <class _A1> 1175 inline _LIBCPP_INLINE_VISIBILITY 1176 typename std::enable_if<std::is_integral<_A1>::value, int>::type 1177 ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);} 1178 1179 // lgamma 1180 1181 inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return lgammaf(__lcpp_x);} 1182 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);} 1183 1184 template <class _A1> 1185 inline _LIBCPP_INLINE_VISIBILITY 1186 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1187 lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);} 1188 1189 // llrint 1190 1191 inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return llrintf(__lcpp_x);} 1192 inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);} 1193 1194 template <class _A1> 1195 inline _LIBCPP_INLINE_VISIBILITY 1196 typename std::enable_if<std::is_integral<_A1>::value, long long>::type 1197 llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);} 1198 1199 // llround 1200 1201 inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return llroundf(__lcpp_x);} 1202 inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);} 1203 1204 template <class _A1> 1205 inline _LIBCPP_INLINE_VISIBILITY 1206 typename std::enable_if<std::is_integral<_A1>::value, long long>::type 1207 llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);} 1208 1209 // log1p 1210 1211 inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return log1pf(__lcpp_x);} 1212 inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);} 1213 1214 template <class _A1> 1215 inline _LIBCPP_INLINE_VISIBILITY 1216 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1217 log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);} 1218 1219 // log2 1220 1221 inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return log2f(__lcpp_x);} 1222 inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);} 1223 1224 template <class _A1> 1225 inline _LIBCPP_INLINE_VISIBILITY 1226 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1227 log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);} 1228 1229 // logb 1230 1231 inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return logbf(__lcpp_x);} 1232 inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);} 1233 1234 template <class _A1> 1235 inline _LIBCPP_INLINE_VISIBILITY 1236 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1237 logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);} 1238 1239 // lrint 1240 1241 inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return lrintf(__lcpp_x);} 1242 inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);} 1243 1244 template <class _A1> 1245 inline _LIBCPP_INLINE_VISIBILITY 1246 typename std::enable_if<std::is_integral<_A1>::value, long>::type 1247 lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);} 1248 1249 // lround 1250 1251 inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return lroundf(__lcpp_x);} 1252 inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);} 1253 1254 template <class _A1> 1255 inline _LIBCPP_INLINE_VISIBILITY 1256 typename std::enable_if<std::is_integral<_A1>::value, long>::type 1257 lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);} 1258 1259 // nan 1260 1261 // nearbyint 1262 1263 inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return nearbyintf(__lcpp_x);} 1264 inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);} 1265 1266 template <class _A1> 1267 inline _LIBCPP_INLINE_VISIBILITY 1268 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1269 nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);} 1270 1271 // nextafter 1272 1273 inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return nextafterf(__lcpp_x, __lcpp_y);} 1274 inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);} 1275 1276 template <class _A1, class _A2> 1277 inline _LIBCPP_INLINE_VISIBILITY 1278 typename std::__lazy_enable_if 1279 < 1280 std::is_arithmetic<_A1>::value && 1281 std::is_arithmetic<_A2>::value, 1282 std::__promote<_A1, _A2> 1283 >::type 1284 nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1285 { 1286 typedef typename std::__promote<_A1, _A2>::type __result_type; 1287 static_assert((!(std::is_same<_A1, __result_type>::value && 1288 std::is_same<_A2, __result_type>::value)), ""); 1289 return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1290 } 1291 1292 // nexttoward 1293 1294 inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardf(__lcpp_x, __lcpp_y);} 1295 inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);} 1296 1297 template <class _A1> 1298 inline _LIBCPP_INLINE_VISIBILITY 1299 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1300 nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);} 1301 1302 // remainder 1303 1304 inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return remainderf(__lcpp_x, __lcpp_y);} 1305 inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);} 1306 1307 template <class _A1, class _A2> 1308 inline _LIBCPP_INLINE_VISIBILITY 1309 typename std::__lazy_enable_if 1310 < 1311 std::is_arithmetic<_A1>::value && 1312 std::is_arithmetic<_A2>::value, 1313 std::__promote<_A1, _A2> 1314 >::type 1315 remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 1316 { 1317 typedef typename std::__promote<_A1, _A2>::type __result_type; 1318 static_assert((!(std::is_same<_A1, __result_type>::value && 1319 std::is_same<_A2, __result_type>::value)), ""); 1320 return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1321 } 1322 1323 // remquo 1324 1325 inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);} 1326 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);} 1327 1328 template <class _A1, class _A2> 1329 inline _LIBCPP_INLINE_VISIBILITY 1330 typename std::__lazy_enable_if 1331 < 1332 std::is_arithmetic<_A1>::value && 1333 std::is_arithmetic<_A2>::value, 1334 std::__promote<_A1, _A2> 1335 >::type 1336 remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT 1337 { 1338 typedef typename std::__promote<_A1, _A2>::type __result_type; 1339 static_assert((!(std::is_same<_A1, __result_type>::value && 1340 std::is_same<_A2, __result_type>::value)), ""); 1341 return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); 1342 } 1343 1344 // rint 1345 1346 inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return rintf(__lcpp_x);} 1347 inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);} 1348 1349 template <class _A1> 1350 inline _LIBCPP_INLINE_VISIBILITY 1351 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1352 rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);} 1353 1354 // round 1355 1356 inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);} 1357 inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);} 1358 1359 template <class _A1> 1360 inline _LIBCPP_INLINE_VISIBILITY 1361 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1362 round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);} 1363 1364 // scalbln 1365 1366 inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnf(__lcpp_x, __lcpp_y);} 1367 inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);} 1368 1369 template <class _A1> 1370 inline _LIBCPP_INLINE_VISIBILITY 1371 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1372 scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);} 1373 1374 // scalbn 1375 1376 inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnf(__lcpp_x, __lcpp_y);} 1377 inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);} 1378 1379 template <class _A1> 1380 inline _LIBCPP_INLINE_VISIBILITY 1381 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1382 scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);} 1383 1384 // tgamma 1385 1386 inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return tgammaf(__lcpp_x);} 1387 inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);} 1388 1389 template <class _A1> 1390 inline _LIBCPP_INLINE_VISIBILITY 1391 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1392 tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);} 1393 1394 // trunc 1395 1396 inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return truncf(__lcpp_x);} 1397 inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);} 1398 1399 template <class _A1> 1400 inline _LIBCPP_INLINE_VISIBILITY 1401 typename std::enable_if<std::is_integral<_A1>::value, double>::type 1402 trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);} 1403 1404 #endif // !_LIBCPP_MSVCRT 1405 1406 } // extern "C++" 1407 1408 #endif // __cplusplus 1409 1410 #endif // _LIBCPP_MATH_H 1411