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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 319 | __libcpp_signbit(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 329 | signbit(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 343 | __libcpp_fpclassify(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 353 | fpclassify(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 367 | __libcpp_isfinite(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 377 | isfinite(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 391 | __libcpp_isinf(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 401 | isinf(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 415 | __libcpp_isnan(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 425 | isnan(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 439 | __libcpp_isnormal(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 449 | isnormal(_A1 __x) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 463 | __libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 478 | isgreater(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 492 | __libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 507 | isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 521 | __libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 536 | isless(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 550 | __libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 565 | islessequal(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 579 | __libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 594 | islessgreater(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 608 | __libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 623 | isunordered(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | 0a11111 | 2011-05-13 21:52:40 +0000 | [diff] [blame] | 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 | |
| 649 | // abs |
| 650 | |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 651 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f07a529 | 2012-05-03 14:58:34 +0000 | [diff] [blame] | 652 | float |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 653 | abs(float __x) _NOEXCEPT {return fabsf(__x);} |
Howard Hinnant | f07a529 | 2012-05-03 14:58:34 +0000 | [diff] [blame] | 654 | |
| 655 | inline _LIBCPP_INLINE_VISIBILITY |
| 656 | double |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 657 | abs(double __x) _NOEXCEPT {return fabs(__x);} |
Howard Hinnant | f07a529 | 2012-05-03 14:58:34 +0000 | [diff] [blame] | 658 | |
| 659 | inline _LIBCPP_INLINE_VISIBILITY |
| 660 | long double |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 661 | abs(long double __x) _NOEXCEPT {return fabsl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 662 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 663 | #ifndef __sun__ |
| 664 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 665 | // acos |
| 666 | |
| 667 | using ::acos; |
| 668 | using ::acosf; |
| 669 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 670 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 671 | inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);} |
| 672 | inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 673 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 674 | |
| 675 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 676 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 677 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 678 | acos(_A1 __x) _NOEXCEPT {return acos((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 679 | |
| 680 | // asin |
| 681 | |
| 682 | using ::asin; |
| 683 | using ::asinf; |
| 684 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 685 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 686 | inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);} |
| 687 | inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 688 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 689 | |
| 690 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 691 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 692 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 693 | asin(_A1 __x) _NOEXCEPT {return asin((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 694 | |
| 695 | // atan |
| 696 | |
| 697 | using ::atan; |
| 698 | using ::atanf; |
| 699 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 700 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 701 | inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);} |
| 702 | inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 703 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 704 | |
| 705 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 706 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 707 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 708 | atan(_A1 __x) _NOEXCEPT {return atan((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 709 | |
| 710 | // atan2 |
| 711 | |
| 712 | using ::atan2; |
| 713 | using ::atan2f; |
| 714 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 715 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 716 | inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);} |
| 717 | inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 718 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 719 | |
| 720 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 721 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 722 | typename enable_if |
| 723 | < |
| 724 | is_arithmetic<_A1>::value && |
| 725 | is_arithmetic<_A2>::value, |
| 726 | typename __promote<_A1, _A2>::type |
| 727 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 728 | atan2(_A1 __y, _A2 __x) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 729 | { |
| 730 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 731 | static_assert((!(is_same<_A1, __result_type>::value && |
| 732 | is_same<_A2, __result_type>::value)), ""); |
| 733 | return atan2((__result_type)__y, (__result_type)__x); |
| 734 | } |
| 735 | |
| 736 | // ceil |
| 737 | |
| 738 | using ::ceil; |
| 739 | using ::ceilf; |
| 740 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 741 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 742 | inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);} |
| 743 | inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 744 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 745 | |
| 746 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 747 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 748 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 749 | ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 750 | |
| 751 | // cos |
| 752 | |
| 753 | using ::cos; |
| 754 | using ::cosf; |
| 755 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 756 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 757 | inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);} |
| 758 | inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 759 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 760 | |
| 761 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 762 | inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 763 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 764 | cos(_A1 __x) _NOEXCEPT {return cos((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 765 | |
| 766 | // cosh |
| 767 | |
| 768 | using ::cosh; |
| 769 | using ::coshf; |
| 770 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 771 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 772 | inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);} |
| 773 | inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 774 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 775 | |
| 776 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 777 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 778 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 779 | cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 780 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 781 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 782 | // exp |
| 783 | |
| 784 | using ::exp; |
| 785 | using ::expf; |
| 786 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 787 | #ifndef __sun__ |
| 788 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 789 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 790 | inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);} |
| 791 | inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 792 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 793 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 794 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 795 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 796 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 797 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 798 | exp(_A1 __x) _NOEXCEPT {return exp((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 799 | |
| 800 | // fabs |
| 801 | |
| 802 | using ::fabs; |
| 803 | using ::fabsf; |
| 804 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 805 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 806 | inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);} |
| 807 | inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 808 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 809 | |
| 810 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 811 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 812 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 813 | fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 814 | |
| 815 | // floor |
| 816 | |
| 817 | using ::floor; |
| 818 | using ::floorf; |
| 819 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 820 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 821 | inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);} |
| 822 | inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 823 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 824 | |
| 825 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 826 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 827 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 828 | floor(_A1 __x) _NOEXCEPT {return floor((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 829 | |
| 830 | // fmod |
| 831 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 832 | #endif //__sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 833 | using ::fmod; |
| 834 | using ::fmodf; |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 835 | #ifndef __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 836 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 837 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 838 | inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);} |
| 839 | inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 840 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 841 | |
| 842 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 843 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 844 | typename enable_if |
| 845 | < |
| 846 | is_arithmetic<_A1>::value && |
| 847 | is_arithmetic<_A2>::value, |
| 848 | typename __promote<_A1, _A2>::type |
| 849 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 850 | fmod(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 851 | { |
| 852 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 853 | static_assert((!(is_same<_A1, __result_type>::value && |
| 854 | is_same<_A2, __result_type>::value)), ""); |
| 855 | return fmod((__result_type)__x, (__result_type)__y); |
| 856 | } |
| 857 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 858 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 859 | // frexp |
| 860 | |
| 861 | using ::frexp; |
| 862 | using ::frexpf; |
| 863 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 864 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 865 | inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);} |
| 866 | inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 867 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 868 | |
| 869 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 870 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 871 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 872 | frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 873 | |
| 874 | // ldexp |
| 875 | |
| 876 | using ::ldexp; |
| 877 | using ::ldexpf; |
| 878 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 879 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 880 | inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);} |
| 881 | inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 882 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 883 | |
| 884 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 885 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 886 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 887 | ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 888 | |
| 889 | // log |
| 890 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 891 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 892 | using ::log; |
| 893 | using ::logf; |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 894 | #ifndef __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 895 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 896 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 897 | inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);} |
| 898 | inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 899 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 900 | |
| 901 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 902 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 903 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 904 | log(_A1 __x) _NOEXCEPT {return log((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 905 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 906 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 907 | // log10 |
| 908 | |
| 909 | using ::log10; |
| 910 | using ::log10f; |
| 911 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 912 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 913 | inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);} |
| 914 | inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 915 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 916 | |
| 917 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 918 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 919 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 920 | log10(_A1 __x) _NOEXCEPT {return log10((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 921 | |
| 922 | // modf |
| 923 | |
| 924 | using ::modf; |
| 925 | using ::modff; |
| 926 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 927 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 928 | inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);} |
| 929 | inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 930 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 931 | |
| 932 | // pow |
| 933 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 934 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 935 | using ::pow; |
| 936 | using ::powf; |
| 937 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 938 | #ifndef __sun__ |
| 939 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 940 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 941 | inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);} |
| 942 | inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 943 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 944 | |
| 945 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 946 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 947 | typename enable_if |
| 948 | < |
| 949 | is_arithmetic<_A1>::value && |
| 950 | is_arithmetic<_A2>::value, |
| 951 | typename __promote<_A1, _A2>::type |
| 952 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 953 | pow(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 954 | { |
| 955 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 956 | static_assert((!(is_same<_A1, __result_type>::value && |
| 957 | is_same<_A2, __result_type>::value)), ""); |
| 958 | return pow((__result_type)__x, (__result_type)__y); |
| 959 | } |
| 960 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 961 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 962 | // sin |
| 963 | |
| 964 | using ::sin; |
| 965 | using ::sinf; |
| 966 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 967 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 968 | inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);} |
| 969 | inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 970 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 971 | |
| 972 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 973 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 974 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 975 | sin(_A1 __x) _NOEXCEPT {return sin((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 976 | |
| 977 | // sinh |
| 978 | |
| 979 | using ::sinh; |
| 980 | using ::sinhf; |
| 981 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 982 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 983 | inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);} |
| 984 | inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 985 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 986 | |
| 987 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 988 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 989 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 990 | sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 991 | |
| 992 | // sqrt |
| 993 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 994 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 995 | using ::sqrt; |
| 996 | using ::sqrtf; |
| 997 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 998 | |
| 999 | #if !(defined(_MSC_VER) || defined(__sun__)) |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1000 | inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);} |
| 1001 | inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1002 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1003 | |
| 1004 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1005 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1006 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1007 | sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1008 | |
| 1009 | // tan |
| 1010 | |
| 1011 | using ::tan; |
| 1012 | using ::tanf; |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1013 | #ifndef __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1014 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1015 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1016 | inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);} |
| 1017 | inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1018 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1019 | |
| 1020 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1021 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1022 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1023 | tan(_A1 __x) _NOEXCEPT {return tan((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1024 | |
| 1025 | // tanh |
| 1026 | |
| 1027 | using ::tanh; |
| 1028 | using ::tanhf; |
| 1029 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1030 | #ifndef _MSC_VER |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1031 | inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);} |
| 1032 | inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1033 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1034 | |
| 1035 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1036 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1037 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1038 | tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1039 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1040 | // acosh |
| 1041 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1042 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1043 | using ::acosh; |
| 1044 | using ::acoshf; |
| 1045 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1046 | inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);} |
| 1047 | inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1048 | |
| 1049 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1050 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1051 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1052 | acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1053 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1054 | |
| 1055 | // asinh |
| 1056 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1057 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1058 | using ::asinh; |
| 1059 | using ::asinhf; |
| 1060 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1061 | inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);} |
| 1062 | inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1063 | |
| 1064 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1065 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1066 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1067 | asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1068 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1069 | |
| 1070 | // atanh |
| 1071 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1072 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1073 | using ::atanh; |
| 1074 | using ::atanhf; |
| 1075 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1076 | inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);} |
| 1077 | inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1078 | |
| 1079 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1080 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1081 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1082 | atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1083 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1084 | |
| 1085 | // cbrt |
| 1086 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1087 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1088 | using ::cbrt; |
| 1089 | using ::cbrtf; |
| 1090 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1091 | inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);} |
| 1092 | inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1093 | |
| 1094 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1095 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1096 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1097 | cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);} |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1098 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1099 | |
| 1100 | // copysign |
| 1101 | |
| 1102 | using ::copysign; |
| 1103 | using ::copysignf; |
| 1104 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1105 | inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);} |
| 1106 | inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1107 | |
| 1108 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1109 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1110 | typename enable_if |
| 1111 | < |
| 1112 | is_arithmetic<_A1>::value && |
| 1113 | is_arithmetic<_A2>::value, |
| 1114 | typename __promote<_A1, _A2>::type |
| 1115 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1116 | copysign(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1117 | { |
| 1118 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1119 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1120 | is_same<_A2, __result_type>::value)), ""); |
| 1121 | return copysign((__result_type)__x, (__result_type)__y); |
| 1122 | } |
| 1123 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1124 | #ifndef _MSC_VER |
| 1125 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1126 | // erf |
| 1127 | |
| 1128 | using ::erf; |
| 1129 | using ::erff; |
| 1130 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1131 | inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);} |
| 1132 | inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1133 | |
| 1134 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1135 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1136 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1137 | erf(_A1 __x) _NOEXCEPT {return erf((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1138 | |
| 1139 | // erfc |
| 1140 | |
| 1141 | using ::erfc; |
| 1142 | using ::erfcf; |
| 1143 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1144 | inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);} |
| 1145 | inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1146 | |
| 1147 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1148 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1149 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1150 | erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1151 | |
| 1152 | // exp2 |
| 1153 | |
| 1154 | using ::exp2; |
| 1155 | using ::exp2f; |
| 1156 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1157 | inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);} |
| 1158 | inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1159 | |
| 1160 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1161 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1162 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1163 | exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1164 | |
| 1165 | // expm1 |
| 1166 | |
| 1167 | using ::expm1; |
| 1168 | using ::expm1f; |
| 1169 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1170 | inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);} |
| 1171 | inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1172 | |
| 1173 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1174 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1175 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1176 | expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1177 | |
| 1178 | // fdim |
| 1179 | |
| 1180 | using ::fdim; |
| 1181 | using ::fdimf; |
| 1182 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1183 | inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);} |
| 1184 | inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1185 | |
| 1186 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1187 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1188 | typename enable_if |
| 1189 | < |
| 1190 | is_arithmetic<_A1>::value && |
| 1191 | is_arithmetic<_A2>::value, |
| 1192 | typename __promote<_A1, _A2>::type |
| 1193 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1194 | fdim(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1195 | { |
| 1196 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1197 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1198 | is_same<_A2, __result_type>::value)), ""); |
| 1199 | return fdim((__result_type)__x, (__result_type)__y); |
| 1200 | } |
| 1201 | |
| 1202 | // fma |
| 1203 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1204 | inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);} |
Howard Hinnant | 0919dba | 2012-11-06 21:55:44 +0000 | [diff] [blame^] | 1205 | #ifndef FP_FAST_FMAF |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1206 | #define FP_FAST_FMAF |
Howard Hinnant | 0919dba | 2012-11-06 21:55:44 +0000 | [diff] [blame^] | 1207 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1208 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1209 | using ::fma; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1210 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1211 | inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);} |
| 1212 | inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1213 | |
| 1214 | template <class _A1, class _A2, class _A3> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1215 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1216 | typename enable_if |
| 1217 | < |
| 1218 | is_arithmetic<_A1>::value && |
| 1219 | is_arithmetic<_A2>::value && |
| 1220 | is_arithmetic<_A3>::value, |
| 1221 | typename __promote<_A1, _A2, _A3>::type |
| 1222 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1223 | fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1224 | { |
| 1225 | typedef typename __promote<_A1, _A2, _A3>::type __result_type; |
| 1226 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1227 | is_same<_A2, __result_type>::value && |
| 1228 | is_same<_A3, __result_type>::value)), ""); |
| 1229 | return fma((__result_type)__x, (__result_type)__y, (__result_type)__z); |
| 1230 | } |
| 1231 | |
| 1232 | // fmax |
| 1233 | |
| 1234 | using ::fmax; |
| 1235 | using ::fmaxf; |
| 1236 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1237 | inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);} |
| 1238 | inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1239 | |
| 1240 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1241 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1242 | typename enable_if |
| 1243 | < |
| 1244 | is_arithmetic<_A1>::value && |
| 1245 | is_arithmetic<_A2>::value, |
| 1246 | typename __promote<_A1, _A2>::type |
| 1247 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1248 | fmax(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1249 | { |
| 1250 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1251 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1252 | is_same<_A2, __result_type>::value)), ""); |
| 1253 | return fmax((__result_type)__x, (__result_type)__y); |
| 1254 | } |
| 1255 | |
| 1256 | // fmin |
| 1257 | |
| 1258 | using ::fmin; |
| 1259 | using ::fminf; |
| 1260 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1261 | inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);} |
| 1262 | inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1263 | |
| 1264 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1265 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1266 | typename enable_if |
| 1267 | < |
| 1268 | is_arithmetic<_A1>::value && |
| 1269 | is_arithmetic<_A2>::value, |
| 1270 | typename __promote<_A1, _A2>::type |
| 1271 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1272 | fmin(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1273 | { |
| 1274 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1275 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1276 | is_same<_A2, __result_type>::value)), ""); |
| 1277 | return fmin((__result_type)__x, (__result_type)__y); |
| 1278 | } |
| 1279 | |
| 1280 | // hypot |
| 1281 | |
| 1282 | using ::hypot; |
| 1283 | using ::hypotf; |
| 1284 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1285 | inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);} |
| 1286 | inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1287 | |
| 1288 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1289 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1290 | typename enable_if |
| 1291 | < |
| 1292 | is_arithmetic<_A1>::value && |
| 1293 | is_arithmetic<_A2>::value, |
| 1294 | typename __promote<_A1, _A2>::type |
| 1295 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1296 | hypot(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1297 | { |
| 1298 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1299 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1300 | is_same<_A2, __result_type>::value)), ""); |
| 1301 | return hypot((__result_type)__x, (__result_type)__y); |
| 1302 | } |
| 1303 | |
| 1304 | // ilogb |
| 1305 | |
| 1306 | using ::ilogb; |
| 1307 | using ::ilogbf; |
| 1308 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1309 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);} |
| 1310 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1311 | |
| 1312 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1313 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1314 | typename enable_if<is_integral<_A1>::value, int>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1315 | ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1316 | |
| 1317 | // lgamma |
| 1318 | |
| 1319 | using ::lgamma; |
| 1320 | using ::lgammaf; |
| 1321 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1322 | inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);} |
| 1323 | inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1324 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1325 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1326 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1327 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1328 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1329 | lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1330 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1331 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1332 | // llrint |
| 1333 | |
| 1334 | using ::llrint; |
| 1335 | using ::llrintf; |
| 1336 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1337 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);} |
| 1338 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1339 | |
| 1340 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1341 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1342 | typename enable_if<is_integral<_A1>::value, long long>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1343 | llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1344 | |
| 1345 | // llround |
| 1346 | |
| 1347 | using ::llround; |
| 1348 | using ::llroundf; |
| 1349 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1350 | inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);} |
| 1351 | inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1352 | |
| 1353 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1354 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1355 | typename enable_if<is_integral<_A1>::value, long long>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1356 | llround(_A1 __x) _NOEXCEPT {return llround((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1357 | |
| 1358 | // log1p |
| 1359 | |
| 1360 | using ::log1p; |
| 1361 | using ::log1pf; |
| 1362 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1363 | inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);} |
| 1364 | inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1365 | |
| 1366 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1367 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1368 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1369 | log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1370 | |
| 1371 | // log2 |
| 1372 | |
| 1373 | using ::log2; |
| 1374 | using ::log2f; |
| 1375 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1376 | inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);} |
| 1377 | inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1378 | |
| 1379 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1380 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1381 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1382 | log2(_A1 __x) _NOEXCEPT {return log2((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1383 | |
| 1384 | // logb |
| 1385 | |
| 1386 | using ::logb; |
| 1387 | using ::logbf; |
| 1388 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1389 | inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);} |
| 1390 | inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1391 | |
| 1392 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1393 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1394 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1395 | logb(_A1 __x) _NOEXCEPT {return logb((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1396 | |
| 1397 | // lrint |
| 1398 | |
| 1399 | using ::lrint; |
| 1400 | using ::lrintf; |
| 1401 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1402 | inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);} |
| 1403 | inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1404 | |
| 1405 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1406 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1407 | typename enable_if<is_integral<_A1>::value, long>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1408 | lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1409 | |
| 1410 | // lround |
| 1411 | |
| 1412 | using ::lround; |
| 1413 | using ::lroundf; |
| 1414 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1415 | inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);} |
| 1416 | inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1417 | |
| 1418 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1419 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1420 | typename enable_if<is_integral<_A1>::value, long>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1421 | lround(_A1 __x) _NOEXCEPT {return lround((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1422 | |
| 1423 | // nan |
David Chisnall | b6e7c30 | 2012-02-29 16:41:21 +0000 | [diff] [blame] | 1424 | #endif // _MSC_VER |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1425 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1426 | using ::nan; |
| 1427 | using ::nanf; |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1428 | #ifndef __sun__ |
David Chisnall | b6e7c30 | 2012-02-29 16:41:21 +0000 | [diff] [blame] | 1429 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1430 | |
| 1431 | // nearbyint |
| 1432 | |
| 1433 | using ::nearbyint; |
| 1434 | using ::nearbyintf; |
| 1435 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1436 | inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);} |
| 1437 | inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1438 | |
| 1439 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1440 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1441 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1442 | nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1443 | |
| 1444 | // nextafter |
| 1445 | |
| 1446 | using ::nextafter; |
| 1447 | using ::nextafterf; |
| 1448 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1449 | inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);} |
| 1450 | inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1451 | |
| 1452 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1453 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1454 | typename enable_if |
| 1455 | < |
| 1456 | is_arithmetic<_A1>::value && |
| 1457 | is_arithmetic<_A2>::value, |
| 1458 | typename __promote<_A1, _A2>::type |
| 1459 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1460 | nextafter(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1461 | { |
| 1462 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1463 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1464 | is_same<_A2, __result_type>::value)), ""); |
| 1465 | return nextafter((__result_type)__x, (__result_type)__y); |
| 1466 | } |
| 1467 | |
| 1468 | // nexttoward |
| 1469 | |
| 1470 | using ::nexttoward; |
| 1471 | using ::nexttowardf; |
| 1472 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1473 | inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);} |
| 1474 | inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1475 | |
| 1476 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1477 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1478 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1479 | nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1480 | |
| 1481 | // remainder |
| 1482 | |
| 1483 | using ::remainder; |
| 1484 | using ::remainderf; |
| 1485 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1486 | inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);} |
| 1487 | inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1488 | |
| 1489 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1490 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1491 | typename enable_if |
| 1492 | < |
| 1493 | is_arithmetic<_A1>::value && |
| 1494 | is_arithmetic<_A2>::value, |
| 1495 | typename __promote<_A1, _A2>::type |
| 1496 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1497 | remainder(_A1 __x, _A2 __y) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1498 | { |
| 1499 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1500 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1501 | is_same<_A2, __result_type>::value)), ""); |
| 1502 | return remainder((__result_type)__x, (__result_type)__y); |
| 1503 | } |
| 1504 | |
| 1505 | // remquo |
| 1506 | |
| 1507 | using ::remquo; |
| 1508 | using ::remquof; |
| 1509 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1510 | inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);} |
| 1511 | inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1512 | |
| 1513 | template <class _A1, class _A2> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1514 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1515 | typename enable_if |
| 1516 | < |
| 1517 | is_arithmetic<_A1>::value && |
| 1518 | is_arithmetic<_A2>::value, |
| 1519 | typename __promote<_A1, _A2>::type |
| 1520 | >::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1521 | remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1522 | { |
| 1523 | typedef typename __promote<_A1, _A2>::type __result_type; |
| 1524 | static_assert((!(is_same<_A1, __result_type>::value && |
| 1525 | is_same<_A2, __result_type>::value)), ""); |
| 1526 | return remquo((__result_type)__x, (__result_type)__y, __z); |
| 1527 | } |
| 1528 | |
| 1529 | // rint |
| 1530 | |
| 1531 | using ::rint; |
| 1532 | using ::rintf; |
| 1533 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1534 | inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);} |
| 1535 | inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1536 | |
| 1537 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1538 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1539 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1540 | rint(_A1 __x) _NOEXCEPT {return rint((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1541 | |
| 1542 | // round |
| 1543 | |
| 1544 | using ::round; |
| 1545 | using ::roundf; |
| 1546 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1547 | inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);} |
| 1548 | inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1549 | |
| 1550 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1551 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1552 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1553 | round(_A1 __x) _NOEXCEPT {return round((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1554 | |
| 1555 | // scalbln |
| 1556 | |
| 1557 | using ::scalbln; |
| 1558 | using ::scalblnf; |
| 1559 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1560 | inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);} |
| 1561 | inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1562 | |
| 1563 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1564 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1565 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1566 | scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1567 | |
| 1568 | // scalbn |
| 1569 | |
| 1570 | using ::scalbn; |
| 1571 | using ::scalbnf; |
| 1572 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1573 | inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);} |
| 1574 | inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1575 | |
| 1576 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1577 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1578 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1579 | scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1580 | |
| 1581 | // tgamma |
| 1582 | |
| 1583 | using ::tgamma; |
| 1584 | using ::tgammaf; |
| 1585 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1586 | inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);} |
| 1587 | inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1588 | |
| 1589 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1590 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1591 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1592 | tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1593 | |
| 1594 | // trunc |
| 1595 | |
| 1596 | using ::trunc; |
| 1597 | using ::truncf; |
| 1598 | |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1599 | inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);} |
| 1600 | inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1601 | |
| 1602 | template <class _A1> |
Howard Hinnant | 422a53f | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 1603 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1604 | typename enable_if<is_integral<_A1>::value, double>::type |
Howard Hinnant | cac0c46 | 2012-07-06 19:13:50 +0000 | [diff] [blame] | 1605 | trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);} |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1606 | |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1607 | #endif // !_MSC_VER |
| 1608 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1609 | using ::acosl; |
| 1610 | using ::asinl; |
| 1611 | using ::atanl; |
| 1612 | using ::atan2l; |
| 1613 | using ::ceill; |
| 1614 | using ::cosl; |
| 1615 | using ::coshl; |
| 1616 | using ::expl; |
| 1617 | using ::fabsl; |
| 1618 | using ::floorl; |
| 1619 | using ::fmodl; |
| 1620 | using ::frexpl; |
| 1621 | using ::ldexpl; |
| 1622 | using ::logl; |
| 1623 | using ::log10l; |
| 1624 | using ::modfl; |
| 1625 | using ::powl; |
| 1626 | using ::sinl; |
| 1627 | using ::sinhl; |
| 1628 | using ::sqrtl; |
| 1629 | using ::tanl; |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1630 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1631 | using ::tanhl; |
| 1632 | using ::acoshl; |
| 1633 | using ::asinhl; |
| 1634 | using ::atanhl; |
| 1635 | using ::cbrtl; |
Howard Hinnant | ec3773c | 2011-12-01 20:21:04 +0000 | [diff] [blame] | 1636 | #endif // !_MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1637 | using ::copysignl; |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1638 | #ifndef _MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1639 | using ::erfl; |
| 1640 | using ::erfcl; |
| 1641 | using ::exp2l; |
| 1642 | using ::expm1l; |
| 1643 | using ::fdiml; |
| 1644 | using ::fmal; |
| 1645 | using ::fmaxl; |
| 1646 | using ::fminl; |
| 1647 | using ::hypotl; |
| 1648 | using ::ilogbl; |
| 1649 | using ::lgammal; |
| 1650 | using ::llrintl; |
| 1651 | using ::llroundl; |
| 1652 | using ::log1pl; |
| 1653 | using ::log2l; |
| 1654 | using ::logbl; |
| 1655 | using ::lrintl; |
| 1656 | using ::lroundl; |
| 1657 | using ::nanl; |
| 1658 | using ::nearbyintl; |
| 1659 | using ::nextafterl; |
| 1660 | using ::nexttowardl; |
| 1661 | using ::remainderl; |
| 1662 | using ::remquol; |
| 1663 | using ::rintl; |
| 1664 | using ::roundl; |
| 1665 | using ::scalblnl; |
| 1666 | using ::scalbnl; |
| 1667 | using ::tgammal; |
| 1668 | using ::truncl; |
Howard Hinnant | 9f8884e | 2011-10-27 16:24:42 +0000 | [diff] [blame] | 1669 | #endif // !_MSC_VER |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1670 | |
David Chisnall | 997e454 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 1671 | #else |
| 1672 | using ::lgamma; |
| 1673 | using ::lgammaf; |
| 1674 | #endif // __sun__ |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1675 | _LIBCPP_END_NAMESPACE_STD |
| 1676 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1677 | #endif // _LIBCPP_CMATH |