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