xref: /freebsd/contrib/llvm-project/libcxx/include/cmath (revision 36b606ae6aa4b24061096ba18582e0a08ccd5dba)
10b57cec5SDimitry Andric// -*- C++ -*-
2349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
30b57cec5SDimitry Andric//
40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric//
80b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric
100b57cec5SDimitry Andric#ifndef _LIBCPP_CMATH
110b57cec5SDimitry Andric#define _LIBCPP_CMATH
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric/*
140b57cec5SDimitry Andric    cmath synopsis
150b57cec5SDimitry Andric
160b57cec5SDimitry AndricMacros:
170b57cec5SDimitry Andric
180b57cec5SDimitry Andric    HUGE_VAL
190b57cec5SDimitry Andric    HUGE_VALF               // C99
200b57cec5SDimitry Andric    HUGE_VALL               // C99
210b57cec5SDimitry Andric    INFINITY                // C99
220b57cec5SDimitry Andric    NAN                     // C99
230b57cec5SDimitry Andric    FP_INFINITE             // C99
240b57cec5SDimitry Andric    FP_NAN                  // C99
250b57cec5SDimitry Andric    FP_NORMAL               // C99
260b57cec5SDimitry Andric    FP_SUBNORMAL            // C99
270b57cec5SDimitry Andric    FP_ZERO                 // C99
280b57cec5SDimitry Andric    FP_FAST_FMA             // C99
290b57cec5SDimitry Andric    FP_FAST_FMAF            // C99
300b57cec5SDimitry Andric    FP_FAST_FMAL            // C99
310b57cec5SDimitry Andric    FP_ILOGB0               // C99
320b57cec5SDimitry Andric    FP_ILOGBNAN             // C99
330b57cec5SDimitry Andric    MATH_ERRNO              // C99
340b57cec5SDimitry Andric    MATH_ERREXCEPT          // C99
350b57cec5SDimitry Andric    math_errhandling        // C99
360b57cec5SDimitry Andric
370b57cec5SDimitry Andricnamespace std
380b57cec5SDimitry Andric{
390b57cec5SDimitry Andric
400b57cec5SDimitry AndricTypes:
410b57cec5SDimitry Andric
420b57cec5SDimitry Andric    float_t                 // C99
430b57cec5SDimitry Andric    double_t                // C99
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric// C90
460b57cec5SDimitry Andric
470b57cec5SDimitry Andricfloating_point abs(floating_point x);
480b57cec5SDimitry Andric
490b57cec5SDimitry Andricfloating_point acos (arithmetic x);
500b57cec5SDimitry Andricfloat          acosf(float x);
510b57cec5SDimitry Andriclong double    acosl(long double x);
520b57cec5SDimitry Andric
530b57cec5SDimitry Andricfloating_point asin (arithmetic x);
540b57cec5SDimitry Andricfloat          asinf(float x);
550b57cec5SDimitry Andriclong double    asinl(long double x);
560b57cec5SDimitry Andric
570b57cec5SDimitry Andricfloating_point atan (arithmetic x);
580b57cec5SDimitry Andricfloat          atanf(float x);
590b57cec5SDimitry Andriclong double    atanl(long double x);
600b57cec5SDimitry Andric
610b57cec5SDimitry Andricfloating_point atan2 (arithmetic y, arithmetic x);
620b57cec5SDimitry Andricfloat          atan2f(float y, float x);
630b57cec5SDimitry Andriclong double    atan2l(long double y, long double x);
640b57cec5SDimitry Andric
650b57cec5SDimitry Andricfloating_point ceil (arithmetic x);
660b57cec5SDimitry Andricfloat          ceilf(float x);
670b57cec5SDimitry Andriclong double    ceill(long double x);
680b57cec5SDimitry Andric
690b57cec5SDimitry Andricfloating_point cos (arithmetic x);
700b57cec5SDimitry Andricfloat          cosf(float x);
710b57cec5SDimitry Andriclong double    cosl(long double x);
720b57cec5SDimitry Andric
730b57cec5SDimitry Andricfloating_point cosh (arithmetic x);
740b57cec5SDimitry Andricfloat          coshf(float x);
750b57cec5SDimitry Andriclong double    coshl(long double x);
760b57cec5SDimitry Andric
770b57cec5SDimitry Andricfloating_point exp (arithmetic x);
780b57cec5SDimitry Andricfloat          expf(float x);
790b57cec5SDimitry Andriclong double    expl(long double x);
800b57cec5SDimitry Andric
810b57cec5SDimitry Andricfloating_point fabs (arithmetic x);
820b57cec5SDimitry Andricfloat          fabsf(float x);
830b57cec5SDimitry Andriclong double    fabsl(long double x);
840b57cec5SDimitry Andric
850b57cec5SDimitry Andricfloating_point floor (arithmetic x);
860b57cec5SDimitry Andricfloat          floorf(float x);
870b57cec5SDimitry Andriclong double    floorl(long double x);
880b57cec5SDimitry Andric
890b57cec5SDimitry Andricfloating_point fmod (arithmetic x, arithmetic y);
900b57cec5SDimitry Andricfloat          fmodf(float x, float y);
910b57cec5SDimitry Andriclong double    fmodl(long double x, long double y);
920b57cec5SDimitry Andric
930b57cec5SDimitry Andricfloating_point frexp (arithmetic value, int* exp);
940b57cec5SDimitry Andricfloat          frexpf(float value, int* exp);
950b57cec5SDimitry Andriclong double    frexpl(long double value, int* exp);
960b57cec5SDimitry Andric
970b57cec5SDimitry Andricfloating_point ldexp (arithmetic value, int exp);
980b57cec5SDimitry Andricfloat          ldexpf(float value, int exp);
990b57cec5SDimitry Andriclong double    ldexpl(long double value, int exp);
1000b57cec5SDimitry Andric
1010b57cec5SDimitry Andricfloating_point log (arithmetic x);
1020b57cec5SDimitry Andricfloat          logf(float x);
1030b57cec5SDimitry Andriclong double    logl(long double x);
1040b57cec5SDimitry Andric
1050b57cec5SDimitry Andricfloating_point log10 (arithmetic x);
1060b57cec5SDimitry Andricfloat          log10f(float x);
1070b57cec5SDimitry Andriclong double    log10l(long double x);
1080b57cec5SDimitry Andric
1090b57cec5SDimitry Andricfloating_point modf (floating_point value, floating_point* iptr);
1100b57cec5SDimitry Andricfloat          modff(float value, float* iptr);
1110b57cec5SDimitry Andriclong double    modfl(long double value, long double* iptr);
1120b57cec5SDimitry Andric
1130b57cec5SDimitry Andricfloating_point pow (arithmetic x, arithmetic y);
1140b57cec5SDimitry Andricfloat          powf(float x, float y);
1150b57cec5SDimitry Andriclong double    powl(long double x, long double y);
1160b57cec5SDimitry Andric
1170b57cec5SDimitry Andricfloating_point sin (arithmetic x);
1180b57cec5SDimitry Andricfloat          sinf(float x);
1190b57cec5SDimitry Andriclong double    sinl(long double x);
1200b57cec5SDimitry Andric
1210b57cec5SDimitry Andricfloating_point sinh (arithmetic x);
1220b57cec5SDimitry Andricfloat          sinhf(float x);
1230b57cec5SDimitry Andriclong double    sinhl(long double x);
1240b57cec5SDimitry Andric
1250b57cec5SDimitry Andricfloating_point sqrt (arithmetic x);
1260b57cec5SDimitry Andricfloat          sqrtf(float x);
1270b57cec5SDimitry Andriclong double    sqrtl(long double x);
1280b57cec5SDimitry Andric
1290b57cec5SDimitry Andricfloating_point tan (arithmetic x);
1300b57cec5SDimitry Andricfloat          tanf(float x);
1310b57cec5SDimitry Andriclong double    tanl(long double x);
1320b57cec5SDimitry Andric
1330b57cec5SDimitry Andricfloating_point tanh (arithmetic x);
1340b57cec5SDimitry Andricfloat          tanhf(float x);
1350b57cec5SDimitry Andriclong double    tanhl(long double x);
1360b57cec5SDimitry Andric
1370b57cec5SDimitry Andric//  C99
1380b57cec5SDimitry Andric
1390b57cec5SDimitry Andricbool signbit(arithmetic x);
1400b57cec5SDimitry Andric
1410b57cec5SDimitry Andricint fpclassify(arithmetic x);
1420b57cec5SDimitry Andric
1430b57cec5SDimitry Andricbool isfinite(arithmetic x);
1440b57cec5SDimitry Andricbool isinf(arithmetic x);
1450b57cec5SDimitry Andricbool isnan(arithmetic x);
1460b57cec5SDimitry Andricbool isnormal(arithmetic x);
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andricbool isgreater(arithmetic x, arithmetic y);
1490b57cec5SDimitry Andricbool isgreaterequal(arithmetic x, arithmetic y);
1500b57cec5SDimitry Andricbool isless(arithmetic x, arithmetic y);
1510b57cec5SDimitry Andricbool islessequal(arithmetic x, arithmetic y);
1520b57cec5SDimitry Andricbool islessgreater(arithmetic x, arithmetic y);
1530b57cec5SDimitry Andricbool isunordered(arithmetic x, arithmetic y);
1540b57cec5SDimitry Andric
1550b57cec5SDimitry Andricfloating_point acosh (arithmetic x);
1560b57cec5SDimitry Andricfloat          acoshf(float x);
1570b57cec5SDimitry Andriclong double    acoshl(long double x);
1580b57cec5SDimitry Andric
1590b57cec5SDimitry Andricfloating_point asinh (arithmetic x);
1600b57cec5SDimitry Andricfloat          asinhf(float x);
1610b57cec5SDimitry Andriclong double    asinhl(long double x);
1620b57cec5SDimitry Andric
1630b57cec5SDimitry Andricfloating_point atanh (arithmetic x);
1640b57cec5SDimitry Andricfloat          atanhf(float x);
1650b57cec5SDimitry Andriclong double    atanhl(long double x);
1660b57cec5SDimitry Andric
1670b57cec5SDimitry Andricfloating_point cbrt (arithmetic x);
1680b57cec5SDimitry Andricfloat          cbrtf(float x);
1690b57cec5SDimitry Andriclong double    cbrtl(long double x);
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andricfloating_point copysign (arithmetic x, arithmetic y);
1720b57cec5SDimitry Andricfloat          copysignf(float x, float y);
1730b57cec5SDimitry Andriclong double    copysignl(long double x, long double y);
1740b57cec5SDimitry Andric
1750b57cec5SDimitry Andricfloating_point erf (arithmetic x);
1760b57cec5SDimitry Andricfloat          erff(float x);
1770b57cec5SDimitry Andriclong double    erfl(long double x);
1780b57cec5SDimitry Andric
1790b57cec5SDimitry Andricfloating_point erfc (arithmetic x);
1800b57cec5SDimitry Andricfloat          erfcf(float x);
1810b57cec5SDimitry Andriclong double    erfcl(long double x);
1820b57cec5SDimitry Andric
1830b57cec5SDimitry Andricfloating_point exp2 (arithmetic x);
1840b57cec5SDimitry Andricfloat          exp2f(float x);
1850b57cec5SDimitry Andriclong double    exp2l(long double x);
1860b57cec5SDimitry Andric
1870b57cec5SDimitry Andricfloating_point expm1 (arithmetic x);
1880b57cec5SDimitry Andricfloat          expm1f(float x);
1890b57cec5SDimitry Andriclong double    expm1l(long double x);
1900b57cec5SDimitry Andric
1910b57cec5SDimitry Andricfloating_point fdim (arithmetic x, arithmetic y);
1920b57cec5SDimitry Andricfloat          fdimf(float x, float y);
1930b57cec5SDimitry Andriclong double    fdiml(long double x, long double y);
1940b57cec5SDimitry Andric
1950b57cec5SDimitry Andricfloating_point fma (arithmetic x, arithmetic y, arithmetic z);
1960b57cec5SDimitry Andricfloat          fmaf(float x, float y, float z);
1970b57cec5SDimitry Andriclong double    fmal(long double x, long double y, long double z);
1980b57cec5SDimitry Andric
1990b57cec5SDimitry Andricfloating_point fmax (arithmetic x, arithmetic y);
2000b57cec5SDimitry Andricfloat          fmaxf(float x, float y);
2010b57cec5SDimitry Andriclong double    fmaxl(long double x, long double y);
2020b57cec5SDimitry Andric
2030b57cec5SDimitry Andricfloating_point fmin (arithmetic x, arithmetic y);
2040b57cec5SDimitry Andricfloat          fminf(float x, float y);
2050b57cec5SDimitry Andriclong double    fminl(long double x, long double y);
2060b57cec5SDimitry Andric
2070fca6ea1SDimitry Andricdouble         hermite(unsigned n, double x);                    // C++17
2080fca6ea1SDimitry Andricfloat          hermite(unsigned n, float x);                     // C++17
2090fca6ea1SDimitry Andriclong double    hermite(unsigned n, long double x);               // C++17
2100fca6ea1SDimitry Andricfloat          hermitef(unsigned n, float x);                    // C++17
2110fca6ea1SDimitry Andriclong double    hermitel(unsigned n, long double x);              // C++17
2120fca6ea1SDimitry Andrictemplate <class Integer>
2130fca6ea1SDimitry Andricdouble         hermite(unsigned n, Integer x);                   // C++17
2140fca6ea1SDimitry Andric
2150b57cec5SDimitry Andricfloating_point hypot (arithmetic x, arithmetic y);
2160b57cec5SDimitry Andricfloat          hypotf(float x, float y);
2170b57cec5SDimitry Andriclong double    hypotl(long double x, long double y);
2180b57cec5SDimitry Andric
2190b57cec5SDimitry Andricdouble       hypot(double x, double y, double z);                // C++17
2200b57cec5SDimitry Andricfloat        hypot(float x, float y, float z);                   // C++17
2210b57cec5SDimitry Andriclong double  hypot(long double x, long double y, long double z); // C++17
2220b57cec5SDimitry Andric
2230b57cec5SDimitry Andricint ilogb (arithmetic x);
2240b57cec5SDimitry Andricint ilogbf(float x);
2250b57cec5SDimitry Andricint ilogbl(long double x);
2260b57cec5SDimitry Andric
2270b57cec5SDimitry Andricfloating_point lgamma (arithmetic x);
2280b57cec5SDimitry Andricfloat          lgammaf(float x);
2290b57cec5SDimitry Andriclong double    lgammal(long double x);
2300b57cec5SDimitry Andric
2310b57cec5SDimitry Andriclong long llrint (arithmetic x);
2320b57cec5SDimitry Andriclong long llrintf(float x);
2330b57cec5SDimitry Andriclong long llrintl(long double x);
2340b57cec5SDimitry Andric
2350b57cec5SDimitry Andriclong long llround (arithmetic x);
2360b57cec5SDimitry Andriclong long llroundf(float x);
2370b57cec5SDimitry Andriclong long llroundl(long double x);
2380b57cec5SDimitry Andric
2390b57cec5SDimitry Andricfloating_point log1p (arithmetic x);
2400b57cec5SDimitry Andricfloat          log1pf(float x);
2410b57cec5SDimitry Andriclong double    log1pl(long double x);
2420b57cec5SDimitry Andric
2430b57cec5SDimitry Andricfloating_point log2 (arithmetic x);
2440b57cec5SDimitry Andricfloat          log2f(float x);
2450b57cec5SDimitry Andriclong double    log2l(long double x);
2460b57cec5SDimitry Andric
2470b57cec5SDimitry Andricfloating_point logb (arithmetic x);
2480b57cec5SDimitry Andricfloat          logbf(float x);
2490b57cec5SDimitry Andriclong double    logbl(long double x);
2500b57cec5SDimitry Andric
2510b57cec5SDimitry Andriclong lrint (arithmetic x);
2520b57cec5SDimitry Andriclong lrintf(float x);
2530b57cec5SDimitry Andriclong lrintl(long double x);
2540b57cec5SDimitry Andric
2550b57cec5SDimitry Andriclong lround (arithmetic x);
2560b57cec5SDimitry Andriclong lroundf(float x);
2570b57cec5SDimitry Andriclong lroundl(long double x);
2580b57cec5SDimitry Andric
2590b57cec5SDimitry Andricdouble      nan (const char* str);
2600b57cec5SDimitry Andricfloat       nanf(const char* str);
2610b57cec5SDimitry Andriclong double nanl(const char* str);
2620b57cec5SDimitry Andric
2630b57cec5SDimitry Andricfloating_point nearbyint (arithmetic x);
2640b57cec5SDimitry Andricfloat          nearbyintf(float x);
2650b57cec5SDimitry Andriclong double    nearbyintl(long double x);
2660b57cec5SDimitry Andric
2670b57cec5SDimitry Andricfloating_point nextafter (arithmetic x, arithmetic y);
2680b57cec5SDimitry Andricfloat          nextafterf(float x, float y);
2690b57cec5SDimitry Andriclong double    nextafterl(long double x, long double y);
2700b57cec5SDimitry Andric
2710b57cec5SDimitry Andricfloating_point nexttoward (arithmetic x, long double y);
2720b57cec5SDimitry Andricfloat          nexttowardf(float x, long double y);
2730b57cec5SDimitry Andriclong double    nexttowardl(long double x, long double y);
2740b57cec5SDimitry Andric
2750b57cec5SDimitry Andricfloating_point remainder (arithmetic x, arithmetic y);
2760b57cec5SDimitry Andricfloat          remainderf(float x, float y);
2770b57cec5SDimitry Andriclong double    remainderl(long double x, long double y);
2780b57cec5SDimitry Andric
2790b57cec5SDimitry Andricfloating_point remquo (arithmetic x, arithmetic y, int* pquo);
2800b57cec5SDimitry Andricfloat          remquof(float x, float y, int* pquo);
2810b57cec5SDimitry Andriclong double    remquol(long double x, long double y, int* pquo);
2820b57cec5SDimitry Andric
2830b57cec5SDimitry Andricfloating_point rint (arithmetic x);
2840b57cec5SDimitry Andricfloat          rintf(float x);
2850b57cec5SDimitry Andriclong double    rintl(long double x);
2860b57cec5SDimitry Andric
2870b57cec5SDimitry Andricfloating_point round (arithmetic x);
2880b57cec5SDimitry Andricfloat          roundf(float x);
2890b57cec5SDimitry Andriclong double    roundl(long double x);
2900b57cec5SDimitry Andric
2910b57cec5SDimitry Andricfloating_point scalbln (arithmetic x, long ex);
2920b57cec5SDimitry Andricfloat          scalblnf(float x, long ex);
2930b57cec5SDimitry Andriclong double    scalblnl(long double x, long ex);
2940b57cec5SDimitry Andric
2950b57cec5SDimitry Andricfloating_point scalbn (arithmetic x, int ex);
2960b57cec5SDimitry Andricfloat          scalbnf(float x, int ex);
2970b57cec5SDimitry Andriclong double    scalbnl(long double x, int ex);
2980b57cec5SDimitry Andric
2990b57cec5SDimitry Andricfloating_point tgamma (arithmetic x);
3000b57cec5SDimitry Andricfloat          tgammaf(float x);
3010b57cec5SDimitry Andriclong double    tgammal(long double x);
3020b57cec5SDimitry Andric
3030b57cec5SDimitry Andricfloating_point trunc (arithmetic x);
3040b57cec5SDimitry Andricfloat          truncf(float x);
3050b57cec5SDimitry Andriclong double    truncl(long double x);
3060b57cec5SDimitry Andric
3075ffd83dbSDimitry Andricconstexpr float       lerp(float a, float b, float t) noexcept;                   // C++20
3085ffd83dbSDimitry Andricconstexpr double      lerp(double a, double b, double t) noexcept;                // C++20
3095ffd83dbSDimitry Andricconstexpr long double lerp(long double a, long double b, long double t) noexcept; // C++20
3105ffd83dbSDimitry Andric
3110b57cec5SDimitry Andric}  // std
3120b57cec5SDimitry Andric
3130b57cec5SDimitry Andric*/
3140b57cec5SDimitry Andric
3150b57cec5SDimitry Andric#include <__config>
316*36b606aeSDimitry Andric#include <__math/hypot.h>
317bdd1243dSDimitry Andric#include <__type_traits/enable_if.h>
318bdd1243dSDimitry Andric#include <__type_traits/is_arithmetic.h>
319bdd1243dSDimitry Andric#include <__type_traits/is_constant_evaluated.h>
320bdd1243dSDimitry Andric#include <__type_traits/is_floating_point.h>
321bdd1243dSDimitry Andric#include <__type_traits/is_same.h>
32206c3fb27SDimitry Andric#include <__type_traits/promote.h>
323bdd1243dSDimitry Andric#include <__type_traits/remove_cv.h>
3245f757f3fSDimitry Andric#include <limits>
32504eeddc0SDimitry Andric#include <version>
3260b57cec5SDimitry Andric
3270fca6ea1SDimitry Andric#include <__math/special_functions.h>
328bdd1243dSDimitry Andric#include <math.h>
329bdd1243dSDimitry Andric
330bdd1243dSDimitry Andric#ifndef _LIBCPP_MATH_H
331bdd1243dSDimitry Andric#   error <cmath> tried including <math.h> but didn't find libc++'s <math.h> header. \
332bdd1243dSDimitry Andric          This usually means that your header search paths are not configured properly. \
333bdd1243dSDimitry Andric          The header search paths should contain the C++ Standard Library headers before \
334bdd1243dSDimitry Andric          any C Standard Library, and you are probably using compiler flags that make that \
335bdd1243dSDimitry Andric          not be the case.
336bdd1243dSDimitry Andric#endif
337bdd1243dSDimitry Andric
3380b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3390b57cec5SDimitry Andric#  pragma GCC system_header
3400b57cec5SDimitry Andric#endif
3410b57cec5SDimitry Andric
3420b57cec5SDimitry Andric_LIBCPP_PUSH_MACROS
3430b57cec5SDimitry Andric#include <__undef_macros>
3440b57cec5SDimitry Andric
3450b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
3460b57cec5SDimitry Andric
347fe6060f1SDimitry Andricusing ::signbit _LIBCPP_USING_IF_EXISTS;
348fe6060f1SDimitry Andricusing ::fpclassify _LIBCPP_USING_IF_EXISTS;
349fe6060f1SDimitry Andricusing ::isfinite _LIBCPP_USING_IF_EXISTS;
350fe6060f1SDimitry Andricusing ::isinf _LIBCPP_USING_IF_EXISTS;
351fe6060f1SDimitry Andricusing ::isnan _LIBCPP_USING_IF_EXISTS;
352fe6060f1SDimitry Andricusing ::isnormal _LIBCPP_USING_IF_EXISTS;
353fe6060f1SDimitry Andricusing ::isgreater _LIBCPP_USING_IF_EXISTS;
354fe6060f1SDimitry Andricusing ::isgreaterequal _LIBCPP_USING_IF_EXISTS;
355fe6060f1SDimitry Andricusing ::isless _LIBCPP_USING_IF_EXISTS;
356fe6060f1SDimitry Andricusing ::islessequal _LIBCPP_USING_IF_EXISTS;
357fe6060f1SDimitry Andricusing ::islessgreater _LIBCPP_USING_IF_EXISTS;
358fe6060f1SDimitry Andricusing ::isunordered _LIBCPP_USING_IF_EXISTS;
359fe6060f1SDimitry Andricusing ::isunordered _LIBCPP_USING_IF_EXISTS;
3600b57cec5SDimitry Andric
361fe6060f1SDimitry Andricusing ::float_t _LIBCPP_USING_IF_EXISTS;
362fe6060f1SDimitry Andricusing ::double_t _LIBCPP_USING_IF_EXISTS;
3630b57cec5SDimitry Andric
364fe6060f1SDimitry Andricusing ::abs _LIBCPP_USING_IF_EXISTS;
3650b57cec5SDimitry Andric
366fe6060f1SDimitry Andricusing ::acos _LIBCPP_USING_IF_EXISTS;
367fe6060f1SDimitry Andricusing ::acosf _LIBCPP_USING_IF_EXISTS;
368fe6060f1SDimitry Andricusing ::asin _LIBCPP_USING_IF_EXISTS;
369fe6060f1SDimitry Andricusing ::asinf _LIBCPP_USING_IF_EXISTS;
370fe6060f1SDimitry Andricusing ::atan _LIBCPP_USING_IF_EXISTS;
371fe6060f1SDimitry Andricusing ::atanf _LIBCPP_USING_IF_EXISTS;
372fe6060f1SDimitry Andricusing ::atan2 _LIBCPP_USING_IF_EXISTS;
373fe6060f1SDimitry Andricusing ::atan2f _LIBCPP_USING_IF_EXISTS;
374fe6060f1SDimitry Andricusing ::ceil _LIBCPP_USING_IF_EXISTS;
375fe6060f1SDimitry Andricusing ::ceilf _LIBCPP_USING_IF_EXISTS;
376fe6060f1SDimitry Andricusing ::cos _LIBCPP_USING_IF_EXISTS;
377fe6060f1SDimitry Andricusing ::cosf _LIBCPP_USING_IF_EXISTS;
378fe6060f1SDimitry Andricusing ::cosh _LIBCPP_USING_IF_EXISTS;
379fe6060f1SDimitry Andricusing ::coshf _LIBCPP_USING_IF_EXISTS;
3800b57cec5SDimitry Andric
381fe6060f1SDimitry Andricusing ::exp _LIBCPP_USING_IF_EXISTS;
382fe6060f1SDimitry Andricusing ::expf _LIBCPP_USING_IF_EXISTS;
3830b57cec5SDimitry Andric
384fe6060f1SDimitry Andricusing ::fabs _LIBCPP_USING_IF_EXISTS;
385fe6060f1SDimitry Andricusing ::fabsf _LIBCPP_USING_IF_EXISTS;
386fe6060f1SDimitry Andricusing ::floor _LIBCPP_USING_IF_EXISTS;
387fe6060f1SDimitry Andricusing ::floorf _LIBCPP_USING_IF_EXISTS;
3880b57cec5SDimitry Andric
389fe6060f1SDimitry Andricusing ::fmod _LIBCPP_USING_IF_EXISTS;
390fe6060f1SDimitry Andricusing ::fmodf _LIBCPP_USING_IF_EXISTS;
3910b57cec5SDimitry Andric
392fe6060f1SDimitry Andricusing ::frexp _LIBCPP_USING_IF_EXISTS;
393fe6060f1SDimitry Andricusing ::frexpf _LIBCPP_USING_IF_EXISTS;
394fe6060f1SDimitry Andricusing ::ldexp _LIBCPP_USING_IF_EXISTS;
395fe6060f1SDimitry Andricusing ::ldexpf _LIBCPP_USING_IF_EXISTS;
3960b57cec5SDimitry Andric
397fe6060f1SDimitry Andricusing ::log _LIBCPP_USING_IF_EXISTS;
398fe6060f1SDimitry Andricusing ::logf _LIBCPP_USING_IF_EXISTS;
3990b57cec5SDimitry Andric
400fe6060f1SDimitry Andricusing ::log10 _LIBCPP_USING_IF_EXISTS;
401fe6060f1SDimitry Andricusing ::log10f _LIBCPP_USING_IF_EXISTS;
402fe6060f1SDimitry Andricusing ::modf _LIBCPP_USING_IF_EXISTS;
403fe6060f1SDimitry Andricusing ::modff _LIBCPP_USING_IF_EXISTS;
4040b57cec5SDimitry Andric
405fe6060f1SDimitry Andricusing ::pow _LIBCPP_USING_IF_EXISTS;
406fe6060f1SDimitry Andricusing ::powf _LIBCPP_USING_IF_EXISTS;
4070b57cec5SDimitry Andric
408fe6060f1SDimitry Andricusing ::sin _LIBCPP_USING_IF_EXISTS;
409fe6060f1SDimitry Andricusing ::sinf _LIBCPP_USING_IF_EXISTS;
410fe6060f1SDimitry Andricusing ::sinh _LIBCPP_USING_IF_EXISTS;
411fe6060f1SDimitry Andricusing ::sinhf _LIBCPP_USING_IF_EXISTS;
4120b57cec5SDimitry Andric
413fe6060f1SDimitry Andricusing ::sqrt _LIBCPP_USING_IF_EXISTS;
414fe6060f1SDimitry Andricusing ::sqrtf _LIBCPP_USING_IF_EXISTS;
415fe6060f1SDimitry Andricusing ::tan _LIBCPP_USING_IF_EXISTS;
416fe6060f1SDimitry Andricusing ::tanf _LIBCPP_USING_IF_EXISTS;
4170b57cec5SDimitry Andric
418fe6060f1SDimitry Andricusing ::tanh _LIBCPP_USING_IF_EXISTS;
419fe6060f1SDimitry Andricusing ::tanhf _LIBCPP_USING_IF_EXISTS;
4200b57cec5SDimitry Andric
421fe6060f1SDimitry Andricusing ::acosh _LIBCPP_USING_IF_EXISTS;
422fe6060f1SDimitry Andricusing ::acoshf _LIBCPP_USING_IF_EXISTS;
423fe6060f1SDimitry Andricusing ::asinh _LIBCPP_USING_IF_EXISTS;
424fe6060f1SDimitry Andricusing ::asinhf _LIBCPP_USING_IF_EXISTS;
425fe6060f1SDimitry Andricusing ::atanh _LIBCPP_USING_IF_EXISTS;
426fe6060f1SDimitry Andricusing ::atanhf _LIBCPP_USING_IF_EXISTS;
427fe6060f1SDimitry Andricusing ::cbrt _LIBCPP_USING_IF_EXISTS;
428fe6060f1SDimitry Andricusing ::cbrtf _LIBCPP_USING_IF_EXISTS;
4290b57cec5SDimitry Andric
430fe6060f1SDimitry Andricusing ::copysign _LIBCPP_USING_IF_EXISTS;
431fe6060f1SDimitry Andricusing ::copysignf _LIBCPP_USING_IF_EXISTS;
4320b57cec5SDimitry Andric
433fe6060f1SDimitry Andricusing ::erf _LIBCPP_USING_IF_EXISTS;
434fe6060f1SDimitry Andricusing ::erff _LIBCPP_USING_IF_EXISTS;
435fe6060f1SDimitry Andricusing ::erfc _LIBCPP_USING_IF_EXISTS;
436fe6060f1SDimitry Andricusing ::erfcf _LIBCPP_USING_IF_EXISTS;
437fe6060f1SDimitry Andricusing ::exp2 _LIBCPP_USING_IF_EXISTS;
438fe6060f1SDimitry Andricusing ::exp2f _LIBCPP_USING_IF_EXISTS;
439fe6060f1SDimitry Andricusing ::expm1 _LIBCPP_USING_IF_EXISTS;
440fe6060f1SDimitry Andricusing ::expm1f _LIBCPP_USING_IF_EXISTS;
441fe6060f1SDimitry Andricusing ::fdim _LIBCPP_USING_IF_EXISTS;
442fe6060f1SDimitry Andricusing ::fdimf _LIBCPP_USING_IF_EXISTS;
443fe6060f1SDimitry Andricusing ::fmaf _LIBCPP_USING_IF_EXISTS;
444fe6060f1SDimitry Andricusing ::fma _LIBCPP_USING_IF_EXISTS;
445fe6060f1SDimitry Andricusing ::fmax _LIBCPP_USING_IF_EXISTS;
446fe6060f1SDimitry Andricusing ::fmaxf _LIBCPP_USING_IF_EXISTS;
447fe6060f1SDimitry Andricusing ::fmin _LIBCPP_USING_IF_EXISTS;
448fe6060f1SDimitry Andricusing ::fminf _LIBCPP_USING_IF_EXISTS;
449fe6060f1SDimitry Andricusing ::hypot _LIBCPP_USING_IF_EXISTS;
450fe6060f1SDimitry Andricusing ::hypotf _LIBCPP_USING_IF_EXISTS;
451fe6060f1SDimitry Andricusing ::ilogb _LIBCPP_USING_IF_EXISTS;
452fe6060f1SDimitry Andricusing ::ilogbf _LIBCPP_USING_IF_EXISTS;
453fe6060f1SDimitry Andricusing ::lgamma _LIBCPP_USING_IF_EXISTS;
454fe6060f1SDimitry Andricusing ::lgammaf _LIBCPP_USING_IF_EXISTS;
455fe6060f1SDimitry Andricusing ::llrint _LIBCPP_USING_IF_EXISTS;
456fe6060f1SDimitry Andricusing ::llrintf _LIBCPP_USING_IF_EXISTS;
457fe6060f1SDimitry Andricusing ::llround _LIBCPP_USING_IF_EXISTS;
458fe6060f1SDimitry Andricusing ::llroundf _LIBCPP_USING_IF_EXISTS;
459fe6060f1SDimitry Andricusing ::log1p _LIBCPP_USING_IF_EXISTS;
460fe6060f1SDimitry Andricusing ::log1pf _LIBCPP_USING_IF_EXISTS;
461fe6060f1SDimitry Andricusing ::log2 _LIBCPP_USING_IF_EXISTS;
462fe6060f1SDimitry Andricusing ::log2f _LIBCPP_USING_IF_EXISTS;
463fe6060f1SDimitry Andricusing ::logb _LIBCPP_USING_IF_EXISTS;
464fe6060f1SDimitry Andricusing ::logbf _LIBCPP_USING_IF_EXISTS;
465fe6060f1SDimitry Andricusing ::lrint _LIBCPP_USING_IF_EXISTS;
466fe6060f1SDimitry Andricusing ::lrintf _LIBCPP_USING_IF_EXISTS;
467fe6060f1SDimitry Andricusing ::lround _LIBCPP_USING_IF_EXISTS;
468fe6060f1SDimitry Andricusing ::lroundf _LIBCPP_USING_IF_EXISTS;
4690b57cec5SDimitry Andric
470fe6060f1SDimitry Andricusing ::nan _LIBCPP_USING_IF_EXISTS;
471fe6060f1SDimitry Andricusing ::nanf _LIBCPP_USING_IF_EXISTS;
4720b57cec5SDimitry Andric
473fe6060f1SDimitry Andricusing ::nearbyint _LIBCPP_USING_IF_EXISTS;
474fe6060f1SDimitry Andricusing ::nearbyintf _LIBCPP_USING_IF_EXISTS;
475fe6060f1SDimitry Andricusing ::nextafter _LIBCPP_USING_IF_EXISTS;
476fe6060f1SDimitry Andricusing ::nextafterf _LIBCPP_USING_IF_EXISTS;
477fe6060f1SDimitry Andricusing ::nexttoward _LIBCPP_USING_IF_EXISTS;
478fe6060f1SDimitry Andricusing ::nexttowardf _LIBCPP_USING_IF_EXISTS;
479fe6060f1SDimitry Andricusing ::remainder _LIBCPP_USING_IF_EXISTS;
480fe6060f1SDimitry Andricusing ::remainderf _LIBCPP_USING_IF_EXISTS;
481fe6060f1SDimitry Andricusing ::remquo _LIBCPP_USING_IF_EXISTS;
482fe6060f1SDimitry Andricusing ::remquof _LIBCPP_USING_IF_EXISTS;
483fe6060f1SDimitry Andricusing ::rint _LIBCPP_USING_IF_EXISTS;
484fe6060f1SDimitry Andricusing ::rintf _LIBCPP_USING_IF_EXISTS;
485fe6060f1SDimitry Andricusing ::round _LIBCPP_USING_IF_EXISTS;
486fe6060f1SDimitry Andricusing ::roundf _LIBCPP_USING_IF_EXISTS;
487fe6060f1SDimitry Andricusing ::scalbln _LIBCPP_USING_IF_EXISTS;
488fe6060f1SDimitry Andricusing ::scalblnf _LIBCPP_USING_IF_EXISTS;
489fe6060f1SDimitry Andricusing ::scalbn _LIBCPP_USING_IF_EXISTS;
490fe6060f1SDimitry Andricusing ::scalbnf _LIBCPP_USING_IF_EXISTS;
491fe6060f1SDimitry Andricusing ::tgamma _LIBCPP_USING_IF_EXISTS;
492fe6060f1SDimitry Andricusing ::tgammaf _LIBCPP_USING_IF_EXISTS;
493fe6060f1SDimitry Andricusing ::trunc _LIBCPP_USING_IF_EXISTS;
494fe6060f1SDimitry Andricusing ::truncf _LIBCPP_USING_IF_EXISTS;
4950b57cec5SDimitry Andric
496fe6060f1SDimitry Andricusing ::acosl _LIBCPP_USING_IF_EXISTS;
497fe6060f1SDimitry Andricusing ::asinl _LIBCPP_USING_IF_EXISTS;
498fe6060f1SDimitry Andricusing ::atanl _LIBCPP_USING_IF_EXISTS;
499fe6060f1SDimitry Andricusing ::atan2l _LIBCPP_USING_IF_EXISTS;
500fe6060f1SDimitry Andricusing ::ceill _LIBCPP_USING_IF_EXISTS;
501fe6060f1SDimitry Andricusing ::cosl _LIBCPP_USING_IF_EXISTS;
502fe6060f1SDimitry Andricusing ::coshl _LIBCPP_USING_IF_EXISTS;
503fe6060f1SDimitry Andricusing ::expl _LIBCPP_USING_IF_EXISTS;
504fe6060f1SDimitry Andricusing ::fabsl _LIBCPP_USING_IF_EXISTS;
505fe6060f1SDimitry Andricusing ::floorl _LIBCPP_USING_IF_EXISTS;
506fe6060f1SDimitry Andricusing ::fmodl _LIBCPP_USING_IF_EXISTS;
507fe6060f1SDimitry Andricusing ::frexpl _LIBCPP_USING_IF_EXISTS;
508fe6060f1SDimitry Andricusing ::ldexpl _LIBCPP_USING_IF_EXISTS;
509fe6060f1SDimitry Andricusing ::logl _LIBCPP_USING_IF_EXISTS;
510fe6060f1SDimitry Andricusing ::log10l _LIBCPP_USING_IF_EXISTS;
511fe6060f1SDimitry Andricusing ::modfl _LIBCPP_USING_IF_EXISTS;
512fe6060f1SDimitry Andricusing ::powl _LIBCPP_USING_IF_EXISTS;
513fe6060f1SDimitry Andricusing ::sinl _LIBCPP_USING_IF_EXISTS;
514fe6060f1SDimitry Andricusing ::sinhl _LIBCPP_USING_IF_EXISTS;
515fe6060f1SDimitry Andricusing ::sqrtl _LIBCPP_USING_IF_EXISTS;
516fe6060f1SDimitry Andricusing ::tanl _LIBCPP_USING_IF_EXISTS;
5170b57cec5SDimitry Andric
518fe6060f1SDimitry Andricusing ::tanhl _LIBCPP_USING_IF_EXISTS;
519fe6060f1SDimitry Andricusing ::acoshl _LIBCPP_USING_IF_EXISTS;
520fe6060f1SDimitry Andricusing ::asinhl _LIBCPP_USING_IF_EXISTS;
521fe6060f1SDimitry Andricusing ::atanhl _LIBCPP_USING_IF_EXISTS;
522fe6060f1SDimitry Andricusing ::cbrtl _LIBCPP_USING_IF_EXISTS;
5230b57cec5SDimitry Andric
524fe6060f1SDimitry Andricusing ::copysignl _LIBCPP_USING_IF_EXISTS;
5250b57cec5SDimitry Andric
526fe6060f1SDimitry Andricusing ::erfl _LIBCPP_USING_IF_EXISTS;
527fe6060f1SDimitry Andricusing ::erfcl _LIBCPP_USING_IF_EXISTS;
528fe6060f1SDimitry Andricusing ::exp2l _LIBCPP_USING_IF_EXISTS;
529fe6060f1SDimitry Andricusing ::expm1l _LIBCPP_USING_IF_EXISTS;
530fe6060f1SDimitry Andricusing ::fdiml _LIBCPP_USING_IF_EXISTS;
531fe6060f1SDimitry Andricusing ::fmal _LIBCPP_USING_IF_EXISTS;
532fe6060f1SDimitry Andricusing ::fmaxl _LIBCPP_USING_IF_EXISTS;
533fe6060f1SDimitry Andricusing ::fminl _LIBCPP_USING_IF_EXISTS;
534fe6060f1SDimitry Andricusing ::hypotl _LIBCPP_USING_IF_EXISTS;
535fe6060f1SDimitry Andricusing ::ilogbl _LIBCPP_USING_IF_EXISTS;
536fe6060f1SDimitry Andricusing ::lgammal _LIBCPP_USING_IF_EXISTS;
537fe6060f1SDimitry Andricusing ::llrintl _LIBCPP_USING_IF_EXISTS;
538fe6060f1SDimitry Andricusing ::llroundl _LIBCPP_USING_IF_EXISTS;
539fe6060f1SDimitry Andricusing ::log1pl _LIBCPP_USING_IF_EXISTS;
540fe6060f1SDimitry Andricusing ::log2l _LIBCPP_USING_IF_EXISTS;
541fe6060f1SDimitry Andricusing ::logbl _LIBCPP_USING_IF_EXISTS;
542fe6060f1SDimitry Andricusing ::lrintl _LIBCPP_USING_IF_EXISTS;
543fe6060f1SDimitry Andricusing ::lroundl _LIBCPP_USING_IF_EXISTS;
544fe6060f1SDimitry Andricusing ::nanl _LIBCPP_USING_IF_EXISTS;
545fe6060f1SDimitry Andricusing ::nearbyintl _LIBCPP_USING_IF_EXISTS;
546fe6060f1SDimitry Andricusing ::nextafterl _LIBCPP_USING_IF_EXISTS;
547fe6060f1SDimitry Andricusing ::nexttowardl _LIBCPP_USING_IF_EXISTS;
548fe6060f1SDimitry Andricusing ::remainderl _LIBCPP_USING_IF_EXISTS;
549fe6060f1SDimitry Andricusing ::remquol _LIBCPP_USING_IF_EXISTS;
550fe6060f1SDimitry Andricusing ::rintl _LIBCPP_USING_IF_EXISTS;
551fe6060f1SDimitry Andricusing ::roundl _LIBCPP_USING_IF_EXISTS;
552fe6060f1SDimitry Andricusing ::scalblnl _LIBCPP_USING_IF_EXISTS;
553fe6060f1SDimitry Andricusing ::scalbnl _LIBCPP_USING_IF_EXISTS;
554fe6060f1SDimitry Andricusing ::tgammal _LIBCPP_USING_IF_EXISTS;
555fe6060f1SDimitry Andricusing ::truncl _LIBCPP_USING_IF_EXISTS;
5560b57cec5SDimitry Andric
5575f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
558cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
5590b57cec5SDimitry Andric#if __has_builtin(__builtin_isnan)
5600b57cec5SDimitry Andric  return __builtin_isnan(__lcpp_x);
5610b57cec5SDimitry Andric#else
5620b57cec5SDimitry Andric  return isnan(__lcpp_x);
5630b57cec5SDimitry Andric#endif
5640b57cec5SDimitry Andric}
5650b57cec5SDimitry Andric
5665f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
567cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
568bdd1243dSDimitry Andric  return std::isnan(__lcpp_x);
5690b57cec5SDimitry Andric}
5700b57cec5SDimitry Andric
5715f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
572cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
5730b57cec5SDimitry Andric#if __has_builtin(__builtin_isinf)
5740b57cec5SDimitry Andric  return __builtin_isinf(__lcpp_x);
5750b57cec5SDimitry Andric#else
5760b57cec5SDimitry Andric  return isinf(__lcpp_x);
5770b57cec5SDimitry Andric#endif
5780b57cec5SDimitry Andric}
5790b57cec5SDimitry Andric
5805f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
581cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
582bdd1243dSDimitry Andric  return std::isinf(__lcpp_x);
5830b57cec5SDimitry Andric}
5840b57cec5SDimitry Andric
5855f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
586cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
5870b57cec5SDimitry Andric#if __has_builtin(__builtin_isfinite)
5880b57cec5SDimitry Andric  return __builtin_isfinite(__lcpp_x);
5890b57cec5SDimitry Andric#else
5900b57cec5SDimitry Andric  return isfinite(__lcpp_x);
5910b57cec5SDimitry Andric#endif
5920b57cec5SDimitry Andric}
5930b57cec5SDimitry Andric
5945f757f3fSDimitry Andrictemplate <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
595cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
596bdd1243dSDimitry Andric  return __builtin_isfinite(__lcpp_x);
597bdd1243dSDimitry Andric}
598bdd1243dSDimitry Andric
59906c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 20
6000b57cec5SDimitry Andrictemplate <typename _Fp>
601cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
6020b57cec5SDimitry Andric  if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
6030b57cec5SDimitry Andric    return __t * __b + (1 - __t) * __a;
6040b57cec5SDimitry Andric
605cb14a3feSDimitry Andric  if (__t == 1)
606cb14a3feSDimitry Andric    return __b;
6070b57cec5SDimitry Andric  const _Fp __x = __a + __t * (__b - __a);
608fe6060f1SDimitry Andric  if ((__t > 1) == (__b > __a))
6090b57cec5SDimitry Andric    return __b < __x ? __x : __b;
6100b57cec5SDimitry Andric  else
6110b57cec5SDimitry Andric    return __x < __b ? __x : __b;
6120b57cec5SDimitry Andric}
6130b57cec5SDimitry Andric
614cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI inline constexpr float lerp(float __a, float __b, float __t) _NOEXCEPT {
615cb14a3feSDimitry Andric  return __lerp(__a, __b, __t);
616cb14a3feSDimitry Andric}
6170b57cec5SDimitry Andric
618cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI inline constexpr double lerp(double __a, double __b, double __t) _NOEXCEPT {
619cb14a3feSDimitry Andric  return __lerp(__a, __b, __t);
620cb14a3feSDimitry Andric}
6210b57cec5SDimitry Andric
622cb14a3feSDimitry Andric_LIBCPP_HIDE_FROM_ABI inline constexpr long double lerp(long double __a, long double __b, long double __t) _NOEXCEPT {
623cb14a3feSDimitry Andric  return __lerp(__a, __b, __t);
624cb14a3feSDimitry Andric}
6250b57cec5SDimitry Andric
62604eeddc0SDimitry Andrictemplate <class _A1, class _A2, class _A3>
627cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI constexpr
628cb14a3feSDimitry Andric    typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
629cb14a3feSDimitry Andric                          __promote<_A1, _A2, _A3> >::type
630cb14a3feSDimitry Andric    lerp(_A1 __a, _A2 __b, _A3 __t) noexcept {
63104eeddc0SDimitry Andric  typedef typename __promote<_A1, _A2, _A3>::type __result_type;
632cb14a3feSDimitry Andric  static_assert(!(
633cb14a3feSDimitry Andric      _IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value));
634bdd1243dSDimitry Andric  return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
63504eeddc0SDimitry Andric}
63606c3fb27SDimitry Andric#endif // _LIBCPP_STD_VER >= 20
6370b57cec5SDimitry Andric
6380b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD
6390b57cec5SDimitry Andric
6400b57cec5SDimitry Andric_LIBCPP_POP_MACROS
6410b57cec5SDimitry Andric
642bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
643bdd1243dSDimitry Andric#  include <type_traits>
644bdd1243dSDimitry Andric#endif
645bdd1243dSDimitry Andric
6460b57cec5SDimitry Andric#endif // _LIBCPP_CMATH
647