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