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