xref: /llvm-project-15.0.7/libcxx/include/cmath (revision b48c5010)
13e519524SHoward Hinnant// -*- C++ -*-
2eb8650a7SLouis Dionne//===----------------------------------------------------------------------===//
33e519524SHoward Hinnant//
457b08b09SChandler Carruth// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
557b08b09SChandler Carruth// See https://llvm.org/LICENSE.txt for license information.
657b08b09SChandler Carruth// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
73e519524SHoward Hinnant//
83e519524SHoward Hinnant//===----------------------------------------------------------------------===//
93e519524SHoward Hinnant
103e519524SHoward Hinnant#ifndef _LIBCPP_CMATH
113e519524SHoward Hinnant#define _LIBCPP_CMATH
123e519524SHoward Hinnant
133e519524SHoward Hinnant/*
143e519524SHoward Hinnant    cmath synopsis
153e519524SHoward Hinnant
163e519524SHoward HinnantMacros:
173e519524SHoward Hinnant
183e519524SHoward Hinnant    HUGE_VAL
193e519524SHoward Hinnant    HUGE_VALF               // C99
203e519524SHoward Hinnant    HUGE_VALL               // C99
213e519524SHoward Hinnant    INFINITY                // C99
223e519524SHoward Hinnant    NAN                     // C99
233e519524SHoward Hinnant    FP_INFINITE             // C99
243e519524SHoward Hinnant    FP_NAN                  // C99
253e519524SHoward Hinnant    FP_NORMAL               // C99
263e519524SHoward Hinnant    FP_SUBNORMAL            // C99
273e519524SHoward Hinnant    FP_ZERO                 // C99
283e519524SHoward Hinnant    FP_FAST_FMA             // C99
293e519524SHoward Hinnant    FP_FAST_FMAF            // C99
303e519524SHoward Hinnant    FP_FAST_FMAL            // C99
313e519524SHoward Hinnant    FP_ILOGB0               // C99
323e519524SHoward Hinnant    FP_ILOGBNAN             // C99
333e519524SHoward Hinnant    MATH_ERRNO              // C99
343e519524SHoward Hinnant    MATH_ERREXCEPT          // C99
353e519524SHoward Hinnant    math_errhandling        // C99
363e519524SHoward Hinnant
373e519524SHoward Hinnantnamespace std
383e519524SHoward Hinnant{
393e519524SHoward Hinnant
403e519524SHoward HinnantTypes:
413e519524SHoward Hinnant
423e519524SHoward Hinnant    float_t                 // C99
433e519524SHoward Hinnant    double_t                // C99
443e519524SHoward Hinnant
453e519524SHoward Hinnant// C90
463e519524SHoward Hinnant
473e519524SHoward Hinnantfloating_point abs(floating_point x);
483e519524SHoward Hinnant
493e519524SHoward Hinnantfloating_point acos (arithmetic x);
503e519524SHoward Hinnantfloat          acosf(float x);
513e519524SHoward Hinnantlong double    acosl(long double x);
523e519524SHoward Hinnant
533e519524SHoward Hinnantfloating_point asin (arithmetic x);
543e519524SHoward Hinnantfloat          asinf(float x);
553e519524SHoward Hinnantlong double    asinl(long double x);
563e519524SHoward Hinnant
573e519524SHoward Hinnantfloating_point atan (arithmetic x);
583e519524SHoward Hinnantfloat          atanf(float x);
593e519524SHoward Hinnantlong double    atanl(long double x);
603e519524SHoward Hinnant
613e519524SHoward Hinnantfloating_point atan2 (arithmetic y, arithmetic x);
623e519524SHoward Hinnantfloat          atan2f(float y, float x);
633e519524SHoward Hinnantlong double    atan2l(long double y, long double x);
643e519524SHoward Hinnant
653e519524SHoward Hinnantfloating_point ceil (arithmetic x);
663e519524SHoward Hinnantfloat          ceilf(float x);
673e519524SHoward Hinnantlong double    ceill(long double x);
683e519524SHoward Hinnant
693e519524SHoward Hinnantfloating_point cos (arithmetic x);
703e519524SHoward Hinnantfloat          cosf(float x);
713e519524SHoward Hinnantlong double    cosl(long double x);
723e519524SHoward Hinnant
733e519524SHoward Hinnantfloating_point cosh (arithmetic x);
743e519524SHoward Hinnantfloat          coshf(float x);
753e519524SHoward Hinnantlong double    coshl(long double x);
763e519524SHoward Hinnant
773e519524SHoward Hinnantfloating_point exp (arithmetic x);
783e519524SHoward Hinnantfloat          expf(float x);
793e519524SHoward Hinnantlong double    expl(long double x);
803e519524SHoward Hinnant
813e519524SHoward Hinnantfloating_point fabs (arithmetic x);
823e519524SHoward Hinnantfloat          fabsf(float x);
833e519524SHoward Hinnantlong double    fabsl(long double x);
843e519524SHoward Hinnant
853e519524SHoward Hinnantfloating_point floor (arithmetic x);
863e519524SHoward Hinnantfloat          floorf(float x);
873e519524SHoward Hinnantlong double    floorl(long double x);
883e519524SHoward Hinnant
893e519524SHoward Hinnantfloating_point fmod (arithmetic x, arithmetic y);
903e519524SHoward Hinnantfloat          fmodf(float x, float y);
913e519524SHoward Hinnantlong double    fmodl(long double x, long double y);
923e519524SHoward Hinnant
933e519524SHoward Hinnantfloating_point frexp (arithmetic value, int* exp);
943e519524SHoward Hinnantfloat          frexpf(float value, int* exp);
953e519524SHoward Hinnantlong double    frexpl(long double value, int* exp);
963e519524SHoward Hinnant
973e519524SHoward Hinnantfloating_point ldexp (arithmetic value, int exp);
983e519524SHoward Hinnantfloat          ldexpf(float value, int exp);
993e519524SHoward Hinnantlong double    ldexpl(long double value, int exp);
1003e519524SHoward Hinnant
1013e519524SHoward Hinnantfloating_point log (arithmetic x);
1023e519524SHoward Hinnantfloat          logf(float x);
1033e519524SHoward Hinnantlong double    logl(long double x);
1043e519524SHoward Hinnant
1053e519524SHoward Hinnantfloating_point log10 (arithmetic x);
1063e519524SHoward Hinnantfloat          log10f(float x);
1073e519524SHoward Hinnantlong double    log10l(long double x);
1083e519524SHoward Hinnant
1093e519524SHoward Hinnantfloating_point modf (floating_point value, floating_point* iptr);
1103e519524SHoward Hinnantfloat          modff(float value, float* iptr);
1113e519524SHoward Hinnantlong double    modfl(long double value, long double* iptr);
1123e519524SHoward Hinnant
1133e519524SHoward Hinnantfloating_point pow (arithmetic x, arithmetic y);
1143e519524SHoward Hinnantfloat          powf(float x, float y);
1153e519524SHoward Hinnantlong double    powl(long double x, long double y);
1163e519524SHoward Hinnant
1173e519524SHoward Hinnantfloating_point sin (arithmetic x);
1183e519524SHoward Hinnantfloat          sinf(float x);
1193e519524SHoward Hinnantlong double    sinl(long double x);
1203e519524SHoward Hinnant
1213e519524SHoward Hinnantfloating_point sinh (arithmetic x);
1223e519524SHoward Hinnantfloat          sinhf(float x);
1233e519524SHoward Hinnantlong double    sinhl(long double x);
1243e519524SHoward Hinnant
1253e519524SHoward Hinnantfloating_point sqrt (arithmetic x);
1263e519524SHoward Hinnantfloat          sqrtf(float x);
1273e519524SHoward Hinnantlong double    sqrtl(long double x);
1283e519524SHoward Hinnant
1293e519524SHoward Hinnantfloating_point tan (arithmetic x);
1303e519524SHoward Hinnantfloat          tanf(float x);
1313e519524SHoward Hinnantlong double    tanl(long double x);
1323e519524SHoward Hinnant
1333e519524SHoward Hinnantfloating_point tanh (arithmetic x);
1343e519524SHoward Hinnantfloat          tanhf(float x);
1353e519524SHoward Hinnantlong double    tanhl(long double x);
1363e519524SHoward Hinnant
1373e519524SHoward Hinnant//  C99
1383e519524SHoward Hinnant
139980e7e74SHoward Hinnantbool signbit(arithmetic x);
1403e519524SHoward Hinnant
141980e7e74SHoward Hinnantint fpclassify(arithmetic x);
1423e519524SHoward Hinnant
143980e7e74SHoward Hinnantbool isfinite(arithmetic x);
144980e7e74SHoward Hinnantbool isinf(arithmetic x);
145980e7e74SHoward Hinnantbool isnan(arithmetic x);
146980e7e74SHoward Hinnantbool isnormal(arithmetic x);
1473e519524SHoward Hinnant
148980e7e74SHoward Hinnantbool isgreater(arithmetic x, arithmetic y);
149980e7e74SHoward Hinnantbool isgreaterequal(arithmetic x, arithmetic y);
150980e7e74SHoward Hinnantbool isless(arithmetic x, arithmetic y);
151980e7e74SHoward Hinnantbool islessequal(arithmetic x, arithmetic y);
152980e7e74SHoward Hinnantbool islessgreater(arithmetic x, arithmetic y);
153980e7e74SHoward Hinnantbool isunordered(arithmetic x, arithmetic y);
1543e519524SHoward Hinnant
1553e519524SHoward Hinnantfloating_point acosh (arithmetic x);
1563e519524SHoward Hinnantfloat          acoshf(float x);
1573e519524SHoward Hinnantlong double    acoshl(long double x);
1583e519524SHoward Hinnant
1593e519524SHoward Hinnantfloating_point asinh (arithmetic x);
1603e519524SHoward Hinnantfloat          asinhf(float x);
1613e519524SHoward Hinnantlong double    asinhl(long double x);
1623e519524SHoward Hinnant
1633e519524SHoward Hinnantfloating_point atanh (arithmetic x);
1643e519524SHoward Hinnantfloat          atanhf(float x);
1653e519524SHoward Hinnantlong double    atanhl(long double x);
1663e519524SHoward Hinnant
1673e519524SHoward Hinnantfloating_point cbrt (arithmetic x);
1683e519524SHoward Hinnantfloat          cbrtf(float x);
1693e519524SHoward Hinnantlong double    cbrtl(long double x);
1703e519524SHoward Hinnant
1713e519524SHoward Hinnantfloating_point copysign (arithmetic x, arithmetic y);
1723e519524SHoward Hinnantfloat          copysignf(float x, float y);
1733e519524SHoward Hinnantlong double    copysignl(long double x, long double y);
1743e519524SHoward Hinnant
1753e519524SHoward Hinnantfloating_point erf (arithmetic x);
1763e519524SHoward Hinnantfloat          erff(float x);
1773e519524SHoward Hinnantlong double    erfl(long double x);
1783e519524SHoward Hinnant
1793e519524SHoward Hinnantfloating_point erfc (arithmetic x);
1803e519524SHoward Hinnantfloat          erfcf(float x);
1813e519524SHoward Hinnantlong double    erfcl(long double x);
1823e519524SHoward Hinnant
1833e519524SHoward Hinnantfloating_point exp2 (arithmetic x);
1843e519524SHoward Hinnantfloat          exp2f(float x);
1853e519524SHoward Hinnantlong double    exp2l(long double x);
1863e519524SHoward Hinnant
1873e519524SHoward Hinnantfloating_point expm1 (arithmetic x);
1883e519524SHoward Hinnantfloat          expm1f(float x);
1893e519524SHoward Hinnantlong double    expm1l(long double x);
1903e519524SHoward Hinnant
1913e519524SHoward Hinnantfloating_point fdim (arithmetic x, arithmetic y);
1923e519524SHoward Hinnantfloat          fdimf(float x, float y);
1933e519524SHoward Hinnantlong double    fdiml(long double x, long double y);
1943e519524SHoward Hinnant
1953e519524SHoward Hinnantfloating_point fma (arithmetic x, arithmetic y, arithmetic z);
1963e519524SHoward Hinnantfloat          fmaf(float x, float y, float z);
1973e519524SHoward Hinnantlong double    fmal(long double x, long double y, long double z);
1983e519524SHoward Hinnant
1993e519524SHoward Hinnantfloating_point fmax (arithmetic x, arithmetic y);
2003e519524SHoward Hinnantfloat          fmaxf(float x, float y);
2013e519524SHoward Hinnantlong double    fmaxl(long double x, long double y);
2023e519524SHoward Hinnant
2033e519524SHoward Hinnantfloating_point fmin (arithmetic x, arithmetic y);
2043e519524SHoward Hinnantfloat          fminf(float x, float y);
2053e519524SHoward Hinnantlong double    fminl(long double x, long double y);
2063e519524SHoward Hinnant
2073e519524SHoward Hinnantfloating_point hypot (arithmetic x, arithmetic y);
2083e519524SHoward Hinnantfloat          hypotf(float x, float y);
2093e519524SHoward Hinnantlong double    hypotl(long double x, long double y);
2103e519524SHoward Hinnant
2114328c2baSMarshall Clowdouble       hypot(double x, double y, double z);                // C++17
2124328c2baSMarshall Clowfloat        hypot(float x, float y, float z);                   // C++17
2134328c2baSMarshall Clowlong double  hypot(long double x, long double y, long double z); // C++17
2144328c2baSMarshall Clow
2153e519524SHoward Hinnantint ilogb (arithmetic x);
2163e519524SHoward Hinnantint ilogbf(float x);
2173e519524SHoward Hinnantint ilogbl(long double x);
2183e519524SHoward Hinnant
2193e519524SHoward Hinnantfloating_point lgamma (arithmetic x);
2203e519524SHoward Hinnantfloat          lgammaf(float x);
2213e519524SHoward Hinnantlong double    lgammal(long double x);
2223e519524SHoward Hinnant
2233e519524SHoward Hinnantlong long llrint (arithmetic x);
2243e519524SHoward Hinnantlong long llrintf(float x);
2253e519524SHoward Hinnantlong long llrintl(long double x);
2263e519524SHoward Hinnant
2273e519524SHoward Hinnantlong long llround (arithmetic x);
2283e519524SHoward Hinnantlong long llroundf(float x);
2293e519524SHoward Hinnantlong long llroundl(long double x);
2303e519524SHoward Hinnant
2313e519524SHoward Hinnantfloating_point log1p (arithmetic x);
2323e519524SHoward Hinnantfloat          log1pf(float x);
2333e519524SHoward Hinnantlong double    log1pl(long double x);
2343e519524SHoward Hinnant
2353e519524SHoward Hinnantfloating_point log2 (arithmetic x);
2363e519524SHoward Hinnantfloat          log2f(float x);
2373e519524SHoward Hinnantlong double    log2l(long double x);
2383e519524SHoward Hinnant
2393e519524SHoward Hinnantfloating_point logb (arithmetic x);
2403e519524SHoward Hinnantfloat          logbf(float x);
2413e519524SHoward Hinnantlong double    logbl(long double x);
2423e519524SHoward Hinnant
2433e519524SHoward Hinnantlong lrint (arithmetic x);
2443e519524SHoward Hinnantlong lrintf(float x);
2453e519524SHoward Hinnantlong lrintl(long double x);
2463e519524SHoward Hinnant
2473e519524SHoward Hinnantlong lround (arithmetic x);
2483e519524SHoward Hinnantlong lroundf(float x);
2493e519524SHoward Hinnantlong lroundl(long double x);
2503e519524SHoward Hinnant
2513e519524SHoward Hinnantdouble      nan (const char* str);
2523e519524SHoward Hinnantfloat       nanf(const char* str);
2533e519524SHoward Hinnantlong double nanl(const char* str);
2543e519524SHoward Hinnant
2553e519524SHoward Hinnantfloating_point nearbyint (arithmetic x);
2563e519524SHoward Hinnantfloat          nearbyintf(float x);
2573e519524SHoward Hinnantlong double    nearbyintl(long double x);
2583e519524SHoward Hinnant
2593e519524SHoward Hinnantfloating_point nextafter (arithmetic x, arithmetic y);
2603e519524SHoward Hinnantfloat          nextafterf(float x, float y);
2613e519524SHoward Hinnantlong double    nextafterl(long double x, long double y);
2623e519524SHoward Hinnant
2633e519524SHoward Hinnantfloating_point nexttoward (arithmetic x, long double y);
2643e519524SHoward Hinnantfloat          nexttowardf(float x, long double y);
2653e519524SHoward Hinnantlong double    nexttowardl(long double x, long double y);
2663e519524SHoward Hinnant
2673e519524SHoward Hinnantfloating_point remainder (arithmetic x, arithmetic y);
2683e519524SHoward Hinnantfloat          remainderf(float x, float y);
2693e519524SHoward Hinnantlong double    remainderl(long double x, long double y);
2703e519524SHoward Hinnant
2713e519524SHoward Hinnantfloating_point remquo (arithmetic x, arithmetic y, int* pquo);
2723e519524SHoward Hinnantfloat          remquof(float x, float y, int* pquo);
2733e519524SHoward Hinnantlong double    remquol(long double x, long double y, int* pquo);
2743e519524SHoward Hinnant
2753e519524SHoward Hinnantfloating_point rint (arithmetic x);
2763e519524SHoward Hinnantfloat          rintf(float x);
2773e519524SHoward Hinnantlong double    rintl(long double x);
2783e519524SHoward Hinnant
2793e519524SHoward Hinnantfloating_point round (arithmetic x);
2803e519524SHoward Hinnantfloat          roundf(float x);
2813e519524SHoward Hinnantlong double    roundl(long double x);
2823e519524SHoward Hinnant
2833e519524SHoward Hinnantfloating_point scalbln (arithmetic x, long ex);
2843e519524SHoward Hinnantfloat          scalblnf(float x, long ex);
2853e519524SHoward Hinnantlong double    scalblnl(long double x, long ex);
2863e519524SHoward Hinnant
2873e519524SHoward Hinnantfloating_point scalbn (arithmetic x, int ex);
2883e519524SHoward Hinnantfloat          scalbnf(float x, int ex);
2893e519524SHoward Hinnantlong double    scalbnl(long double x, int ex);
2903e519524SHoward Hinnant
2913e519524SHoward Hinnantfloating_point tgamma (arithmetic x);
2923e519524SHoward Hinnantfloat          tgammaf(float x);
2933e519524SHoward Hinnantlong double    tgammal(long double x);
2943e519524SHoward Hinnant
2953e519524SHoward Hinnantfloating_point trunc (arithmetic x);
2963e519524SHoward Hinnantfloat          truncf(float x);
2973e519524SHoward Hinnantlong double    truncl(long double x);
2983e519524SHoward Hinnant
299d1dbda10SMarek Kurdejconstexpr float       lerp(float a, float b, float t) noexcept;                   // C++20
300d1dbda10SMarek Kurdejconstexpr double      lerp(double a, double b, double t) noexcept;                // C++20
301d1dbda10SMarek Kurdejconstexpr long double lerp(long double a, long double b, long double t) noexcept; // C++20
302d1dbda10SMarek Kurdej
3033e519524SHoward Hinnant}  // std
3043e519524SHoward Hinnant
3053e519524SHoward Hinnant*/
3063e519524SHoward Hinnant
307385cc25aSLouis Dionne#include <__assert> // all public C++ headers provide the assertion handler
3083e519524SHoward Hinnant#include <__config>
3093e519524SHoward Hinnant#include <math.h>
310b92dededSLouis Dionne#include <type_traits>
3114d81a46fSArthur O'Dwyer#include <version>
3129563a09cSHoward Hinnant
313073458b1SHoward Hinnant#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3143e519524SHoward Hinnant#  pragma GCC system_header
315073458b1SHoward Hinnant#endif
3163e519524SHoward Hinnant
317b92dededSLouis Dionne_LIBCPP_PUSH_MACROS
318b92dededSLouis Dionne#include <__undef_macros>
319b92dededSLouis Dionne
3203e519524SHoward Hinnant_LIBCPP_BEGIN_NAMESPACE_STD
3213e519524SHoward Hinnant
322a9c9183cSLouis Dionneusing ::signbit _LIBCPP_USING_IF_EXISTS;
323a9c9183cSLouis Dionneusing ::fpclassify _LIBCPP_USING_IF_EXISTS;
324a9c9183cSLouis Dionneusing ::isfinite _LIBCPP_USING_IF_EXISTS;
325a9c9183cSLouis Dionneusing ::isinf _LIBCPP_USING_IF_EXISTS;
326a9c9183cSLouis Dionneusing ::isnan _LIBCPP_USING_IF_EXISTS;
327a9c9183cSLouis Dionneusing ::isnormal _LIBCPP_USING_IF_EXISTS;
328a9c9183cSLouis Dionneusing ::isgreater _LIBCPP_USING_IF_EXISTS;
329a9c9183cSLouis Dionneusing ::isgreaterequal _LIBCPP_USING_IF_EXISTS;
330a9c9183cSLouis Dionneusing ::isless _LIBCPP_USING_IF_EXISTS;
331a9c9183cSLouis Dionneusing ::islessequal _LIBCPP_USING_IF_EXISTS;
332a9c9183cSLouis Dionneusing ::islessgreater _LIBCPP_USING_IF_EXISTS;
333a9c9183cSLouis Dionneusing ::isunordered _LIBCPP_USING_IF_EXISTS;
334a9c9183cSLouis Dionneusing ::isunordered _LIBCPP_USING_IF_EXISTS;
335fb7f07e3SHoward Hinnant
336a9c9183cSLouis Dionneusing ::float_t _LIBCPP_USING_IF_EXISTS;
337a9c9183cSLouis Dionneusing ::double_t _LIBCPP_USING_IF_EXISTS;
3383e519524SHoward Hinnant
339a9c9183cSLouis Dionneusing ::abs _LIBCPP_USING_IF_EXISTS;
340b2c276e4SEric Fiselier
341a9c9183cSLouis Dionneusing ::acos _LIBCPP_USING_IF_EXISTS;
342a9c9183cSLouis Dionneusing ::acosf _LIBCPP_USING_IF_EXISTS;
343a9c9183cSLouis Dionneusing ::asin _LIBCPP_USING_IF_EXISTS;
344a9c9183cSLouis Dionneusing ::asinf _LIBCPP_USING_IF_EXISTS;
345a9c9183cSLouis Dionneusing ::atan _LIBCPP_USING_IF_EXISTS;
346a9c9183cSLouis Dionneusing ::atanf _LIBCPP_USING_IF_EXISTS;
347a9c9183cSLouis Dionneusing ::atan2 _LIBCPP_USING_IF_EXISTS;
348a9c9183cSLouis Dionneusing ::atan2f _LIBCPP_USING_IF_EXISTS;
349a9c9183cSLouis Dionneusing ::ceil _LIBCPP_USING_IF_EXISTS;
350a9c9183cSLouis Dionneusing ::ceilf _LIBCPP_USING_IF_EXISTS;
351a9c9183cSLouis Dionneusing ::cos _LIBCPP_USING_IF_EXISTS;
352a9c9183cSLouis Dionneusing ::cosf _LIBCPP_USING_IF_EXISTS;
353a9c9183cSLouis Dionneusing ::cosh _LIBCPP_USING_IF_EXISTS;
354a9c9183cSLouis Dionneusing ::coshf _LIBCPP_USING_IF_EXISTS;
3553e519524SHoward Hinnant
356a9c9183cSLouis Dionneusing ::exp _LIBCPP_USING_IF_EXISTS;
357a9c9183cSLouis Dionneusing ::expf _LIBCPP_USING_IF_EXISTS;
3583e519524SHoward Hinnant
359a9c9183cSLouis Dionneusing ::fabs _LIBCPP_USING_IF_EXISTS;
360a9c9183cSLouis Dionneusing ::fabsf _LIBCPP_USING_IF_EXISTS;
361a9c9183cSLouis Dionneusing ::floor _LIBCPP_USING_IF_EXISTS;
362a9c9183cSLouis Dionneusing ::floorf _LIBCPP_USING_IF_EXISTS;
363524956bbSRichard Smith
364a9c9183cSLouis Dionneusing ::fmod _LIBCPP_USING_IF_EXISTS;
365a9c9183cSLouis Dionneusing ::fmodf _LIBCPP_USING_IF_EXISTS;
366524956bbSRichard Smith
367a9c9183cSLouis Dionneusing ::frexp _LIBCPP_USING_IF_EXISTS;
368a9c9183cSLouis Dionneusing ::frexpf _LIBCPP_USING_IF_EXISTS;
369a9c9183cSLouis Dionneusing ::ldexp _LIBCPP_USING_IF_EXISTS;
370a9c9183cSLouis Dionneusing ::ldexpf _LIBCPP_USING_IF_EXISTS;
371524956bbSRichard Smith
372a9c9183cSLouis Dionneusing ::log _LIBCPP_USING_IF_EXISTS;
373a9c9183cSLouis Dionneusing ::logf _LIBCPP_USING_IF_EXISTS;
374524956bbSRichard Smith
375a9c9183cSLouis Dionneusing ::log10 _LIBCPP_USING_IF_EXISTS;
376a9c9183cSLouis Dionneusing ::log10f _LIBCPP_USING_IF_EXISTS;
377a9c9183cSLouis Dionneusing ::modf _LIBCPP_USING_IF_EXISTS;
378a9c9183cSLouis Dionneusing ::modff _LIBCPP_USING_IF_EXISTS;
379524956bbSRichard Smith
380a9c9183cSLouis Dionneusing ::pow _LIBCPP_USING_IF_EXISTS;
381a9c9183cSLouis Dionneusing ::powf _LIBCPP_USING_IF_EXISTS;
3823e519524SHoward Hinnant
383a9c9183cSLouis Dionneusing ::sin _LIBCPP_USING_IF_EXISTS;
384a9c9183cSLouis Dionneusing ::sinf _LIBCPP_USING_IF_EXISTS;
385a9c9183cSLouis Dionneusing ::sinh _LIBCPP_USING_IF_EXISTS;
386a9c9183cSLouis Dionneusing ::sinhf _LIBCPP_USING_IF_EXISTS;
387524956bbSRichard Smith
388a9c9183cSLouis Dionneusing ::sqrt _LIBCPP_USING_IF_EXISTS;
389a9c9183cSLouis Dionneusing ::sqrtf _LIBCPP_USING_IF_EXISTS;
390a9c9183cSLouis Dionneusing ::tan _LIBCPP_USING_IF_EXISTS;
391a9c9183cSLouis Dionneusing ::tanf _LIBCPP_USING_IF_EXISTS;
392524956bbSRichard Smith
393a9c9183cSLouis Dionneusing ::tanh _LIBCPP_USING_IF_EXISTS;
394a9c9183cSLouis Dionneusing ::tanhf _LIBCPP_USING_IF_EXISTS;
3953e519524SHoward Hinnant
396a9c9183cSLouis Dionneusing ::acosh _LIBCPP_USING_IF_EXISTS;
397a9c9183cSLouis Dionneusing ::acoshf _LIBCPP_USING_IF_EXISTS;
398a9c9183cSLouis Dionneusing ::asinh _LIBCPP_USING_IF_EXISTS;
399a9c9183cSLouis Dionneusing ::asinhf _LIBCPP_USING_IF_EXISTS;
400a9c9183cSLouis Dionneusing ::atanh _LIBCPP_USING_IF_EXISTS;
401a9c9183cSLouis Dionneusing ::atanhf _LIBCPP_USING_IF_EXISTS;
402a9c9183cSLouis Dionneusing ::cbrt _LIBCPP_USING_IF_EXISTS;
403a9c9183cSLouis Dionneusing ::cbrtf _LIBCPP_USING_IF_EXISTS;
4043e519524SHoward Hinnant
405a9c9183cSLouis Dionneusing ::copysign _LIBCPP_USING_IF_EXISTS;
406a9c9183cSLouis Dionneusing ::copysignf _LIBCPP_USING_IF_EXISTS;
4073e519524SHoward Hinnant
408a9c9183cSLouis Dionneusing ::erf _LIBCPP_USING_IF_EXISTS;
409a9c9183cSLouis Dionneusing ::erff _LIBCPP_USING_IF_EXISTS;
410a9c9183cSLouis Dionneusing ::erfc _LIBCPP_USING_IF_EXISTS;
411a9c9183cSLouis Dionneusing ::erfcf _LIBCPP_USING_IF_EXISTS;
412a9c9183cSLouis Dionneusing ::exp2 _LIBCPP_USING_IF_EXISTS;
413a9c9183cSLouis Dionneusing ::exp2f _LIBCPP_USING_IF_EXISTS;
414a9c9183cSLouis Dionneusing ::expm1 _LIBCPP_USING_IF_EXISTS;
415a9c9183cSLouis Dionneusing ::expm1f _LIBCPP_USING_IF_EXISTS;
416a9c9183cSLouis Dionneusing ::fdim _LIBCPP_USING_IF_EXISTS;
417a9c9183cSLouis Dionneusing ::fdimf _LIBCPP_USING_IF_EXISTS;
418a9c9183cSLouis Dionneusing ::fmaf _LIBCPP_USING_IF_EXISTS;
419a9c9183cSLouis Dionneusing ::fma _LIBCPP_USING_IF_EXISTS;
420a9c9183cSLouis Dionneusing ::fmax _LIBCPP_USING_IF_EXISTS;
421a9c9183cSLouis Dionneusing ::fmaxf _LIBCPP_USING_IF_EXISTS;
422a9c9183cSLouis Dionneusing ::fmin _LIBCPP_USING_IF_EXISTS;
423a9c9183cSLouis Dionneusing ::fminf _LIBCPP_USING_IF_EXISTS;
424a9c9183cSLouis Dionneusing ::hypot _LIBCPP_USING_IF_EXISTS;
425a9c9183cSLouis Dionneusing ::hypotf _LIBCPP_USING_IF_EXISTS;
426a9c9183cSLouis Dionneusing ::ilogb _LIBCPP_USING_IF_EXISTS;
427a9c9183cSLouis Dionneusing ::ilogbf _LIBCPP_USING_IF_EXISTS;
428a9c9183cSLouis Dionneusing ::lgamma _LIBCPP_USING_IF_EXISTS;
429a9c9183cSLouis Dionneusing ::lgammaf _LIBCPP_USING_IF_EXISTS;
430a9c9183cSLouis Dionneusing ::llrint _LIBCPP_USING_IF_EXISTS;
431a9c9183cSLouis Dionneusing ::llrintf _LIBCPP_USING_IF_EXISTS;
432a9c9183cSLouis Dionneusing ::llround _LIBCPP_USING_IF_EXISTS;
433a9c9183cSLouis Dionneusing ::llroundf _LIBCPP_USING_IF_EXISTS;
434a9c9183cSLouis Dionneusing ::log1p _LIBCPP_USING_IF_EXISTS;
435a9c9183cSLouis Dionneusing ::log1pf _LIBCPP_USING_IF_EXISTS;
436a9c9183cSLouis Dionneusing ::log2 _LIBCPP_USING_IF_EXISTS;
437a9c9183cSLouis Dionneusing ::log2f _LIBCPP_USING_IF_EXISTS;
438a9c9183cSLouis Dionneusing ::logb _LIBCPP_USING_IF_EXISTS;
439a9c9183cSLouis Dionneusing ::logbf _LIBCPP_USING_IF_EXISTS;
440a9c9183cSLouis Dionneusing ::lrint _LIBCPP_USING_IF_EXISTS;
441a9c9183cSLouis Dionneusing ::lrintf _LIBCPP_USING_IF_EXISTS;
442a9c9183cSLouis Dionneusing ::lround _LIBCPP_USING_IF_EXISTS;
443a9c9183cSLouis Dionneusing ::lroundf _LIBCPP_USING_IF_EXISTS;
4440be8f64cSHoward Hinnant
445a9c9183cSLouis Dionneusing ::nan _LIBCPP_USING_IF_EXISTS;
446a9c9183cSLouis Dionneusing ::nanf _LIBCPP_USING_IF_EXISTS;
4470be8f64cSHoward Hinnant
448a9c9183cSLouis Dionneusing ::nearbyint _LIBCPP_USING_IF_EXISTS;
449a9c9183cSLouis Dionneusing ::nearbyintf _LIBCPP_USING_IF_EXISTS;
450a9c9183cSLouis Dionneusing ::nextafter _LIBCPP_USING_IF_EXISTS;
451a9c9183cSLouis Dionneusing ::nextafterf _LIBCPP_USING_IF_EXISTS;
452a9c9183cSLouis Dionneusing ::nexttoward _LIBCPP_USING_IF_EXISTS;
453a9c9183cSLouis Dionneusing ::nexttowardf _LIBCPP_USING_IF_EXISTS;
454a9c9183cSLouis Dionneusing ::remainder _LIBCPP_USING_IF_EXISTS;
455a9c9183cSLouis Dionneusing ::remainderf _LIBCPP_USING_IF_EXISTS;
456a9c9183cSLouis Dionneusing ::remquo _LIBCPP_USING_IF_EXISTS;
457a9c9183cSLouis Dionneusing ::remquof _LIBCPP_USING_IF_EXISTS;
458a9c9183cSLouis Dionneusing ::rint _LIBCPP_USING_IF_EXISTS;
459a9c9183cSLouis Dionneusing ::rintf _LIBCPP_USING_IF_EXISTS;
460a9c9183cSLouis Dionneusing ::round _LIBCPP_USING_IF_EXISTS;
461a9c9183cSLouis Dionneusing ::roundf _LIBCPP_USING_IF_EXISTS;
462a9c9183cSLouis Dionneusing ::scalbln _LIBCPP_USING_IF_EXISTS;
463a9c9183cSLouis Dionneusing ::scalblnf _LIBCPP_USING_IF_EXISTS;
464a9c9183cSLouis Dionneusing ::scalbn _LIBCPP_USING_IF_EXISTS;
465a9c9183cSLouis Dionneusing ::scalbnf _LIBCPP_USING_IF_EXISTS;
466a9c9183cSLouis Dionneusing ::tgamma _LIBCPP_USING_IF_EXISTS;
467a9c9183cSLouis Dionneusing ::tgammaf _LIBCPP_USING_IF_EXISTS;
468a9c9183cSLouis Dionneusing ::trunc _LIBCPP_USING_IF_EXISTS;
469a9c9183cSLouis Dionneusing ::truncf _LIBCPP_USING_IF_EXISTS;
4709563a09cSHoward Hinnant
471a9c9183cSLouis Dionneusing ::acosl _LIBCPP_USING_IF_EXISTS;
472a9c9183cSLouis Dionneusing ::asinl _LIBCPP_USING_IF_EXISTS;
473a9c9183cSLouis Dionneusing ::atanl _LIBCPP_USING_IF_EXISTS;
474a9c9183cSLouis Dionneusing ::atan2l _LIBCPP_USING_IF_EXISTS;
475a9c9183cSLouis Dionneusing ::ceill _LIBCPP_USING_IF_EXISTS;
476a9c9183cSLouis Dionneusing ::cosl _LIBCPP_USING_IF_EXISTS;
477a9c9183cSLouis Dionneusing ::coshl _LIBCPP_USING_IF_EXISTS;
478a9c9183cSLouis Dionneusing ::expl _LIBCPP_USING_IF_EXISTS;
479a9c9183cSLouis Dionneusing ::fabsl _LIBCPP_USING_IF_EXISTS;
480a9c9183cSLouis Dionneusing ::floorl _LIBCPP_USING_IF_EXISTS;
481a9c9183cSLouis Dionneusing ::fmodl _LIBCPP_USING_IF_EXISTS;
482a9c9183cSLouis Dionneusing ::frexpl _LIBCPP_USING_IF_EXISTS;
483a9c9183cSLouis Dionneusing ::ldexpl _LIBCPP_USING_IF_EXISTS;
484a9c9183cSLouis Dionneusing ::logl _LIBCPP_USING_IF_EXISTS;
485a9c9183cSLouis Dionneusing ::log10l _LIBCPP_USING_IF_EXISTS;
486a9c9183cSLouis Dionneusing ::modfl _LIBCPP_USING_IF_EXISTS;
487a9c9183cSLouis Dionneusing ::powl _LIBCPP_USING_IF_EXISTS;
488a9c9183cSLouis Dionneusing ::sinl _LIBCPP_USING_IF_EXISTS;
489a9c9183cSLouis Dionneusing ::sinhl _LIBCPP_USING_IF_EXISTS;
490a9c9183cSLouis Dionneusing ::sqrtl _LIBCPP_USING_IF_EXISTS;
491a9c9183cSLouis Dionneusing ::tanl _LIBCPP_USING_IF_EXISTS;
492524956bbSRichard Smith
493a9c9183cSLouis Dionneusing ::tanhl _LIBCPP_USING_IF_EXISTS;
494a9c9183cSLouis Dionneusing ::acoshl _LIBCPP_USING_IF_EXISTS;
495a9c9183cSLouis Dionneusing ::asinhl _LIBCPP_USING_IF_EXISTS;
496a9c9183cSLouis Dionneusing ::atanhl _LIBCPP_USING_IF_EXISTS;
497a9c9183cSLouis Dionneusing ::cbrtl _LIBCPP_USING_IF_EXISTS;
498524956bbSRichard Smith
499a9c9183cSLouis Dionneusing ::copysignl _LIBCPP_USING_IF_EXISTS;
500524956bbSRichard Smith
501a9c9183cSLouis Dionneusing ::erfl _LIBCPP_USING_IF_EXISTS;
502a9c9183cSLouis Dionneusing ::erfcl _LIBCPP_USING_IF_EXISTS;
503a9c9183cSLouis Dionneusing ::exp2l _LIBCPP_USING_IF_EXISTS;
504a9c9183cSLouis Dionneusing ::expm1l _LIBCPP_USING_IF_EXISTS;
505a9c9183cSLouis Dionneusing ::fdiml _LIBCPP_USING_IF_EXISTS;
506a9c9183cSLouis Dionneusing ::fmal _LIBCPP_USING_IF_EXISTS;
507a9c9183cSLouis Dionneusing ::fmaxl _LIBCPP_USING_IF_EXISTS;
508a9c9183cSLouis Dionneusing ::fminl _LIBCPP_USING_IF_EXISTS;
509a9c9183cSLouis Dionneusing ::hypotl _LIBCPP_USING_IF_EXISTS;
510a9c9183cSLouis Dionneusing ::ilogbl _LIBCPP_USING_IF_EXISTS;
511a9c9183cSLouis Dionneusing ::lgammal _LIBCPP_USING_IF_EXISTS;
512a9c9183cSLouis Dionneusing ::llrintl _LIBCPP_USING_IF_EXISTS;
513a9c9183cSLouis Dionneusing ::llroundl _LIBCPP_USING_IF_EXISTS;
514a9c9183cSLouis Dionneusing ::log1pl _LIBCPP_USING_IF_EXISTS;
515a9c9183cSLouis Dionneusing ::log2l _LIBCPP_USING_IF_EXISTS;
516a9c9183cSLouis Dionneusing ::logbl _LIBCPP_USING_IF_EXISTS;
517a9c9183cSLouis Dionneusing ::lrintl _LIBCPP_USING_IF_EXISTS;
518a9c9183cSLouis Dionneusing ::lroundl _LIBCPP_USING_IF_EXISTS;
519a9c9183cSLouis Dionneusing ::nanl _LIBCPP_USING_IF_EXISTS;
520a9c9183cSLouis Dionneusing ::nearbyintl _LIBCPP_USING_IF_EXISTS;
521a9c9183cSLouis Dionneusing ::nextafterl _LIBCPP_USING_IF_EXISTS;
522a9c9183cSLouis Dionneusing ::nexttowardl _LIBCPP_USING_IF_EXISTS;
523a9c9183cSLouis Dionneusing ::remainderl _LIBCPP_USING_IF_EXISTS;
524a9c9183cSLouis Dionneusing ::remquol _LIBCPP_USING_IF_EXISTS;
525a9c9183cSLouis Dionneusing ::rintl _LIBCPP_USING_IF_EXISTS;
526a9c9183cSLouis Dionneusing ::roundl _LIBCPP_USING_IF_EXISTS;
527a9c9183cSLouis Dionneusing ::scalblnl _LIBCPP_USING_IF_EXISTS;
528a9c9183cSLouis Dionneusing ::scalbnl _LIBCPP_USING_IF_EXISTS;
529a9c9183cSLouis Dionneusing ::tgammal _LIBCPP_USING_IF_EXISTS;
530a9c9183cSLouis Dionneusing ::truncl _LIBCPP_USING_IF_EXISTS;
5313e519524SHoward Hinnant
5324328c2baSMarshall Clow#if _LIBCPP_STD_VER > 14
533*b48c5010SNikolas Klauserinline _LIBCPP_INLINE_VISIBILITY float       hypot(       float __x,       float __y,       float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
534*b48c5010SNikolas Klauserinline _LIBCPP_INLINE_VISIBILITY double      hypot(      double __x,      double __y,      double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
535*b48c5010SNikolas Klauserinline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
5364328c2baSMarshall Clow
5374328c2baSMarshall Clowtemplate <class _A1, class _A2, class _A3>
5384328c2baSMarshall Clowinline _LIBCPP_INLINE_VISIBILITY
5394e0ea2cfSLouis Dionnetypename enable_if_t
5404328c2baSMarshall Clow<
5416f557b9fSHal Finkel    is_arithmetic<_A1>::value &&
5426f557b9fSHal Finkel    is_arithmetic<_A2>::value &&
5436f557b9fSHal Finkel    is_arithmetic<_A3>::value,
5446f557b9fSHal Finkel    __promote<_A1, _A2, _A3>
5454328c2baSMarshall Clow>::type
5464328c2baSMarshall Clowhypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
5474328c2baSMarshall Clow{
5486f557b9fSHal Finkel    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
5496f557b9fSHal Finkel    static_assert((!(is_same<_A1, __result_type>::value &&
5506f557b9fSHal Finkel                     is_same<_A2, __result_type>::value &&
5516f557b9fSHal Finkel                     is_same<_A3, __result_type>::value)), "");
5524328c2baSMarshall Clow    return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
5534328c2baSMarshall Clow}
5544328c2baSMarshall Clow#endif
5554328c2baSMarshall Clow
556ae22f0b2SHal Finkeltemplate <class _A1>
557dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
5582d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
55966631a12SDuncan P. N. Exon Smith__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
560ae22f0b2SHal Finkel{
561ae22f0b2SHal Finkel#if __has_builtin(__builtin_isnan)
562ae22f0b2SHal Finkel    return __builtin_isnan(__lcpp_x);
563ae22f0b2SHal Finkel#else
564ae22f0b2SHal Finkel    return isnan(__lcpp_x);
565ae22f0b2SHal Finkel#endif
566ae22f0b2SHal Finkel}
567ae22f0b2SHal Finkel
568ae22f0b2SHal Finkeltemplate <class _A1>
569dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
5702d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
57166631a12SDuncan P. N. Exon Smith__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
572ae22f0b2SHal Finkel{
573ae22f0b2SHal Finkel    return isnan(__lcpp_x);
574ae22f0b2SHal Finkel}
575ae22f0b2SHal Finkel
576ae22f0b2SHal Finkeltemplate <class _A1>
577dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
5782d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
57966631a12SDuncan P. N. Exon Smith__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
580ae22f0b2SHal Finkel{
581ae22f0b2SHal Finkel#if __has_builtin(__builtin_isinf)
582ae22f0b2SHal Finkel    return __builtin_isinf(__lcpp_x);
583ae22f0b2SHal Finkel#else
584ae22f0b2SHal Finkel    return isinf(__lcpp_x);
585ae22f0b2SHal Finkel#endif
586ae22f0b2SHal Finkel}
587ae22f0b2SHal Finkel
588ae22f0b2SHal Finkeltemplate <class _A1>
589dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
5902d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
59166631a12SDuncan P. N. Exon Smith__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
592ae22f0b2SHal Finkel{
593ae22f0b2SHal Finkel    return isinf(__lcpp_x);
594ae22f0b2SHal Finkel}
595ae22f0b2SHal Finkel
596ae22f0b2SHal Finkeltemplate <class _A1>
597dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
5982d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
59966631a12SDuncan P. N. Exon Smith__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
600ae22f0b2SHal Finkel{
601ae22f0b2SHal Finkel#if __has_builtin(__builtin_isfinite)
602ae22f0b2SHal Finkel    return __builtin_isfinite(__lcpp_x);
603ae22f0b2SHal Finkel#else
604ae22f0b2SHal Finkel    return isfinite(__lcpp_x);
605ae22f0b2SHal Finkel#endif
606ae22f0b2SHal Finkel}
607ae22f0b2SHal Finkel
608ae22f0b2SHal Finkeltemplate <class _A1>
609dc7200b4SLouis Dionne_LIBCPP_INLINE_VISIBILITY
6102d348228SJustin Lebar_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
61166631a12SDuncan P. N. Exon Smith__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
612ae22f0b2SHal Finkel{
613ae22f0b2SHal Finkel    return isfinite(__lcpp_x);
614ae22f0b2SHal Finkel}
615ae22f0b2SHal Finkel
616b0e2daf6SMarshall Clow#if _LIBCPP_STD_VER > 17
617b0e2daf6SMarshall Clowtemplate <typename _Fp>
618b0e2daf6SMarshall Clowconstexpr
619b0e2daf6SMarshall Clow_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
620b0e2daf6SMarshall Clow    if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
621b0e2daf6SMarshall Clow        return __t * __b + (1 - __t) * __a;
622b0e2daf6SMarshall Clow
623b0e2daf6SMarshall Clow    if (__t == 1) return __b;
624b0e2daf6SMarshall Clow    const _Fp __x = __a + __t * (__b - __a);
6252e4755ffSLouis Dionne    if ((__t > 1) == (__b > __a))
626b0e2daf6SMarshall Clow        return __b < __x ? __x : __b;
627b0e2daf6SMarshall Clow    else
628b0e2daf6SMarshall Clow        return __x < __b ? __x : __b;
629b0e2daf6SMarshall Clow}
630b0e2daf6SMarshall Clow
631b0e2daf6SMarshall Clowconstexpr float
632b0e2daf6SMarshall Clowlerp(float __a, float __b, float __t)                   _NOEXCEPT { return __lerp(__a, __b, __t); }
633b0e2daf6SMarshall Clow
634b0e2daf6SMarshall Clowconstexpr double
635b0e2daf6SMarshall Clowlerp(double __a, double __b, double __t)                _NOEXCEPT { return __lerp(__a, __b, __t); }
636b0e2daf6SMarshall Clow
637b0e2daf6SMarshall Clowconstexpr long double
638b0e2daf6SMarshall Clowlerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
639b0e2daf6SMarshall Clow
640004ebe22SArthur O'Dwyertemplate <class _A1, class _A2, class _A3>
641004ebe22SArthur O'Dwyerinline _LIBCPP_HIDE_FROM_ABI
642004ebe22SArthur O'Dwyerconstexpr typename enable_if_t
643004ebe22SArthur O'Dwyer<
644004ebe22SArthur O'Dwyer    is_arithmetic<_A1>::value &&
645004ebe22SArthur O'Dwyer    is_arithmetic<_A2>::value &&
646004ebe22SArthur O'Dwyer    is_arithmetic<_A3>::value,
647004ebe22SArthur O'Dwyer    __promote<_A1, _A2, _A3>
648004ebe22SArthur O'Dwyer>::type
649004ebe22SArthur O'Dwyerlerp(_A1 __a, _A2 __b, _A3 __t) noexcept
650004ebe22SArthur O'Dwyer{
651004ebe22SArthur O'Dwyer    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
652004ebe22SArthur O'Dwyer    static_assert(!(_IsSame<_A1, __result_type>::value &&
653004ebe22SArthur O'Dwyer                    _IsSame<_A2, __result_type>::value &&
654004ebe22SArthur O'Dwyer                    _IsSame<_A3, __result_type>::value));
655004ebe22SArthur O'Dwyer    return __lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
656004ebe22SArthur O'Dwyer}
657b0e2daf6SMarshall Clow#endif // _LIBCPP_STD_VER > 17
658b0e2daf6SMarshall Clow
6593e519524SHoward Hinnant_LIBCPP_END_NAMESPACE_STD
6603e519524SHoward Hinnant
661b92dededSLouis Dionne_LIBCPP_POP_MACROS
662b92dededSLouis Dionne
6633e519524SHoward Hinnant#endif // _LIBCPP_CMATH
664