| 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_CMATH |
| 11 | #define _LIBCPP_CMATH |
| 12 | |
| 13 | /* |
| 14 | cmath synopsis |
| 15 | |
| 16 | Macros: |
| 17 | |
| 18 | HUGE_VAL |
| 19 | HUGE_VALF // C99 |
| 20 | HUGE_VALL // C99 |
| 21 | INFINITY // C99 |
| 22 | NAN // C99 |
| 23 | FP_INFINITE // C99 |
| 24 | FP_NAN // C99 |
| 25 | FP_NORMAL // C99 |
| 26 | FP_SUBNORMAL // C99 |
| 27 | FP_ZERO // C99 |
| 28 | FP_FAST_FMA // C99 |
| 29 | FP_FAST_FMAF // C99 |
| 30 | FP_FAST_FMAL // C99 |
| 31 | FP_ILOGB0 // C99 |
| 32 | FP_ILOGBNAN // C99 |
| 33 | MATH_ERRNO // C99 |
| 34 | MATH_ERREXCEPT // C99 |
| 35 | math_errhandling // C99 |
| 36 | |
| 37 | namespace std |
| 38 | { |
| 39 | |
| 40 | Types: |
| 41 | |
| 42 | float_t // C99 |
| 43 | double_t // C99 |
| 44 | |
| 45 | // C90 |
| 46 | |
| 47 | floating_point abs(floating_point x); |
| 48 | |
| 49 | floating_point acos (arithmetic x); |
| 50 | float acosf(float x); |
| 51 | long double acosl(long double x); |
| 52 | |
| 53 | floating_point asin (arithmetic x); |
| 54 | float asinf(float x); |
| 55 | long double asinl(long double x); |
| 56 | |
| 57 | floating_point atan (arithmetic x); |
| 58 | float atanf(float x); |
| 59 | long double atanl(long double x); |
| 60 | |
| 61 | floating_point atan2 (arithmetic y, arithmetic x); |
| 62 | float atan2f(float y, float x); |
| 63 | long double atan2l(long double y, long double x); |
| 64 | |
| 65 | floating_point ceil (arithmetic x); |
| 66 | float ceilf(float x); |
| 67 | long double ceill(long double x); |
| 68 | |
| 69 | floating_point cos (arithmetic x); |
| 70 | float cosf(float x); |
| 71 | long double cosl(long double x); |
| 72 | |
| 73 | floating_point cosh (arithmetic x); |
| 74 | float coshf(float x); |
| 75 | long double coshl(long double x); |
| 76 | |
| 77 | floating_point exp (arithmetic x); |
| 78 | float expf(float x); |
| 79 | long double expl(long double x); |
| 80 | |
| 81 | floating_point fabs (arithmetic x); |
| 82 | float fabsf(float x); |
| 83 | long double fabsl(long double x); |
| 84 | |
| 85 | floating_point floor (arithmetic x); |
| 86 | float floorf(float x); |
| 87 | long double floorl(long double x); |
| 88 | |
| 89 | floating_point fmod (arithmetic x, arithmetic y); |
| 90 | float fmodf(float x, float y); |
| 91 | long double fmodl(long double x, long double y); |
| 92 | |
| 93 | floating_point frexp (arithmetic value, int* exp); |
| 94 | float frexpf(float value, int* exp); |
| 95 | long double frexpl(long double value, int* exp); |
| 96 | |
| 97 | floating_point ldexp (arithmetic value, int exp); |
| 98 | float ldexpf(float value, int exp); |
| 99 | long double ldexpl(long double value, int exp); |
| 100 | |
| 101 | floating_point log (arithmetic x); |
| 102 | float logf(float x); |
| 103 | long double logl(long double x); |
| 104 | |
| 105 | floating_point log10 (arithmetic x); |
| 106 | float log10f(float x); |
| 107 | long double log10l(long double x); |
| 108 | |
| 109 | floating_point modf (floating_point value, floating_point* iptr); |
| 110 | float modff(float value, float* iptr); |
| 111 | long double modfl(long double value, long double* iptr); |
| 112 | |
| 113 | floating_point pow (arithmetic x, arithmetic y); |
| 114 | float powf(float x, float y); |
| 115 | long double powl(long double x, long double y); |
| 116 | |
| 117 | floating_point sin (arithmetic x); |
| 118 | float sinf(float x); |
| 119 | long double sinl(long double x); |
| 120 | |
| 121 | floating_point sinh (arithmetic x); |
| 122 | float sinhf(float x); |
| 123 | long double sinhl(long double x); |
| 124 | |
| 125 | floating_point sqrt (arithmetic x); |
| 126 | float sqrtf(float x); |
| 127 | long double sqrtl(long double x); |
| 128 | |
| 129 | floating_point tan (arithmetic x); |
| 130 | float tanf(float x); |
| 131 | long double tanl(long double x); |
| 132 | |
| 133 | floating_point tanh (arithmetic x); |
| 134 | float tanhf(float x); |
| 135 | long double tanhl(long double x); |
| 136 | |
| 137 | // C99 |
| 138 | |
| 139 | bool signbit(arithmetic x); |
| 140 | |
| 141 | int fpclassify(arithmetic x); |
| 142 | |
| 143 | bool isfinite(arithmetic x); |
| 144 | bool isinf(arithmetic x); |
| 145 | bool isnan(arithmetic x); |
| 146 | bool isnormal(arithmetic x); |
| 147 | |
| 148 | bool isgreater(arithmetic x, arithmetic y); |
| 149 | bool isgreaterequal(arithmetic x, arithmetic y); |
| 150 | bool isless(arithmetic x, arithmetic y); |
| 151 | bool islessequal(arithmetic x, arithmetic y); |
| 152 | bool islessgreater(arithmetic x, arithmetic y); |
| 153 | bool isunordered(arithmetic x, arithmetic y); |
| 154 | |
| 155 | floating_point acosh (arithmetic x); |
| 156 | float acoshf(float x); |
| 157 | long double acoshl(long double x); |
| 158 | |
| 159 | floating_point asinh (arithmetic x); |
| 160 | float asinhf(float x); |
| 161 | long double asinhl(long double x); |
| 162 | |
| 163 | floating_point atanh (arithmetic x); |
| 164 | float atanhf(float x); |
| 165 | long double atanhl(long double x); |
| 166 | |
| 167 | floating_point cbrt (arithmetic x); |
| 168 | float cbrtf(float x); |
| 169 | long double cbrtl(long double x); |
| 170 | |
| 171 | floating_point copysign (arithmetic x, arithmetic y); |
| 172 | float copysignf(float x, float y); |
| 173 | long double copysignl(long double x, long double y); |
| 174 | |
| 175 | floating_point erf (arithmetic x); |
| 176 | float erff(float x); |
| 177 | long double erfl(long double x); |
| 178 | |
| 179 | floating_point erfc (arithmetic x); |
| 180 | float erfcf(float x); |
| 181 | long double erfcl(long double x); |
| 182 | |
| 183 | floating_point exp2 (arithmetic x); |
| 184 | float exp2f(float x); |
| 185 | long double exp2l(long double x); |
| 186 | |
| 187 | floating_point expm1 (arithmetic x); |
| 188 | float expm1f(float x); |
| 189 | long double expm1l(long double x); |
| 190 | |
| 191 | floating_point fdim (arithmetic x, arithmetic y); |
| 192 | float fdimf(float x, float y); |
| 193 | long double fdiml(long double x, long double y); |
| 194 | |
| 195 | floating_point fma (arithmetic x, arithmetic y, arithmetic z); |
| 196 | float fmaf(float x, float y, float z); |
| 197 | long double fmal(long double x, long double y, long double z); |
| 198 | |
| 199 | floating_point fmax (arithmetic x, arithmetic y); |
| 200 | float fmaxf(float x, float y); |
| 201 | long double fmaxl(long double x, long double y); |
| 202 | |
| 203 | floating_point fmin (arithmetic x, arithmetic y); |
| 204 | float fminf(float x, float y); |
| 205 | long double fminl(long double x, long double y); |
| 206 | |
| 207 | double hermite(unsigned n, double x); // C++17 |
| 208 | float hermite(unsigned n, float x); // C++17 |
| 209 | long double hermite(unsigned n, long double x); // C++17 |
| 210 | float hermitef(unsigned n, float x); // C++17 |
| 211 | long double hermitel(unsigned n, long double x); // C++17 |
| 212 | template <class Integer> |
| 213 | double hermite(unsigned n, Integer x); // C++17 |
| 214 | |
| 215 | floating_point hypot (arithmetic x, arithmetic y); |
| 216 | float hypotf(float x, float y); |
| 217 | long double hypotl(long double x, long double y); |
| 218 | |
| 219 | double hypot(double x, double y, double z); // C++17 |
| 220 | float hypot(float x, float y, float z); // C++17 |
| 221 | long double hypot(long double x, long double y, long double z); // C++17 |
| 222 | |
| 223 | int ilogb (arithmetic x); |
| 224 | int ilogbf(float x); |
| 225 | int ilogbl(long double x); |
| 226 | |
| 227 | floating_point lgamma (arithmetic x); |
| 228 | float lgammaf(float x); |
| 229 | long double lgammal(long double x); |
| 230 | |
| 231 | long long llrint (arithmetic x); |
| 232 | long long llrintf(float x); |
| 233 | long long llrintl(long double x); |
| 234 | |
| 235 | long long llround (arithmetic x); |
| 236 | long long llroundf(float x); |
| 237 | long long llroundl(long double x); |
| 238 | |
| 239 | floating_point log1p (arithmetic x); |
| 240 | float log1pf(float x); |
| 241 | long double log1pl(long double x); |
| 242 | |
| 243 | floating_point log2 (arithmetic x); |
| 244 | float log2f(float x); |
| 245 | long double log2l(long double x); |
| 246 | |
| 247 | floating_point logb (arithmetic x); |
| 248 | float logbf(float x); |
| 249 | long double logbl(long double x); |
| 250 | |
| 251 | long lrint (arithmetic x); |
| 252 | long lrintf(float x); |
| 253 | long lrintl(long double x); |
| 254 | |
| 255 | long lround (arithmetic x); |
| 256 | long lroundf(float x); |
| 257 | long lroundl(long double x); |
| 258 | |
| 259 | double nan (const char* str); |
| 260 | float nanf(const char* str); |
| 261 | long double nanl(const char* str); |
| 262 | |
| 263 | floating_point nearbyint (arithmetic x); |
| 264 | float nearbyintf(float x); |
| 265 | long double nearbyintl(long double x); |
| 266 | |
| 267 | floating_point nextafter (arithmetic x, arithmetic y); |
| 268 | float nextafterf(float x, float y); |
| 269 | long double nextafterl(long double x, long double y); |
| 270 | |
| 271 | floating_point nexttoward (arithmetic x, long double y); |
| 272 | float nexttowardf(float x, long double y); |
| 273 | long double nexttowardl(long double x, long double y); |
| 274 | |
| 275 | floating_point remainder (arithmetic x, arithmetic y); |
| 276 | float remainderf(float x, float y); |
| 277 | long double remainderl(long double x, long double y); |
| 278 | |
| 279 | floating_point remquo (arithmetic x, arithmetic y, int* pquo); |
| 280 | float remquof(float x, float y, int* pquo); |
| 281 | long double remquol(long double x, long double y, int* pquo); |
| 282 | |
| 283 | floating_point rint (arithmetic x); |
| 284 | float rintf(float x); |
| 285 | long double rintl(long double x); |
| 286 | |
| 287 | floating_point round (arithmetic x); |
| 288 | float roundf(float x); |
| 289 | long double roundl(long double x); |
| 290 | |
| 291 | floating_point scalbln (arithmetic x, long ex); |
| 292 | float scalblnf(float x, long ex); |
| 293 | long double scalblnl(long double x, long ex); |
| 294 | |
| 295 | floating_point scalbn (arithmetic x, int ex); |
| 296 | float scalbnf(float x, int ex); |
| 297 | long double scalbnl(long double x, int ex); |
| 298 | |
| 299 | floating_point tgamma (arithmetic x); |
| 300 | float tgammaf(float x); |
| 301 | long double tgammal(long double x); |
| 302 | |
| 303 | floating_point trunc (arithmetic x); |
| 304 | float truncf(float x); |
| 305 | long double truncl(long double x); |
| 306 | |
| 307 | constexpr float lerp(float a, float b, float t) noexcept; // C++20 |
| 308 | constexpr double lerp(double a, double b, double t) noexcept; // C++20 |
| 309 | constexpr long double lerp(long double a, long double b, long double t) noexcept; // C++20 |
| 310 | |
| 311 | } // std |
| 312 | |
| 313 | */ |
| 314 | |
| 315 | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 316 | # include <__cxx03/cmath> |
| 317 | #else |
| 318 | # include <__config> |
| 319 | # include <__math/hypot.h> |
| 320 | # include <__type_traits/enable_if.h> |
| 321 | # include <__type_traits/is_arithmetic.h> |
| 322 | # include <__type_traits/is_constant_evaluated.h> |
| 323 | # include <__type_traits/is_floating_point.h> |
| 324 | # include <__type_traits/is_same.h> |
| 325 | # include <__type_traits/promote.h> |
| 326 | # include <__type_traits/remove_cv.h> |
| 327 | # include <limits> |
| 328 | # include <version> |
| 329 | |
| 330 | # include <__math/special_functions.h> |
| 331 | # include <math.h> |
| 332 | |
| 333 | # ifndef _LIBCPP_MATH_H |
| 334 | # error <cmath> tried including <math.h> but didn't find libc++'s <math.h> header. \ |
| 335 | This usually means that your header search paths are not configured properly. \ |
| 336 | The header search paths should contain the C++ Standard Library headers before \ |
| 337 | any C Standard Library, and you are probably using compiler flags that make that \ |
| 338 | not be the case. |
| 339 | # endif |
| 340 | |
| 341 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 342 | # pragma GCC system_header |
| 343 | # endif |
| 344 | |
| 345 | _LIBCPP_PUSH_MACROS |
| 346 | # include <__undef_macros> |
| 347 | |
| 348 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 349 | |
| 350 | using ::signbit _LIBCPP_USING_IF_EXISTS; |
| 351 | using ::fpclassify _LIBCPP_USING_IF_EXISTS; |
| 352 | using ::isfinite _LIBCPP_USING_IF_EXISTS; |
| 353 | using ::isinf _LIBCPP_USING_IF_EXISTS; |
| 354 | using ::isnan _LIBCPP_USING_IF_EXISTS; |
| 355 | using ::isnormal _LIBCPP_USING_IF_EXISTS; |
| 356 | using ::isgreater _LIBCPP_USING_IF_EXISTS; |
| 357 | using ::isgreaterequal _LIBCPP_USING_IF_EXISTS; |
| 358 | using ::isless _LIBCPP_USING_IF_EXISTS; |
| 359 | using ::islessequal _LIBCPP_USING_IF_EXISTS; |
| 360 | using ::islessgreater _LIBCPP_USING_IF_EXISTS; |
| 361 | using ::isunordered _LIBCPP_USING_IF_EXISTS; |
| 362 | using ::isunordered _LIBCPP_USING_IF_EXISTS; |
| 363 | |
| 364 | using ::float_t _LIBCPP_USING_IF_EXISTS; |
| 365 | using ::double_t _LIBCPP_USING_IF_EXISTS; |
| 366 | |
| 367 | using ::abs _LIBCPP_USING_IF_EXISTS; |
| 368 | |
| 369 | using ::acos _LIBCPP_USING_IF_EXISTS; |
| 370 | using ::acosf _LIBCPP_USING_IF_EXISTS; |
| 371 | using ::asin _LIBCPP_USING_IF_EXISTS; |
| 372 | using ::asinf _LIBCPP_USING_IF_EXISTS; |
| 373 | using ::atan _LIBCPP_USING_IF_EXISTS; |
| 374 | using ::atanf _LIBCPP_USING_IF_EXISTS; |
| 375 | using ::atan2 _LIBCPP_USING_IF_EXISTS; |
| 376 | using ::atan2f _LIBCPP_USING_IF_EXISTS; |
| 377 | using ::ceil _LIBCPP_USING_IF_EXISTS; |
| 378 | using ::ceilf _LIBCPP_USING_IF_EXISTS; |
| 379 | using ::cos _LIBCPP_USING_IF_EXISTS; |
| 380 | using ::cosf _LIBCPP_USING_IF_EXISTS; |
| 381 | using ::cosh _LIBCPP_USING_IF_EXISTS; |
| 382 | using ::coshf _LIBCPP_USING_IF_EXISTS; |
| 383 | |
| 384 | using ::exp _LIBCPP_USING_IF_EXISTS; |
| 385 | using ::expf _LIBCPP_USING_IF_EXISTS; |
| 386 | |
| 387 | using ::fabs _LIBCPP_USING_IF_EXISTS; |
| 388 | using ::fabsf _LIBCPP_USING_IF_EXISTS; |
| 389 | using ::floor _LIBCPP_USING_IF_EXISTS; |
| 390 | using ::floorf _LIBCPP_USING_IF_EXISTS; |
| 391 | |
| 392 | using ::fmod _LIBCPP_USING_IF_EXISTS; |
| 393 | using ::fmodf _LIBCPP_USING_IF_EXISTS; |
| 394 | |
| 395 | using ::frexp _LIBCPP_USING_IF_EXISTS; |
| 396 | using ::frexpf _LIBCPP_USING_IF_EXISTS; |
| 397 | using ::ldexp _LIBCPP_USING_IF_EXISTS; |
| 398 | using ::ldexpf _LIBCPP_USING_IF_EXISTS; |
| 399 | |
| 400 | using ::log _LIBCPP_USING_IF_EXISTS; |
| 401 | using ::logf _LIBCPP_USING_IF_EXISTS; |
| 402 | |
| 403 | using ::log10 _LIBCPP_USING_IF_EXISTS; |
| 404 | using ::log10f _LIBCPP_USING_IF_EXISTS; |
| 405 | using ::modf _LIBCPP_USING_IF_EXISTS; |
| 406 | using ::modff _LIBCPP_USING_IF_EXISTS; |
| 407 | |
| 408 | using ::pow _LIBCPP_USING_IF_EXISTS; |
| 409 | using ::powf _LIBCPP_USING_IF_EXISTS; |
| 410 | |
| 411 | using ::sin _LIBCPP_USING_IF_EXISTS; |
| 412 | using ::sinf _LIBCPP_USING_IF_EXISTS; |
| 413 | using ::sinh _LIBCPP_USING_IF_EXISTS; |
| 414 | using ::sinhf _LIBCPP_USING_IF_EXISTS; |
| 415 | |
| 416 | using ::sqrt _LIBCPP_USING_IF_EXISTS; |
| 417 | using ::sqrtf _LIBCPP_USING_IF_EXISTS; |
| 418 | using ::tan _LIBCPP_USING_IF_EXISTS; |
| 419 | using ::tanf _LIBCPP_USING_IF_EXISTS; |
| 420 | |
| 421 | using ::tanh _LIBCPP_USING_IF_EXISTS; |
| 422 | using ::tanhf _LIBCPP_USING_IF_EXISTS; |
| 423 | |
| 424 | using ::acosh _LIBCPP_USING_IF_EXISTS; |
| 425 | using ::acoshf _LIBCPP_USING_IF_EXISTS; |
| 426 | using ::asinh _LIBCPP_USING_IF_EXISTS; |
| 427 | using ::asinhf _LIBCPP_USING_IF_EXISTS; |
| 428 | using ::atanh _LIBCPP_USING_IF_EXISTS; |
| 429 | using ::atanhf _LIBCPP_USING_IF_EXISTS; |
| 430 | using ::cbrt _LIBCPP_USING_IF_EXISTS; |
| 431 | using ::cbrtf _LIBCPP_USING_IF_EXISTS; |
| 432 | |
| 433 | using ::copysign _LIBCPP_USING_IF_EXISTS; |
| 434 | using ::copysignf _LIBCPP_USING_IF_EXISTS; |
| 435 | |
| 436 | using ::erf _LIBCPP_USING_IF_EXISTS; |
| 437 | using ::erff _LIBCPP_USING_IF_EXISTS; |
| 438 | using ::erfc _LIBCPP_USING_IF_EXISTS; |
| 439 | using ::erfcf _LIBCPP_USING_IF_EXISTS; |
| 440 | using ::exp2 _LIBCPP_USING_IF_EXISTS; |
| 441 | using ::exp2f _LIBCPP_USING_IF_EXISTS; |
| 442 | using ::expm1 _LIBCPP_USING_IF_EXISTS; |
| 443 | using ::expm1f _LIBCPP_USING_IF_EXISTS; |
| 444 | using ::fdim _LIBCPP_USING_IF_EXISTS; |
| 445 | using ::fdimf _LIBCPP_USING_IF_EXISTS; |
| 446 | using ::fmaf _LIBCPP_USING_IF_EXISTS; |
| 447 | using ::fma _LIBCPP_USING_IF_EXISTS; |
| 448 | using ::fmax _LIBCPP_USING_IF_EXISTS; |
| 449 | using ::fmaxf _LIBCPP_USING_IF_EXISTS; |
| 450 | using ::fmin _LIBCPP_USING_IF_EXISTS; |
| 451 | using ::fminf _LIBCPP_USING_IF_EXISTS; |
| 452 | using ::hypot _LIBCPP_USING_IF_EXISTS; |
| 453 | using ::hypotf _LIBCPP_USING_IF_EXISTS; |
| 454 | using ::ilogb _LIBCPP_USING_IF_EXISTS; |
| 455 | using ::ilogbf _LIBCPP_USING_IF_EXISTS; |
| 456 | using ::lgamma _LIBCPP_USING_IF_EXISTS; |
| 457 | using ::lgammaf _LIBCPP_USING_IF_EXISTS; |
| 458 | using ::llrint _LIBCPP_USING_IF_EXISTS; |
| 459 | using ::llrintf _LIBCPP_USING_IF_EXISTS; |
| 460 | using ::llround _LIBCPP_USING_IF_EXISTS; |
| 461 | using ::llroundf _LIBCPP_USING_IF_EXISTS; |
| 462 | using ::log1p _LIBCPP_USING_IF_EXISTS; |
| 463 | using ::log1pf _LIBCPP_USING_IF_EXISTS; |
| 464 | using ::log2 _LIBCPP_USING_IF_EXISTS; |
| 465 | using ::log2f _LIBCPP_USING_IF_EXISTS; |
| 466 | using ::logb _LIBCPP_USING_IF_EXISTS; |
| 467 | using ::logbf _LIBCPP_USING_IF_EXISTS; |
| 468 | using ::lrint _LIBCPP_USING_IF_EXISTS; |
| 469 | using ::lrintf _LIBCPP_USING_IF_EXISTS; |
| 470 | using ::lround _LIBCPP_USING_IF_EXISTS; |
| 471 | using ::lroundf _LIBCPP_USING_IF_EXISTS; |
| 472 | |
| 473 | using ::nan _LIBCPP_USING_IF_EXISTS; |
| 474 | using ::nanf _LIBCPP_USING_IF_EXISTS; |
| 475 | |
| 476 | using ::nearbyint _LIBCPP_USING_IF_EXISTS; |
| 477 | using ::nearbyintf _LIBCPP_USING_IF_EXISTS; |
| 478 | using ::nextafter _LIBCPP_USING_IF_EXISTS; |
| 479 | using ::nextafterf _LIBCPP_USING_IF_EXISTS; |
| 480 | using ::nexttoward _LIBCPP_USING_IF_EXISTS; |
| 481 | using ::nexttowardf _LIBCPP_USING_IF_EXISTS; |
| 482 | using ::remainder _LIBCPP_USING_IF_EXISTS; |
| 483 | using ::remainderf _LIBCPP_USING_IF_EXISTS; |
| 484 | using ::remquo _LIBCPP_USING_IF_EXISTS; |
| 485 | using ::remquof _LIBCPP_USING_IF_EXISTS; |
| 486 | using ::rint _LIBCPP_USING_IF_EXISTS; |
| 487 | using ::rintf _LIBCPP_USING_IF_EXISTS; |
| 488 | using ::round _LIBCPP_USING_IF_EXISTS; |
| 489 | using ::roundf _LIBCPP_USING_IF_EXISTS; |
| 490 | using ::scalbln _LIBCPP_USING_IF_EXISTS; |
| 491 | using ::scalblnf _LIBCPP_USING_IF_EXISTS; |
| 492 | using ::scalbn _LIBCPP_USING_IF_EXISTS; |
| 493 | using ::scalbnf _LIBCPP_USING_IF_EXISTS; |
| 494 | using ::tgamma _LIBCPP_USING_IF_EXISTS; |
| 495 | using ::tgammaf _LIBCPP_USING_IF_EXISTS; |
| 496 | using ::trunc _LIBCPP_USING_IF_EXISTS; |
| 497 | using ::truncf _LIBCPP_USING_IF_EXISTS; |
| 498 | |
| 499 | using ::acosl _LIBCPP_USING_IF_EXISTS; |
| 500 | using ::asinl _LIBCPP_USING_IF_EXISTS; |
| 501 | using ::atanl _LIBCPP_USING_IF_EXISTS; |
| 502 | using ::atan2l _LIBCPP_USING_IF_EXISTS; |
| 503 | using ::ceill _LIBCPP_USING_IF_EXISTS; |
| 504 | using ::cosl _LIBCPP_USING_IF_EXISTS; |
| 505 | using ::coshl _LIBCPP_USING_IF_EXISTS; |
| 506 | using ::expl _LIBCPP_USING_IF_EXISTS; |
| 507 | using ::fabsl _LIBCPP_USING_IF_EXISTS; |
| 508 | using ::floorl _LIBCPP_USING_IF_EXISTS; |
| 509 | using ::fmodl _LIBCPP_USING_IF_EXISTS; |
| 510 | using ::frexpl _LIBCPP_USING_IF_EXISTS; |
| 511 | using ::ldexpl _LIBCPP_USING_IF_EXISTS; |
| 512 | using ::logl _LIBCPP_USING_IF_EXISTS; |
| 513 | using ::log10l _LIBCPP_USING_IF_EXISTS; |
| 514 | using ::modfl _LIBCPP_USING_IF_EXISTS; |
| 515 | using ::powl _LIBCPP_USING_IF_EXISTS; |
| 516 | using ::sinl _LIBCPP_USING_IF_EXISTS; |
| 517 | using ::sinhl _LIBCPP_USING_IF_EXISTS; |
| 518 | using ::sqrtl _LIBCPP_USING_IF_EXISTS; |
| 519 | using ::tanl _LIBCPP_USING_IF_EXISTS; |
| 520 | |
| 521 | using ::tanhl _LIBCPP_USING_IF_EXISTS; |
| 522 | using ::acoshl _LIBCPP_USING_IF_EXISTS; |
| 523 | using ::asinhl _LIBCPP_USING_IF_EXISTS; |
| 524 | using ::atanhl _LIBCPP_USING_IF_EXISTS; |
| 525 | using ::cbrtl _LIBCPP_USING_IF_EXISTS; |
| 526 | |
| 527 | using ::copysignl _LIBCPP_USING_IF_EXISTS; |
| 528 | |
| 529 | using ::erfl _LIBCPP_USING_IF_EXISTS; |
| 530 | using ::erfcl _LIBCPP_USING_IF_EXISTS; |
| 531 | using ::exp2l _LIBCPP_USING_IF_EXISTS; |
| 532 | using ::expm1l _LIBCPP_USING_IF_EXISTS; |
| 533 | using ::fdiml _LIBCPP_USING_IF_EXISTS; |
| 534 | using ::fmal _LIBCPP_USING_IF_EXISTS; |
| 535 | using ::fmaxl _LIBCPP_USING_IF_EXISTS; |
| 536 | using ::fminl _LIBCPP_USING_IF_EXISTS; |
| 537 | using ::hypotl _LIBCPP_USING_IF_EXISTS; |
| 538 | using ::ilogbl _LIBCPP_USING_IF_EXISTS; |
| 539 | using ::lgammal _LIBCPP_USING_IF_EXISTS; |
| 540 | using ::llrintl _LIBCPP_USING_IF_EXISTS; |
| 541 | using ::llroundl _LIBCPP_USING_IF_EXISTS; |
| 542 | using ::log1pl _LIBCPP_USING_IF_EXISTS; |
| 543 | using ::log2l _LIBCPP_USING_IF_EXISTS; |
| 544 | using ::logbl _LIBCPP_USING_IF_EXISTS; |
| 545 | using ::lrintl _LIBCPP_USING_IF_EXISTS; |
| 546 | using ::lroundl _LIBCPP_USING_IF_EXISTS; |
| 547 | using ::nanl _LIBCPP_USING_IF_EXISTS; |
| 548 | using ::nearbyintl _LIBCPP_USING_IF_EXISTS; |
| 549 | using ::nextafterl _LIBCPP_USING_IF_EXISTS; |
| 550 | using ::nexttowardl _LIBCPP_USING_IF_EXISTS; |
| 551 | using ::remainderl _LIBCPP_USING_IF_EXISTS; |
| 552 | using ::remquol _LIBCPP_USING_IF_EXISTS; |
| 553 | using ::rintl _LIBCPP_USING_IF_EXISTS; |
| 554 | using ::roundl _LIBCPP_USING_IF_EXISTS; |
| 555 | using ::scalblnl _LIBCPP_USING_IF_EXISTS; |
| 556 | using ::scalbnl _LIBCPP_USING_IF_EXISTS; |
| 557 | using ::tgammal _LIBCPP_USING_IF_EXISTS; |
| 558 | using ::truncl _LIBCPP_USING_IF_EXISTS; |
| 559 | |
| 560 | template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> |
| 561 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT { |
| 562 | # if __has_builtin(__builtin_isinf) |
| 563 | return __builtin_isinf(__lcpp_x); |
| 564 | # else |
| 565 | return isinf(__lcpp_x); |
| 566 | # endif |
| 567 | } |
| 568 | |
| 569 | template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0> |
| 570 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT { |
| 571 | return std::isinf(__lcpp_x); |
| 572 | } |
| 573 | |
| 574 | # if _LIBCPP_STD_VER >= 20 |
| 575 | template <typename _Fp> |
| 576 | _LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { |
| 577 | if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0)) |
| 578 | return __t * __b + (1 - __t) * __a; |
| 579 | |
| 580 | if (__t == 1) |
| 581 | return __b; |
| 582 | const _Fp __x = __a + __t * (__b - __a); |
| 583 | if ((__t > 1) == (__b > __a)) |
| 584 | return __b < __x ? __x : __b; |
| 585 | else |
| 586 | return __x < __b ? __x : __b; |
| 587 | } |
| 588 | |
| 589 | _LIBCPP_HIDE_FROM_ABI inline constexpr float lerp(float __a, float __b, float __t) _NOEXCEPT { |
| 590 | return __lerp(__a, __b, __t); |
| 591 | } |
| 592 | |
| 593 | _LIBCPP_HIDE_FROM_ABI inline constexpr double lerp(double __a, double __b, double __t) _NOEXCEPT { |
| 594 | return __lerp(__a, __b, __t); |
| 595 | } |
| 596 | |
| 597 | _LIBCPP_HIDE_FROM_ABI inline constexpr long double lerp(long double __a, long double __b, long double __t) _NOEXCEPT { |
| 598 | return __lerp(__a, __b, __t); |
| 599 | } |
| 600 | |
| 601 | template <class _A1, class _A2, class _A3> |
| 602 | requires(is_arithmetic_v<_A1> && is_arithmetic_v<_A2> && is_arithmetic_v<_A3>) |
| 603 | _LIBCPP_HIDE_FROM_ABI inline constexpr __promote_t<_A1, _A2, _A3> lerp(_A1 __a, _A2 __b, _A3 __t) noexcept { |
| 604 | using __result_type = __promote_t<_A1, _A2, _A3>; |
| 605 | static_assert(!( |
| 606 | _IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value)); |
| 607 | return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t); |
| 608 | } |
| 609 | # endif // _LIBCPP_STD_VER >= 20 |
| 610 | |
| 611 | _LIBCPP_END_NAMESPACE_STD |
| 612 | |
| 613 | _LIBCPP_POP_MACROS |
| 614 | |
| 615 | # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
| 616 | # include <type_traits> |
| 617 | # endif |
| 618 | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) |
| 619 | |
| 620 | #endif // _LIBCPP_CMATH |
| 621 | |