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