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