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