1*7330f729Sjoerg /*===---- tgmath.h - Standard header for type generic math ----------------===*\ 2*7330f729Sjoerg * 3*7330f729Sjoerg * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*7330f729Sjoerg * See https://llvm.org/LICENSE.txt for license information. 5*7330f729Sjoerg * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*7330f729Sjoerg * 7*7330f729Sjoerg \*===----------------------------------------------------------------------===*/ 8*7330f729Sjoerg 9*7330f729Sjoerg #ifndef __CLANG_TGMATH_H 10*7330f729Sjoerg #define __CLANG_TGMATH_H 11*7330f729Sjoerg 12*7330f729Sjoerg /* C99 7.22 Type-generic math <tgmath.h>. */ 13*7330f729Sjoerg #include <math.h> 14*7330f729Sjoerg 15*7330f729Sjoerg /* 16*7330f729Sjoerg * Allow additional definitions and implementation-defined values on Apple 17*7330f729Sjoerg * platforms. This is done after #include <math.h> to avoid depcycle conflicts 18*7330f729Sjoerg * between libcxx and darwin in C++ modules builds. 19*7330f729Sjoerg */ 20*7330f729Sjoerg #if defined(__APPLE__) && __STDC_HOSTED__ && __has_include_next(<tgmath.h>) 21*7330f729Sjoerg # include_next <tgmath.h> 22*7330f729Sjoerg #else 23*7330f729Sjoerg 24*7330f729Sjoerg /* C++ handles type genericity with overloading in math.h. */ 25*7330f729Sjoerg #ifndef __cplusplus 26*7330f729Sjoerg #include <complex.h> 27*7330f729Sjoerg 28*7330f729Sjoerg #define _TG_ATTRSp __attribute__((__overloadable__)) 29*7330f729Sjoerg #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__)) 30*7330f729Sjoerg 31*7330f729Sjoerg // promotion 32*7330f729Sjoerg 33*7330f729Sjoerg typedef void _Argument_type_is_not_arithmetic; 34*7330f729Sjoerg static _Argument_type_is_not_arithmetic __tg_promote(...) 35*7330f729Sjoerg __attribute__((__unavailable__,__overloadable__)); 36*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(int); 37*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(unsigned int); 38*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(long); 39*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(unsigned long); 40*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(long long); 41*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(unsigned long long); 42*7330f729Sjoerg static float _TG_ATTRSp __tg_promote(float); 43*7330f729Sjoerg static double _TG_ATTRSp __tg_promote(double); 44*7330f729Sjoerg static long double _TG_ATTRSp __tg_promote(long double); 45*7330f729Sjoerg static float _Complex _TG_ATTRSp __tg_promote(float _Complex); 46*7330f729Sjoerg static double _Complex _TG_ATTRSp __tg_promote(double _Complex); 47*7330f729Sjoerg static long double _Complex _TG_ATTRSp __tg_promote(long double _Complex); 48*7330f729Sjoerg 49*7330f729Sjoerg #define __tg_promote1(__x) (__typeof__(__tg_promote(__x))) 50*7330f729Sjoerg #define __tg_promote2(__x, __y) (__typeof__(__tg_promote(__x) + \ 51*7330f729Sjoerg __tg_promote(__y))) 52*7330f729Sjoerg #define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \ 53*7330f729Sjoerg __tg_promote(__y) + \ 54*7330f729Sjoerg __tg_promote(__z))) 55*7330f729Sjoerg 56*7330f729Sjoerg // acos 57*7330f729Sjoerg 58*7330f729Sjoerg static float 59*7330f729Sjoerg _TG_ATTRS __tg_acos(float __x)60*7330f729Sjoerg __tg_acos(float __x) {return acosf(__x);} 61*7330f729Sjoerg 62*7330f729Sjoerg static double 63*7330f729Sjoerg _TG_ATTRS __tg_acos(double __x)64*7330f729Sjoerg __tg_acos(double __x) {return acos(__x);} 65*7330f729Sjoerg 66*7330f729Sjoerg static long double 67*7330f729Sjoerg _TG_ATTRS __tg_acos(long double __x)68*7330f729Sjoerg __tg_acos(long double __x) {return acosl(__x);} 69*7330f729Sjoerg 70*7330f729Sjoerg static float _Complex 71*7330f729Sjoerg _TG_ATTRS __tg_acos(float _Complex __x)72*7330f729Sjoerg __tg_acos(float _Complex __x) {return cacosf(__x);} 73*7330f729Sjoerg 74*7330f729Sjoerg static double _Complex 75*7330f729Sjoerg _TG_ATTRS __tg_acos(double _Complex __x)76*7330f729Sjoerg __tg_acos(double _Complex __x) {return cacos(__x);} 77*7330f729Sjoerg 78*7330f729Sjoerg static long double _Complex 79*7330f729Sjoerg _TG_ATTRS __tg_acos(long double _Complex __x)80*7330f729Sjoerg __tg_acos(long double _Complex __x) {return cacosl(__x);} 81*7330f729Sjoerg 82*7330f729Sjoerg #undef acos 83*7330f729Sjoerg #define acos(__x) __tg_acos(__tg_promote1((__x))(__x)) 84*7330f729Sjoerg 85*7330f729Sjoerg // asin 86*7330f729Sjoerg 87*7330f729Sjoerg static float 88*7330f729Sjoerg _TG_ATTRS __tg_asin(float __x)89*7330f729Sjoerg __tg_asin(float __x) {return asinf(__x);} 90*7330f729Sjoerg 91*7330f729Sjoerg static double 92*7330f729Sjoerg _TG_ATTRS __tg_asin(double __x)93*7330f729Sjoerg __tg_asin(double __x) {return asin(__x);} 94*7330f729Sjoerg 95*7330f729Sjoerg static long double 96*7330f729Sjoerg _TG_ATTRS __tg_asin(long double __x)97*7330f729Sjoerg __tg_asin(long double __x) {return asinl(__x);} 98*7330f729Sjoerg 99*7330f729Sjoerg static float _Complex 100*7330f729Sjoerg _TG_ATTRS __tg_asin(float _Complex __x)101*7330f729Sjoerg __tg_asin(float _Complex __x) {return casinf(__x);} 102*7330f729Sjoerg 103*7330f729Sjoerg static double _Complex 104*7330f729Sjoerg _TG_ATTRS __tg_asin(double _Complex __x)105*7330f729Sjoerg __tg_asin(double _Complex __x) {return casin(__x);} 106*7330f729Sjoerg 107*7330f729Sjoerg static long double _Complex 108*7330f729Sjoerg _TG_ATTRS __tg_asin(long double _Complex __x)109*7330f729Sjoerg __tg_asin(long double _Complex __x) {return casinl(__x);} 110*7330f729Sjoerg 111*7330f729Sjoerg #undef asin 112*7330f729Sjoerg #define asin(__x) __tg_asin(__tg_promote1((__x))(__x)) 113*7330f729Sjoerg 114*7330f729Sjoerg // atan 115*7330f729Sjoerg 116*7330f729Sjoerg static float 117*7330f729Sjoerg _TG_ATTRS __tg_atan(float __x)118*7330f729Sjoerg __tg_atan(float __x) {return atanf(__x);} 119*7330f729Sjoerg 120*7330f729Sjoerg static double 121*7330f729Sjoerg _TG_ATTRS __tg_atan(double __x)122*7330f729Sjoerg __tg_atan(double __x) {return atan(__x);} 123*7330f729Sjoerg 124*7330f729Sjoerg static long double 125*7330f729Sjoerg _TG_ATTRS __tg_atan(long double __x)126*7330f729Sjoerg __tg_atan(long double __x) {return atanl(__x);} 127*7330f729Sjoerg 128*7330f729Sjoerg static float _Complex 129*7330f729Sjoerg _TG_ATTRS __tg_atan(float _Complex __x)130*7330f729Sjoerg __tg_atan(float _Complex __x) {return catanf(__x);} 131*7330f729Sjoerg 132*7330f729Sjoerg static double _Complex 133*7330f729Sjoerg _TG_ATTRS __tg_atan(double _Complex __x)134*7330f729Sjoerg __tg_atan(double _Complex __x) {return catan(__x);} 135*7330f729Sjoerg 136*7330f729Sjoerg static long double _Complex 137*7330f729Sjoerg _TG_ATTRS __tg_atan(long double _Complex __x)138*7330f729Sjoerg __tg_atan(long double _Complex __x) {return catanl(__x);} 139*7330f729Sjoerg 140*7330f729Sjoerg #undef atan 141*7330f729Sjoerg #define atan(__x) __tg_atan(__tg_promote1((__x))(__x)) 142*7330f729Sjoerg 143*7330f729Sjoerg // acosh 144*7330f729Sjoerg 145*7330f729Sjoerg static float 146*7330f729Sjoerg _TG_ATTRS __tg_acosh(float __x)147*7330f729Sjoerg __tg_acosh(float __x) {return acoshf(__x);} 148*7330f729Sjoerg 149*7330f729Sjoerg static double 150*7330f729Sjoerg _TG_ATTRS __tg_acosh(double __x)151*7330f729Sjoerg __tg_acosh(double __x) {return acosh(__x);} 152*7330f729Sjoerg 153*7330f729Sjoerg static long double 154*7330f729Sjoerg _TG_ATTRS __tg_acosh(long double __x)155*7330f729Sjoerg __tg_acosh(long double __x) {return acoshl(__x);} 156*7330f729Sjoerg 157*7330f729Sjoerg static float _Complex 158*7330f729Sjoerg _TG_ATTRS __tg_acosh(float _Complex __x)159*7330f729Sjoerg __tg_acosh(float _Complex __x) {return cacoshf(__x);} 160*7330f729Sjoerg 161*7330f729Sjoerg static double _Complex 162*7330f729Sjoerg _TG_ATTRS __tg_acosh(double _Complex __x)163*7330f729Sjoerg __tg_acosh(double _Complex __x) {return cacosh(__x);} 164*7330f729Sjoerg 165*7330f729Sjoerg static long double _Complex 166*7330f729Sjoerg _TG_ATTRS __tg_acosh(long double _Complex __x)167*7330f729Sjoerg __tg_acosh(long double _Complex __x) {return cacoshl(__x);} 168*7330f729Sjoerg 169*7330f729Sjoerg #undef acosh 170*7330f729Sjoerg #define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x)) 171*7330f729Sjoerg 172*7330f729Sjoerg // asinh 173*7330f729Sjoerg 174*7330f729Sjoerg static float 175*7330f729Sjoerg _TG_ATTRS __tg_asinh(float __x)176*7330f729Sjoerg __tg_asinh(float __x) {return asinhf(__x);} 177*7330f729Sjoerg 178*7330f729Sjoerg static double 179*7330f729Sjoerg _TG_ATTRS __tg_asinh(double __x)180*7330f729Sjoerg __tg_asinh(double __x) {return asinh(__x);} 181*7330f729Sjoerg 182*7330f729Sjoerg static long double 183*7330f729Sjoerg _TG_ATTRS __tg_asinh(long double __x)184*7330f729Sjoerg __tg_asinh(long double __x) {return asinhl(__x);} 185*7330f729Sjoerg 186*7330f729Sjoerg static float _Complex 187*7330f729Sjoerg _TG_ATTRS __tg_asinh(float _Complex __x)188*7330f729Sjoerg __tg_asinh(float _Complex __x) {return casinhf(__x);} 189*7330f729Sjoerg 190*7330f729Sjoerg static double _Complex 191*7330f729Sjoerg _TG_ATTRS __tg_asinh(double _Complex __x)192*7330f729Sjoerg __tg_asinh(double _Complex __x) {return casinh(__x);} 193*7330f729Sjoerg 194*7330f729Sjoerg static long double _Complex 195*7330f729Sjoerg _TG_ATTRS __tg_asinh(long double _Complex __x)196*7330f729Sjoerg __tg_asinh(long double _Complex __x) {return casinhl(__x);} 197*7330f729Sjoerg 198*7330f729Sjoerg #undef asinh 199*7330f729Sjoerg #define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x)) 200*7330f729Sjoerg 201*7330f729Sjoerg // atanh 202*7330f729Sjoerg 203*7330f729Sjoerg static float 204*7330f729Sjoerg _TG_ATTRS __tg_atanh(float __x)205*7330f729Sjoerg __tg_atanh(float __x) {return atanhf(__x);} 206*7330f729Sjoerg 207*7330f729Sjoerg static double 208*7330f729Sjoerg _TG_ATTRS __tg_atanh(double __x)209*7330f729Sjoerg __tg_atanh(double __x) {return atanh(__x);} 210*7330f729Sjoerg 211*7330f729Sjoerg static long double 212*7330f729Sjoerg _TG_ATTRS __tg_atanh(long double __x)213*7330f729Sjoerg __tg_atanh(long double __x) {return atanhl(__x);} 214*7330f729Sjoerg 215*7330f729Sjoerg static float _Complex 216*7330f729Sjoerg _TG_ATTRS __tg_atanh(float _Complex __x)217*7330f729Sjoerg __tg_atanh(float _Complex __x) {return catanhf(__x);} 218*7330f729Sjoerg 219*7330f729Sjoerg static double _Complex 220*7330f729Sjoerg _TG_ATTRS __tg_atanh(double _Complex __x)221*7330f729Sjoerg __tg_atanh(double _Complex __x) {return catanh(__x);} 222*7330f729Sjoerg 223*7330f729Sjoerg static long double _Complex 224*7330f729Sjoerg _TG_ATTRS __tg_atanh(long double _Complex __x)225*7330f729Sjoerg __tg_atanh(long double _Complex __x) {return catanhl(__x);} 226*7330f729Sjoerg 227*7330f729Sjoerg #undef atanh 228*7330f729Sjoerg #define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x)) 229*7330f729Sjoerg 230*7330f729Sjoerg // cos 231*7330f729Sjoerg 232*7330f729Sjoerg static float 233*7330f729Sjoerg _TG_ATTRS __tg_cos(float __x)234*7330f729Sjoerg __tg_cos(float __x) {return cosf(__x);} 235*7330f729Sjoerg 236*7330f729Sjoerg static double 237*7330f729Sjoerg _TG_ATTRS __tg_cos(double __x)238*7330f729Sjoerg __tg_cos(double __x) {return cos(__x);} 239*7330f729Sjoerg 240*7330f729Sjoerg static long double 241*7330f729Sjoerg _TG_ATTRS __tg_cos(long double __x)242*7330f729Sjoerg __tg_cos(long double __x) {return cosl(__x);} 243*7330f729Sjoerg 244*7330f729Sjoerg static float _Complex 245*7330f729Sjoerg _TG_ATTRS __tg_cos(float _Complex __x)246*7330f729Sjoerg __tg_cos(float _Complex __x) {return ccosf(__x);} 247*7330f729Sjoerg 248*7330f729Sjoerg static double _Complex 249*7330f729Sjoerg _TG_ATTRS __tg_cos(double _Complex __x)250*7330f729Sjoerg __tg_cos(double _Complex __x) {return ccos(__x);} 251*7330f729Sjoerg 252*7330f729Sjoerg static long double _Complex 253*7330f729Sjoerg _TG_ATTRS __tg_cos(long double _Complex __x)254*7330f729Sjoerg __tg_cos(long double _Complex __x) {return ccosl(__x);} 255*7330f729Sjoerg 256*7330f729Sjoerg #undef cos 257*7330f729Sjoerg #define cos(__x) __tg_cos(__tg_promote1((__x))(__x)) 258*7330f729Sjoerg 259*7330f729Sjoerg // sin 260*7330f729Sjoerg 261*7330f729Sjoerg static float 262*7330f729Sjoerg _TG_ATTRS __tg_sin(float __x)263*7330f729Sjoerg __tg_sin(float __x) {return sinf(__x);} 264*7330f729Sjoerg 265*7330f729Sjoerg static double 266*7330f729Sjoerg _TG_ATTRS __tg_sin(double __x)267*7330f729Sjoerg __tg_sin(double __x) {return sin(__x);} 268*7330f729Sjoerg 269*7330f729Sjoerg static long double 270*7330f729Sjoerg _TG_ATTRS __tg_sin(long double __x)271*7330f729Sjoerg __tg_sin(long double __x) {return sinl(__x);} 272*7330f729Sjoerg 273*7330f729Sjoerg static float _Complex 274*7330f729Sjoerg _TG_ATTRS __tg_sin(float _Complex __x)275*7330f729Sjoerg __tg_sin(float _Complex __x) {return csinf(__x);} 276*7330f729Sjoerg 277*7330f729Sjoerg static double _Complex 278*7330f729Sjoerg _TG_ATTRS __tg_sin(double _Complex __x)279*7330f729Sjoerg __tg_sin(double _Complex __x) {return csin(__x);} 280*7330f729Sjoerg 281*7330f729Sjoerg static long double _Complex 282*7330f729Sjoerg _TG_ATTRS __tg_sin(long double _Complex __x)283*7330f729Sjoerg __tg_sin(long double _Complex __x) {return csinl(__x);} 284*7330f729Sjoerg 285*7330f729Sjoerg #undef sin 286*7330f729Sjoerg #define sin(__x) __tg_sin(__tg_promote1((__x))(__x)) 287*7330f729Sjoerg 288*7330f729Sjoerg // tan 289*7330f729Sjoerg 290*7330f729Sjoerg static float 291*7330f729Sjoerg _TG_ATTRS __tg_tan(float __x)292*7330f729Sjoerg __tg_tan(float __x) {return tanf(__x);} 293*7330f729Sjoerg 294*7330f729Sjoerg static double 295*7330f729Sjoerg _TG_ATTRS __tg_tan(double __x)296*7330f729Sjoerg __tg_tan(double __x) {return tan(__x);} 297*7330f729Sjoerg 298*7330f729Sjoerg static long double 299*7330f729Sjoerg _TG_ATTRS __tg_tan(long double __x)300*7330f729Sjoerg __tg_tan(long double __x) {return tanl(__x);} 301*7330f729Sjoerg 302*7330f729Sjoerg static float _Complex 303*7330f729Sjoerg _TG_ATTRS __tg_tan(float _Complex __x)304*7330f729Sjoerg __tg_tan(float _Complex __x) {return ctanf(__x);} 305*7330f729Sjoerg 306*7330f729Sjoerg static double _Complex 307*7330f729Sjoerg _TG_ATTRS __tg_tan(double _Complex __x)308*7330f729Sjoerg __tg_tan(double _Complex __x) {return ctan(__x);} 309*7330f729Sjoerg 310*7330f729Sjoerg static long double _Complex 311*7330f729Sjoerg _TG_ATTRS __tg_tan(long double _Complex __x)312*7330f729Sjoerg __tg_tan(long double _Complex __x) {return ctanl(__x);} 313*7330f729Sjoerg 314*7330f729Sjoerg #undef tan 315*7330f729Sjoerg #define tan(__x) __tg_tan(__tg_promote1((__x))(__x)) 316*7330f729Sjoerg 317*7330f729Sjoerg // cosh 318*7330f729Sjoerg 319*7330f729Sjoerg static float 320*7330f729Sjoerg _TG_ATTRS __tg_cosh(float __x)321*7330f729Sjoerg __tg_cosh(float __x) {return coshf(__x);} 322*7330f729Sjoerg 323*7330f729Sjoerg static double 324*7330f729Sjoerg _TG_ATTRS __tg_cosh(double __x)325*7330f729Sjoerg __tg_cosh(double __x) {return cosh(__x);} 326*7330f729Sjoerg 327*7330f729Sjoerg static long double 328*7330f729Sjoerg _TG_ATTRS __tg_cosh(long double __x)329*7330f729Sjoerg __tg_cosh(long double __x) {return coshl(__x);} 330*7330f729Sjoerg 331*7330f729Sjoerg static float _Complex 332*7330f729Sjoerg _TG_ATTRS __tg_cosh(float _Complex __x)333*7330f729Sjoerg __tg_cosh(float _Complex __x) {return ccoshf(__x);} 334*7330f729Sjoerg 335*7330f729Sjoerg static double _Complex 336*7330f729Sjoerg _TG_ATTRS __tg_cosh(double _Complex __x)337*7330f729Sjoerg __tg_cosh(double _Complex __x) {return ccosh(__x);} 338*7330f729Sjoerg 339*7330f729Sjoerg static long double _Complex 340*7330f729Sjoerg _TG_ATTRS __tg_cosh(long double _Complex __x)341*7330f729Sjoerg __tg_cosh(long double _Complex __x) {return ccoshl(__x);} 342*7330f729Sjoerg 343*7330f729Sjoerg #undef cosh 344*7330f729Sjoerg #define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x)) 345*7330f729Sjoerg 346*7330f729Sjoerg // sinh 347*7330f729Sjoerg 348*7330f729Sjoerg static float 349*7330f729Sjoerg _TG_ATTRS __tg_sinh(float __x)350*7330f729Sjoerg __tg_sinh(float __x) {return sinhf(__x);} 351*7330f729Sjoerg 352*7330f729Sjoerg static double 353*7330f729Sjoerg _TG_ATTRS __tg_sinh(double __x)354*7330f729Sjoerg __tg_sinh(double __x) {return sinh(__x);} 355*7330f729Sjoerg 356*7330f729Sjoerg static long double 357*7330f729Sjoerg _TG_ATTRS __tg_sinh(long double __x)358*7330f729Sjoerg __tg_sinh(long double __x) {return sinhl(__x);} 359*7330f729Sjoerg 360*7330f729Sjoerg static float _Complex 361*7330f729Sjoerg _TG_ATTRS __tg_sinh(float _Complex __x)362*7330f729Sjoerg __tg_sinh(float _Complex __x) {return csinhf(__x);} 363*7330f729Sjoerg 364*7330f729Sjoerg static double _Complex 365*7330f729Sjoerg _TG_ATTRS __tg_sinh(double _Complex __x)366*7330f729Sjoerg __tg_sinh(double _Complex __x) {return csinh(__x);} 367*7330f729Sjoerg 368*7330f729Sjoerg static long double _Complex 369*7330f729Sjoerg _TG_ATTRS __tg_sinh(long double _Complex __x)370*7330f729Sjoerg __tg_sinh(long double _Complex __x) {return csinhl(__x);} 371*7330f729Sjoerg 372*7330f729Sjoerg #undef sinh 373*7330f729Sjoerg #define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x)) 374*7330f729Sjoerg 375*7330f729Sjoerg // tanh 376*7330f729Sjoerg 377*7330f729Sjoerg static float 378*7330f729Sjoerg _TG_ATTRS __tg_tanh(float __x)379*7330f729Sjoerg __tg_tanh(float __x) {return tanhf(__x);} 380*7330f729Sjoerg 381*7330f729Sjoerg static double 382*7330f729Sjoerg _TG_ATTRS __tg_tanh(double __x)383*7330f729Sjoerg __tg_tanh(double __x) {return tanh(__x);} 384*7330f729Sjoerg 385*7330f729Sjoerg static long double 386*7330f729Sjoerg _TG_ATTRS __tg_tanh(long double __x)387*7330f729Sjoerg __tg_tanh(long double __x) {return tanhl(__x);} 388*7330f729Sjoerg 389*7330f729Sjoerg static float _Complex 390*7330f729Sjoerg _TG_ATTRS __tg_tanh(float _Complex __x)391*7330f729Sjoerg __tg_tanh(float _Complex __x) {return ctanhf(__x);} 392*7330f729Sjoerg 393*7330f729Sjoerg static double _Complex 394*7330f729Sjoerg _TG_ATTRS __tg_tanh(double _Complex __x)395*7330f729Sjoerg __tg_tanh(double _Complex __x) {return ctanh(__x);} 396*7330f729Sjoerg 397*7330f729Sjoerg static long double _Complex 398*7330f729Sjoerg _TG_ATTRS __tg_tanh(long double _Complex __x)399*7330f729Sjoerg __tg_tanh(long double _Complex __x) {return ctanhl(__x);} 400*7330f729Sjoerg 401*7330f729Sjoerg #undef tanh 402*7330f729Sjoerg #define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x)) 403*7330f729Sjoerg 404*7330f729Sjoerg // exp 405*7330f729Sjoerg 406*7330f729Sjoerg static float 407*7330f729Sjoerg _TG_ATTRS __tg_exp(float __x)408*7330f729Sjoerg __tg_exp(float __x) {return expf(__x);} 409*7330f729Sjoerg 410*7330f729Sjoerg static double 411*7330f729Sjoerg _TG_ATTRS __tg_exp(double __x)412*7330f729Sjoerg __tg_exp(double __x) {return exp(__x);} 413*7330f729Sjoerg 414*7330f729Sjoerg static long double 415*7330f729Sjoerg _TG_ATTRS __tg_exp(long double __x)416*7330f729Sjoerg __tg_exp(long double __x) {return expl(__x);} 417*7330f729Sjoerg 418*7330f729Sjoerg static float _Complex 419*7330f729Sjoerg _TG_ATTRS __tg_exp(float _Complex __x)420*7330f729Sjoerg __tg_exp(float _Complex __x) {return cexpf(__x);} 421*7330f729Sjoerg 422*7330f729Sjoerg static double _Complex 423*7330f729Sjoerg _TG_ATTRS __tg_exp(double _Complex __x)424*7330f729Sjoerg __tg_exp(double _Complex __x) {return cexp(__x);} 425*7330f729Sjoerg 426*7330f729Sjoerg static long double _Complex 427*7330f729Sjoerg _TG_ATTRS __tg_exp(long double _Complex __x)428*7330f729Sjoerg __tg_exp(long double _Complex __x) {return cexpl(__x);} 429*7330f729Sjoerg 430*7330f729Sjoerg #undef exp 431*7330f729Sjoerg #define exp(__x) __tg_exp(__tg_promote1((__x))(__x)) 432*7330f729Sjoerg 433*7330f729Sjoerg // log 434*7330f729Sjoerg 435*7330f729Sjoerg static float 436*7330f729Sjoerg _TG_ATTRS __tg_log(float __x)437*7330f729Sjoerg __tg_log(float __x) {return logf(__x);} 438*7330f729Sjoerg 439*7330f729Sjoerg static double 440*7330f729Sjoerg _TG_ATTRS __tg_log(double __x)441*7330f729Sjoerg __tg_log(double __x) {return log(__x);} 442*7330f729Sjoerg 443*7330f729Sjoerg static long double 444*7330f729Sjoerg _TG_ATTRS __tg_log(long double __x)445*7330f729Sjoerg __tg_log(long double __x) {return logl(__x);} 446*7330f729Sjoerg 447*7330f729Sjoerg static float _Complex 448*7330f729Sjoerg _TG_ATTRS __tg_log(float _Complex __x)449*7330f729Sjoerg __tg_log(float _Complex __x) {return clogf(__x);} 450*7330f729Sjoerg 451*7330f729Sjoerg static double _Complex 452*7330f729Sjoerg _TG_ATTRS __tg_log(double _Complex __x)453*7330f729Sjoerg __tg_log(double _Complex __x) {return clog(__x);} 454*7330f729Sjoerg 455*7330f729Sjoerg static long double _Complex 456*7330f729Sjoerg _TG_ATTRS __tg_log(long double _Complex __x)457*7330f729Sjoerg __tg_log(long double _Complex __x) {return clogl(__x);} 458*7330f729Sjoerg 459*7330f729Sjoerg #undef log 460*7330f729Sjoerg #define log(__x) __tg_log(__tg_promote1((__x))(__x)) 461*7330f729Sjoerg 462*7330f729Sjoerg // pow 463*7330f729Sjoerg 464*7330f729Sjoerg static float 465*7330f729Sjoerg _TG_ATTRS __tg_pow(float __x,float __y)466*7330f729Sjoerg __tg_pow(float __x, float __y) {return powf(__x, __y);} 467*7330f729Sjoerg 468*7330f729Sjoerg static double 469*7330f729Sjoerg _TG_ATTRS __tg_pow(double __x,double __y)470*7330f729Sjoerg __tg_pow(double __x, double __y) {return pow(__x, __y);} 471*7330f729Sjoerg 472*7330f729Sjoerg static long double 473*7330f729Sjoerg _TG_ATTRS __tg_pow(long double __x,long double __y)474*7330f729Sjoerg __tg_pow(long double __x, long double __y) {return powl(__x, __y);} 475*7330f729Sjoerg 476*7330f729Sjoerg static float _Complex 477*7330f729Sjoerg _TG_ATTRS __tg_pow(float _Complex __x,float _Complex __y)478*7330f729Sjoerg __tg_pow(float _Complex __x, float _Complex __y) {return cpowf(__x, __y);} 479*7330f729Sjoerg 480*7330f729Sjoerg static double _Complex 481*7330f729Sjoerg _TG_ATTRS __tg_pow(double _Complex __x,double _Complex __y)482*7330f729Sjoerg __tg_pow(double _Complex __x, double _Complex __y) {return cpow(__x, __y);} 483*7330f729Sjoerg 484*7330f729Sjoerg static long double _Complex 485*7330f729Sjoerg _TG_ATTRS __tg_pow(long double _Complex __x,long double _Complex __y)486*7330f729Sjoerg __tg_pow(long double _Complex __x, long double _Complex __y) 487*7330f729Sjoerg {return cpowl(__x, __y);} 488*7330f729Sjoerg 489*7330f729Sjoerg #undef pow 490*7330f729Sjoerg #define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \ 491*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 492*7330f729Sjoerg 493*7330f729Sjoerg // sqrt 494*7330f729Sjoerg 495*7330f729Sjoerg static float 496*7330f729Sjoerg _TG_ATTRS __tg_sqrt(float __x)497*7330f729Sjoerg __tg_sqrt(float __x) {return sqrtf(__x);} 498*7330f729Sjoerg 499*7330f729Sjoerg static double 500*7330f729Sjoerg _TG_ATTRS __tg_sqrt(double __x)501*7330f729Sjoerg __tg_sqrt(double __x) {return sqrt(__x);} 502*7330f729Sjoerg 503*7330f729Sjoerg static long double 504*7330f729Sjoerg _TG_ATTRS __tg_sqrt(long double __x)505*7330f729Sjoerg __tg_sqrt(long double __x) {return sqrtl(__x);} 506*7330f729Sjoerg 507*7330f729Sjoerg static float _Complex 508*7330f729Sjoerg _TG_ATTRS __tg_sqrt(float _Complex __x)509*7330f729Sjoerg __tg_sqrt(float _Complex __x) {return csqrtf(__x);} 510*7330f729Sjoerg 511*7330f729Sjoerg static double _Complex 512*7330f729Sjoerg _TG_ATTRS __tg_sqrt(double _Complex __x)513*7330f729Sjoerg __tg_sqrt(double _Complex __x) {return csqrt(__x);} 514*7330f729Sjoerg 515*7330f729Sjoerg static long double _Complex 516*7330f729Sjoerg _TG_ATTRS __tg_sqrt(long double _Complex __x)517*7330f729Sjoerg __tg_sqrt(long double _Complex __x) {return csqrtl(__x);} 518*7330f729Sjoerg 519*7330f729Sjoerg #undef sqrt 520*7330f729Sjoerg #define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x)) 521*7330f729Sjoerg 522*7330f729Sjoerg // fabs 523*7330f729Sjoerg 524*7330f729Sjoerg static float 525*7330f729Sjoerg _TG_ATTRS __tg_fabs(float __x)526*7330f729Sjoerg __tg_fabs(float __x) {return fabsf(__x);} 527*7330f729Sjoerg 528*7330f729Sjoerg static double 529*7330f729Sjoerg _TG_ATTRS __tg_fabs(double __x)530*7330f729Sjoerg __tg_fabs(double __x) {return fabs(__x);} 531*7330f729Sjoerg 532*7330f729Sjoerg static long double 533*7330f729Sjoerg _TG_ATTRS __tg_fabs(long double __x)534*7330f729Sjoerg __tg_fabs(long double __x) {return fabsl(__x);} 535*7330f729Sjoerg 536*7330f729Sjoerg static float 537*7330f729Sjoerg _TG_ATTRS __tg_fabs(float _Complex __x)538*7330f729Sjoerg __tg_fabs(float _Complex __x) {return cabsf(__x);} 539*7330f729Sjoerg 540*7330f729Sjoerg static double 541*7330f729Sjoerg _TG_ATTRS __tg_fabs(double _Complex __x)542*7330f729Sjoerg __tg_fabs(double _Complex __x) {return cabs(__x);} 543*7330f729Sjoerg 544*7330f729Sjoerg static long double 545*7330f729Sjoerg _TG_ATTRS __tg_fabs(long double _Complex __x)546*7330f729Sjoerg __tg_fabs(long double _Complex __x) {return cabsl(__x);} 547*7330f729Sjoerg 548*7330f729Sjoerg #undef fabs 549*7330f729Sjoerg #define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x)) 550*7330f729Sjoerg 551*7330f729Sjoerg // atan2 552*7330f729Sjoerg 553*7330f729Sjoerg static float 554*7330f729Sjoerg _TG_ATTRS __tg_atan2(float __x,float __y)555*7330f729Sjoerg __tg_atan2(float __x, float __y) {return atan2f(__x, __y);} 556*7330f729Sjoerg 557*7330f729Sjoerg static double 558*7330f729Sjoerg _TG_ATTRS __tg_atan2(double __x,double __y)559*7330f729Sjoerg __tg_atan2(double __x, double __y) {return atan2(__x, __y);} 560*7330f729Sjoerg 561*7330f729Sjoerg static long double 562*7330f729Sjoerg _TG_ATTRS __tg_atan2(long double __x,long double __y)563*7330f729Sjoerg __tg_atan2(long double __x, long double __y) {return atan2l(__x, __y);} 564*7330f729Sjoerg 565*7330f729Sjoerg #undef atan2 566*7330f729Sjoerg #define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \ 567*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 568*7330f729Sjoerg 569*7330f729Sjoerg // cbrt 570*7330f729Sjoerg 571*7330f729Sjoerg static float 572*7330f729Sjoerg _TG_ATTRS __tg_cbrt(float __x)573*7330f729Sjoerg __tg_cbrt(float __x) {return cbrtf(__x);} 574*7330f729Sjoerg 575*7330f729Sjoerg static double 576*7330f729Sjoerg _TG_ATTRS __tg_cbrt(double __x)577*7330f729Sjoerg __tg_cbrt(double __x) {return cbrt(__x);} 578*7330f729Sjoerg 579*7330f729Sjoerg static long double 580*7330f729Sjoerg _TG_ATTRS __tg_cbrt(long double __x)581*7330f729Sjoerg __tg_cbrt(long double __x) {return cbrtl(__x);} 582*7330f729Sjoerg 583*7330f729Sjoerg #undef cbrt 584*7330f729Sjoerg #define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x)) 585*7330f729Sjoerg 586*7330f729Sjoerg // ceil 587*7330f729Sjoerg 588*7330f729Sjoerg static float 589*7330f729Sjoerg _TG_ATTRS __tg_ceil(float __x)590*7330f729Sjoerg __tg_ceil(float __x) {return ceilf(__x);} 591*7330f729Sjoerg 592*7330f729Sjoerg static double 593*7330f729Sjoerg _TG_ATTRS __tg_ceil(double __x)594*7330f729Sjoerg __tg_ceil(double __x) {return ceil(__x);} 595*7330f729Sjoerg 596*7330f729Sjoerg static long double 597*7330f729Sjoerg _TG_ATTRS __tg_ceil(long double __x)598*7330f729Sjoerg __tg_ceil(long double __x) {return ceill(__x);} 599*7330f729Sjoerg 600*7330f729Sjoerg #undef ceil 601*7330f729Sjoerg #define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x)) 602*7330f729Sjoerg 603*7330f729Sjoerg // copysign 604*7330f729Sjoerg 605*7330f729Sjoerg static float 606*7330f729Sjoerg _TG_ATTRS __tg_copysign(float __x,float __y)607*7330f729Sjoerg __tg_copysign(float __x, float __y) {return copysignf(__x, __y);} 608*7330f729Sjoerg 609*7330f729Sjoerg static double 610*7330f729Sjoerg _TG_ATTRS __tg_copysign(double __x,double __y)611*7330f729Sjoerg __tg_copysign(double __x, double __y) {return copysign(__x, __y);} 612*7330f729Sjoerg 613*7330f729Sjoerg static long double 614*7330f729Sjoerg _TG_ATTRS __tg_copysign(long double __x,long double __y)615*7330f729Sjoerg __tg_copysign(long double __x, long double __y) {return copysignl(__x, __y);} 616*7330f729Sjoerg 617*7330f729Sjoerg #undef copysign 618*7330f729Sjoerg #define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \ 619*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 620*7330f729Sjoerg 621*7330f729Sjoerg // erf 622*7330f729Sjoerg 623*7330f729Sjoerg static float 624*7330f729Sjoerg _TG_ATTRS __tg_erf(float __x)625*7330f729Sjoerg __tg_erf(float __x) {return erff(__x);} 626*7330f729Sjoerg 627*7330f729Sjoerg static double 628*7330f729Sjoerg _TG_ATTRS __tg_erf(double __x)629*7330f729Sjoerg __tg_erf(double __x) {return erf(__x);} 630*7330f729Sjoerg 631*7330f729Sjoerg static long double 632*7330f729Sjoerg _TG_ATTRS __tg_erf(long double __x)633*7330f729Sjoerg __tg_erf(long double __x) {return erfl(__x);} 634*7330f729Sjoerg 635*7330f729Sjoerg #undef erf 636*7330f729Sjoerg #define erf(__x) __tg_erf(__tg_promote1((__x))(__x)) 637*7330f729Sjoerg 638*7330f729Sjoerg // erfc 639*7330f729Sjoerg 640*7330f729Sjoerg static float 641*7330f729Sjoerg _TG_ATTRS __tg_erfc(float __x)642*7330f729Sjoerg __tg_erfc(float __x) {return erfcf(__x);} 643*7330f729Sjoerg 644*7330f729Sjoerg static double 645*7330f729Sjoerg _TG_ATTRS __tg_erfc(double __x)646*7330f729Sjoerg __tg_erfc(double __x) {return erfc(__x);} 647*7330f729Sjoerg 648*7330f729Sjoerg static long double 649*7330f729Sjoerg _TG_ATTRS __tg_erfc(long double __x)650*7330f729Sjoerg __tg_erfc(long double __x) {return erfcl(__x);} 651*7330f729Sjoerg 652*7330f729Sjoerg #undef erfc 653*7330f729Sjoerg #define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x)) 654*7330f729Sjoerg 655*7330f729Sjoerg // exp2 656*7330f729Sjoerg 657*7330f729Sjoerg static float 658*7330f729Sjoerg _TG_ATTRS __tg_exp2(float __x)659*7330f729Sjoerg __tg_exp2(float __x) {return exp2f(__x);} 660*7330f729Sjoerg 661*7330f729Sjoerg static double 662*7330f729Sjoerg _TG_ATTRS __tg_exp2(double __x)663*7330f729Sjoerg __tg_exp2(double __x) {return exp2(__x);} 664*7330f729Sjoerg 665*7330f729Sjoerg static long double 666*7330f729Sjoerg _TG_ATTRS __tg_exp2(long double __x)667*7330f729Sjoerg __tg_exp2(long double __x) {return exp2l(__x);} 668*7330f729Sjoerg 669*7330f729Sjoerg #undef exp2 670*7330f729Sjoerg #define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x)) 671*7330f729Sjoerg 672*7330f729Sjoerg // expm1 673*7330f729Sjoerg 674*7330f729Sjoerg static float 675*7330f729Sjoerg _TG_ATTRS __tg_expm1(float __x)676*7330f729Sjoerg __tg_expm1(float __x) {return expm1f(__x);} 677*7330f729Sjoerg 678*7330f729Sjoerg static double 679*7330f729Sjoerg _TG_ATTRS __tg_expm1(double __x)680*7330f729Sjoerg __tg_expm1(double __x) {return expm1(__x);} 681*7330f729Sjoerg 682*7330f729Sjoerg static long double 683*7330f729Sjoerg _TG_ATTRS __tg_expm1(long double __x)684*7330f729Sjoerg __tg_expm1(long double __x) {return expm1l(__x);} 685*7330f729Sjoerg 686*7330f729Sjoerg #undef expm1 687*7330f729Sjoerg #define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x)) 688*7330f729Sjoerg 689*7330f729Sjoerg // fdim 690*7330f729Sjoerg 691*7330f729Sjoerg static float 692*7330f729Sjoerg _TG_ATTRS __tg_fdim(float __x,float __y)693*7330f729Sjoerg __tg_fdim(float __x, float __y) {return fdimf(__x, __y);} 694*7330f729Sjoerg 695*7330f729Sjoerg static double 696*7330f729Sjoerg _TG_ATTRS __tg_fdim(double __x,double __y)697*7330f729Sjoerg __tg_fdim(double __x, double __y) {return fdim(__x, __y);} 698*7330f729Sjoerg 699*7330f729Sjoerg static long double 700*7330f729Sjoerg _TG_ATTRS __tg_fdim(long double __x,long double __y)701*7330f729Sjoerg __tg_fdim(long double __x, long double __y) {return fdiml(__x, __y);} 702*7330f729Sjoerg 703*7330f729Sjoerg #undef fdim 704*7330f729Sjoerg #define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \ 705*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 706*7330f729Sjoerg 707*7330f729Sjoerg // floor 708*7330f729Sjoerg 709*7330f729Sjoerg static float 710*7330f729Sjoerg _TG_ATTRS __tg_floor(float __x)711*7330f729Sjoerg __tg_floor(float __x) {return floorf(__x);} 712*7330f729Sjoerg 713*7330f729Sjoerg static double 714*7330f729Sjoerg _TG_ATTRS __tg_floor(double __x)715*7330f729Sjoerg __tg_floor(double __x) {return floor(__x);} 716*7330f729Sjoerg 717*7330f729Sjoerg static long double 718*7330f729Sjoerg _TG_ATTRS __tg_floor(long double __x)719*7330f729Sjoerg __tg_floor(long double __x) {return floorl(__x);} 720*7330f729Sjoerg 721*7330f729Sjoerg #undef floor 722*7330f729Sjoerg #define floor(__x) __tg_floor(__tg_promote1((__x))(__x)) 723*7330f729Sjoerg 724*7330f729Sjoerg // fma 725*7330f729Sjoerg 726*7330f729Sjoerg static float 727*7330f729Sjoerg _TG_ATTRS __tg_fma(float __x,float __y,float __z)728*7330f729Sjoerg __tg_fma(float __x, float __y, float __z) 729*7330f729Sjoerg {return fmaf(__x, __y, __z);} 730*7330f729Sjoerg 731*7330f729Sjoerg static double 732*7330f729Sjoerg _TG_ATTRS __tg_fma(double __x,double __y,double __z)733*7330f729Sjoerg __tg_fma(double __x, double __y, double __z) 734*7330f729Sjoerg {return fma(__x, __y, __z);} 735*7330f729Sjoerg 736*7330f729Sjoerg static long double 737*7330f729Sjoerg _TG_ATTRS __tg_fma(long double __x,long double __y,long double __z)738*7330f729Sjoerg __tg_fma(long double __x,long double __y, long double __z) 739*7330f729Sjoerg {return fmal(__x, __y, __z);} 740*7330f729Sjoerg 741*7330f729Sjoerg #undef fma 742*7330f729Sjoerg #define fma(__x, __y, __z) \ 743*7330f729Sjoerg __tg_fma(__tg_promote3((__x), (__y), (__z))(__x), \ 744*7330f729Sjoerg __tg_promote3((__x), (__y), (__z))(__y), \ 745*7330f729Sjoerg __tg_promote3((__x), (__y), (__z))(__z)) 746*7330f729Sjoerg 747*7330f729Sjoerg // fmax 748*7330f729Sjoerg 749*7330f729Sjoerg static float 750*7330f729Sjoerg _TG_ATTRS __tg_fmax(float __x,float __y)751*7330f729Sjoerg __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);} 752*7330f729Sjoerg 753*7330f729Sjoerg static double 754*7330f729Sjoerg _TG_ATTRS __tg_fmax(double __x,double __y)755*7330f729Sjoerg __tg_fmax(double __x, double __y) {return fmax(__x, __y);} 756*7330f729Sjoerg 757*7330f729Sjoerg static long double 758*7330f729Sjoerg _TG_ATTRS __tg_fmax(long double __x,long double __y)759*7330f729Sjoerg __tg_fmax(long double __x, long double __y) {return fmaxl(__x, __y);} 760*7330f729Sjoerg 761*7330f729Sjoerg #undef fmax 762*7330f729Sjoerg #define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \ 763*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 764*7330f729Sjoerg 765*7330f729Sjoerg // fmin 766*7330f729Sjoerg 767*7330f729Sjoerg static float 768*7330f729Sjoerg _TG_ATTRS __tg_fmin(float __x,float __y)769*7330f729Sjoerg __tg_fmin(float __x, float __y) {return fminf(__x, __y);} 770*7330f729Sjoerg 771*7330f729Sjoerg static double 772*7330f729Sjoerg _TG_ATTRS __tg_fmin(double __x,double __y)773*7330f729Sjoerg __tg_fmin(double __x, double __y) {return fmin(__x, __y);} 774*7330f729Sjoerg 775*7330f729Sjoerg static long double 776*7330f729Sjoerg _TG_ATTRS __tg_fmin(long double __x,long double __y)777*7330f729Sjoerg __tg_fmin(long double __x, long double __y) {return fminl(__x, __y);} 778*7330f729Sjoerg 779*7330f729Sjoerg #undef fmin 780*7330f729Sjoerg #define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \ 781*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 782*7330f729Sjoerg 783*7330f729Sjoerg // fmod 784*7330f729Sjoerg 785*7330f729Sjoerg static float 786*7330f729Sjoerg _TG_ATTRS __tg_fmod(float __x,float __y)787*7330f729Sjoerg __tg_fmod(float __x, float __y) {return fmodf(__x, __y);} 788*7330f729Sjoerg 789*7330f729Sjoerg static double 790*7330f729Sjoerg _TG_ATTRS __tg_fmod(double __x,double __y)791*7330f729Sjoerg __tg_fmod(double __x, double __y) {return fmod(__x, __y);} 792*7330f729Sjoerg 793*7330f729Sjoerg static long double 794*7330f729Sjoerg _TG_ATTRS __tg_fmod(long double __x,long double __y)795*7330f729Sjoerg __tg_fmod(long double __x, long double __y) {return fmodl(__x, __y);} 796*7330f729Sjoerg 797*7330f729Sjoerg #undef fmod 798*7330f729Sjoerg #define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \ 799*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 800*7330f729Sjoerg 801*7330f729Sjoerg // frexp 802*7330f729Sjoerg 803*7330f729Sjoerg static float 804*7330f729Sjoerg _TG_ATTRS __tg_frexp(float __x,int * __y)805*7330f729Sjoerg __tg_frexp(float __x, int* __y) {return frexpf(__x, __y);} 806*7330f729Sjoerg 807*7330f729Sjoerg static double 808*7330f729Sjoerg _TG_ATTRS __tg_frexp(double __x,int * __y)809*7330f729Sjoerg __tg_frexp(double __x, int* __y) {return frexp(__x, __y);} 810*7330f729Sjoerg 811*7330f729Sjoerg static long double 812*7330f729Sjoerg _TG_ATTRS __tg_frexp(long double __x,int * __y)813*7330f729Sjoerg __tg_frexp(long double __x, int* __y) {return frexpl(__x, __y);} 814*7330f729Sjoerg 815*7330f729Sjoerg #undef frexp 816*7330f729Sjoerg #define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y) 817*7330f729Sjoerg 818*7330f729Sjoerg // hypot 819*7330f729Sjoerg 820*7330f729Sjoerg static float 821*7330f729Sjoerg _TG_ATTRS __tg_hypot(float __x,float __y)822*7330f729Sjoerg __tg_hypot(float __x, float __y) {return hypotf(__x, __y);} 823*7330f729Sjoerg 824*7330f729Sjoerg static double 825*7330f729Sjoerg _TG_ATTRS __tg_hypot(double __x,double __y)826*7330f729Sjoerg __tg_hypot(double __x, double __y) {return hypot(__x, __y);} 827*7330f729Sjoerg 828*7330f729Sjoerg static long double 829*7330f729Sjoerg _TG_ATTRS __tg_hypot(long double __x,long double __y)830*7330f729Sjoerg __tg_hypot(long double __x, long double __y) {return hypotl(__x, __y);} 831*7330f729Sjoerg 832*7330f729Sjoerg #undef hypot 833*7330f729Sjoerg #define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \ 834*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 835*7330f729Sjoerg 836*7330f729Sjoerg // ilogb 837*7330f729Sjoerg 838*7330f729Sjoerg static int 839*7330f729Sjoerg _TG_ATTRS __tg_ilogb(float __x)840*7330f729Sjoerg __tg_ilogb(float __x) {return ilogbf(__x);} 841*7330f729Sjoerg 842*7330f729Sjoerg static int 843*7330f729Sjoerg _TG_ATTRS __tg_ilogb(double __x)844*7330f729Sjoerg __tg_ilogb(double __x) {return ilogb(__x);} 845*7330f729Sjoerg 846*7330f729Sjoerg static int 847*7330f729Sjoerg _TG_ATTRS __tg_ilogb(long double __x)848*7330f729Sjoerg __tg_ilogb(long double __x) {return ilogbl(__x);} 849*7330f729Sjoerg 850*7330f729Sjoerg #undef ilogb 851*7330f729Sjoerg #define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x)) 852*7330f729Sjoerg 853*7330f729Sjoerg // ldexp 854*7330f729Sjoerg 855*7330f729Sjoerg static float 856*7330f729Sjoerg _TG_ATTRS __tg_ldexp(float __x,int __y)857*7330f729Sjoerg __tg_ldexp(float __x, int __y) {return ldexpf(__x, __y);} 858*7330f729Sjoerg 859*7330f729Sjoerg static double 860*7330f729Sjoerg _TG_ATTRS __tg_ldexp(double __x,int __y)861*7330f729Sjoerg __tg_ldexp(double __x, int __y) {return ldexp(__x, __y);} 862*7330f729Sjoerg 863*7330f729Sjoerg static long double 864*7330f729Sjoerg _TG_ATTRS __tg_ldexp(long double __x,int __y)865*7330f729Sjoerg __tg_ldexp(long double __x, int __y) {return ldexpl(__x, __y);} 866*7330f729Sjoerg 867*7330f729Sjoerg #undef ldexp 868*7330f729Sjoerg #define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y) 869*7330f729Sjoerg 870*7330f729Sjoerg // lgamma 871*7330f729Sjoerg 872*7330f729Sjoerg static float 873*7330f729Sjoerg _TG_ATTRS __tg_lgamma(float __x)874*7330f729Sjoerg __tg_lgamma(float __x) {return lgammaf(__x);} 875*7330f729Sjoerg 876*7330f729Sjoerg static double 877*7330f729Sjoerg _TG_ATTRS __tg_lgamma(double __x)878*7330f729Sjoerg __tg_lgamma(double __x) {return lgamma(__x);} 879*7330f729Sjoerg 880*7330f729Sjoerg static long double 881*7330f729Sjoerg _TG_ATTRS __tg_lgamma(long double __x)882*7330f729Sjoerg __tg_lgamma(long double __x) {return lgammal(__x);} 883*7330f729Sjoerg 884*7330f729Sjoerg #undef lgamma 885*7330f729Sjoerg #define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x)) 886*7330f729Sjoerg 887*7330f729Sjoerg // llrint 888*7330f729Sjoerg 889*7330f729Sjoerg static long long 890*7330f729Sjoerg _TG_ATTRS __tg_llrint(float __x)891*7330f729Sjoerg __tg_llrint(float __x) {return llrintf(__x);} 892*7330f729Sjoerg 893*7330f729Sjoerg static long long 894*7330f729Sjoerg _TG_ATTRS __tg_llrint(double __x)895*7330f729Sjoerg __tg_llrint(double __x) {return llrint(__x);} 896*7330f729Sjoerg 897*7330f729Sjoerg static long long 898*7330f729Sjoerg _TG_ATTRS __tg_llrint(long double __x)899*7330f729Sjoerg __tg_llrint(long double __x) {return llrintl(__x);} 900*7330f729Sjoerg 901*7330f729Sjoerg #undef llrint 902*7330f729Sjoerg #define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x)) 903*7330f729Sjoerg 904*7330f729Sjoerg // llround 905*7330f729Sjoerg 906*7330f729Sjoerg static long long 907*7330f729Sjoerg _TG_ATTRS __tg_llround(float __x)908*7330f729Sjoerg __tg_llround(float __x) {return llroundf(__x);} 909*7330f729Sjoerg 910*7330f729Sjoerg static long long 911*7330f729Sjoerg _TG_ATTRS __tg_llround(double __x)912*7330f729Sjoerg __tg_llround(double __x) {return llround(__x);} 913*7330f729Sjoerg 914*7330f729Sjoerg static long long 915*7330f729Sjoerg _TG_ATTRS __tg_llround(long double __x)916*7330f729Sjoerg __tg_llround(long double __x) {return llroundl(__x);} 917*7330f729Sjoerg 918*7330f729Sjoerg #undef llround 919*7330f729Sjoerg #define llround(__x) __tg_llround(__tg_promote1((__x))(__x)) 920*7330f729Sjoerg 921*7330f729Sjoerg // log10 922*7330f729Sjoerg 923*7330f729Sjoerg static float 924*7330f729Sjoerg _TG_ATTRS __tg_log10(float __x)925*7330f729Sjoerg __tg_log10(float __x) {return log10f(__x);} 926*7330f729Sjoerg 927*7330f729Sjoerg static double 928*7330f729Sjoerg _TG_ATTRS __tg_log10(double __x)929*7330f729Sjoerg __tg_log10(double __x) {return log10(__x);} 930*7330f729Sjoerg 931*7330f729Sjoerg static long double 932*7330f729Sjoerg _TG_ATTRS __tg_log10(long double __x)933*7330f729Sjoerg __tg_log10(long double __x) {return log10l(__x);} 934*7330f729Sjoerg 935*7330f729Sjoerg #undef log10 936*7330f729Sjoerg #define log10(__x) __tg_log10(__tg_promote1((__x))(__x)) 937*7330f729Sjoerg 938*7330f729Sjoerg // log1p 939*7330f729Sjoerg 940*7330f729Sjoerg static float 941*7330f729Sjoerg _TG_ATTRS __tg_log1p(float __x)942*7330f729Sjoerg __tg_log1p(float __x) {return log1pf(__x);} 943*7330f729Sjoerg 944*7330f729Sjoerg static double 945*7330f729Sjoerg _TG_ATTRS __tg_log1p(double __x)946*7330f729Sjoerg __tg_log1p(double __x) {return log1p(__x);} 947*7330f729Sjoerg 948*7330f729Sjoerg static long double 949*7330f729Sjoerg _TG_ATTRS __tg_log1p(long double __x)950*7330f729Sjoerg __tg_log1p(long double __x) {return log1pl(__x);} 951*7330f729Sjoerg 952*7330f729Sjoerg #undef log1p 953*7330f729Sjoerg #define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x)) 954*7330f729Sjoerg 955*7330f729Sjoerg // log2 956*7330f729Sjoerg 957*7330f729Sjoerg static float 958*7330f729Sjoerg _TG_ATTRS __tg_log2(float __x)959*7330f729Sjoerg __tg_log2(float __x) {return log2f(__x);} 960*7330f729Sjoerg 961*7330f729Sjoerg static double 962*7330f729Sjoerg _TG_ATTRS __tg_log2(double __x)963*7330f729Sjoerg __tg_log2(double __x) {return log2(__x);} 964*7330f729Sjoerg 965*7330f729Sjoerg static long double 966*7330f729Sjoerg _TG_ATTRS __tg_log2(long double __x)967*7330f729Sjoerg __tg_log2(long double __x) {return log2l(__x);} 968*7330f729Sjoerg 969*7330f729Sjoerg #undef log2 970*7330f729Sjoerg #define log2(__x) __tg_log2(__tg_promote1((__x))(__x)) 971*7330f729Sjoerg 972*7330f729Sjoerg // logb 973*7330f729Sjoerg 974*7330f729Sjoerg static float 975*7330f729Sjoerg _TG_ATTRS __tg_logb(float __x)976*7330f729Sjoerg __tg_logb(float __x) {return logbf(__x);} 977*7330f729Sjoerg 978*7330f729Sjoerg static double 979*7330f729Sjoerg _TG_ATTRS __tg_logb(double __x)980*7330f729Sjoerg __tg_logb(double __x) {return logb(__x);} 981*7330f729Sjoerg 982*7330f729Sjoerg static long double 983*7330f729Sjoerg _TG_ATTRS __tg_logb(long double __x)984*7330f729Sjoerg __tg_logb(long double __x) {return logbl(__x);} 985*7330f729Sjoerg 986*7330f729Sjoerg #undef logb 987*7330f729Sjoerg #define logb(__x) __tg_logb(__tg_promote1((__x))(__x)) 988*7330f729Sjoerg 989*7330f729Sjoerg // lrint 990*7330f729Sjoerg 991*7330f729Sjoerg static long 992*7330f729Sjoerg _TG_ATTRS __tg_lrint(float __x)993*7330f729Sjoerg __tg_lrint(float __x) {return lrintf(__x);} 994*7330f729Sjoerg 995*7330f729Sjoerg static long 996*7330f729Sjoerg _TG_ATTRS __tg_lrint(double __x)997*7330f729Sjoerg __tg_lrint(double __x) {return lrint(__x);} 998*7330f729Sjoerg 999*7330f729Sjoerg static long 1000*7330f729Sjoerg _TG_ATTRS __tg_lrint(long double __x)1001*7330f729Sjoerg __tg_lrint(long double __x) {return lrintl(__x);} 1002*7330f729Sjoerg 1003*7330f729Sjoerg #undef lrint 1004*7330f729Sjoerg #define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x)) 1005*7330f729Sjoerg 1006*7330f729Sjoerg // lround 1007*7330f729Sjoerg 1008*7330f729Sjoerg static long 1009*7330f729Sjoerg _TG_ATTRS __tg_lround(float __x)1010*7330f729Sjoerg __tg_lround(float __x) {return lroundf(__x);} 1011*7330f729Sjoerg 1012*7330f729Sjoerg static long 1013*7330f729Sjoerg _TG_ATTRS __tg_lround(double __x)1014*7330f729Sjoerg __tg_lround(double __x) {return lround(__x);} 1015*7330f729Sjoerg 1016*7330f729Sjoerg static long 1017*7330f729Sjoerg _TG_ATTRS __tg_lround(long double __x)1018*7330f729Sjoerg __tg_lround(long double __x) {return lroundl(__x);} 1019*7330f729Sjoerg 1020*7330f729Sjoerg #undef lround 1021*7330f729Sjoerg #define lround(__x) __tg_lround(__tg_promote1((__x))(__x)) 1022*7330f729Sjoerg 1023*7330f729Sjoerg // nearbyint 1024*7330f729Sjoerg 1025*7330f729Sjoerg static float 1026*7330f729Sjoerg _TG_ATTRS __tg_nearbyint(float __x)1027*7330f729Sjoerg __tg_nearbyint(float __x) {return nearbyintf(__x);} 1028*7330f729Sjoerg 1029*7330f729Sjoerg static double 1030*7330f729Sjoerg _TG_ATTRS __tg_nearbyint(double __x)1031*7330f729Sjoerg __tg_nearbyint(double __x) {return nearbyint(__x);} 1032*7330f729Sjoerg 1033*7330f729Sjoerg static long double 1034*7330f729Sjoerg _TG_ATTRS __tg_nearbyint(long double __x)1035*7330f729Sjoerg __tg_nearbyint(long double __x) {return nearbyintl(__x);} 1036*7330f729Sjoerg 1037*7330f729Sjoerg #undef nearbyint 1038*7330f729Sjoerg #define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x)) 1039*7330f729Sjoerg 1040*7330f729Sjoerg // nextafter 1041*7330f729Sjoerg 1042*7330f729Sjoerg static float 1043*7330f729Sjoerg _TG_ATTRS __tg_nextafter(float __x,float __y)1044*7330f729Sjoerg __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);} 1045*7330f729Sjoerg 1046*7330f729Sjoerg static double 1047*7330f729Sjoerg _TG_ATTRS __tg_nextafter(double __x,double __y)1048*7330f729Sjoerg __tg_nextafter(double __x, double __y) {return nextafter(__x, __y);} 1049*7330f729Sjoerg 1050*7330f729Sjoerg static long double 1051*7330f729Sjoerg _TG_ATTRS __tg_nextafter(long double __x,long double __y)1052*7330f729Sjoerg __tg_nextafter(long double __x, long double __y) {return nextafterl(__x, __y);} 1053*7330f729Sjoerg 1054*7330f729Sjoerg #undef nextafter 1055*7330f729Sjoerg #define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \ 1056*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 1057*7330f729Sjoerg 1058*7330f729Sjoerg // nexttoward 1059*7330f729Sjoerg 1060*7330f729Sjoerg static float 1061*7330f729Sjoerg _TG_ATTRS __tg_nexttoward(float __x,long double __y)1062*7330f729Sjoerg __tg_nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);} 1063*7330f729Sjoerg 1064*7330f729Sjoerg static double 1065*7330f729Sjoerg _TG_ATTRS __tg_nexttoward(double __x,long double __y)1066*7330f729Sjoerg __tg_nexttoward(double __x, long double __y) {return nexttoward(__x, __y);} 1067*7330f729Sjoerg 1068*7330f729Sjoerg static long double 1069*7330f729Sjoerg _TG_ATTRS __tg_nexttoward(long double __x,long double __y)1070*7330f729Sjoerg __tg_nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);} 1071*7330f729Sjoerg 1072*7330f729Sjoerg #undef nexttoward 1073*7330f729Sjoerg #define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y)) 1074*7330f729Sjoerg 1075*7330f729Sjoerg // remainder 1076*7330f729Sjoerg 1077*7330f729Sjoerg static float 1078*7330f729Sjoerg _TG_ATTRS __tg_remainder(float __x,float __y)1079*7330f729Sjoerg __tg_remainder(float __x, float __y) {return remainderf(__x, __y);} 1080*7330f729Sjoerg 1081*7330f729Sjoerg static double 1082*7330f729Sjoerg _TG_ATTRS __tg_remainder(double __x,double __y)1083*7330f729Sjoerg __tg_remainder(double __x, double __y) {return remainder(__x, __y);} 1084*7330f729Sjoerg 1085*7330f729Sjoerg static long double 1086*7330f729Sjoerg _TG_ATTRS __tg_remainder(long double __x,long double __y)1087*7330f729Sjoerg __tg_remainder(long double __x, long double __y) {return remainderl(__x, __y);} 1088*7330f729Sjoerg 1089*7330f729Sjoerg #undef remainder 1090*7330f729Sjoerg #define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \ 1091*7330f729Sjoerg __tg_promote2((__x), (__y))(__y)) 1092*7330f729Sjoerg 1093*7330f729Sjoerg // remquo 1094*7330f729Sjoerg 1095*7330f729Sjoerg static float 1096*7330f729Sjoerg _TG_ATTRS __tg_remquo(float __x,float __y,int * __z)1097*7330f729Sjoerg __tg_remquo(float __x, float __y, int* __z) 1098*7330f729Sjoerg {return remquof(__x, __y, __z);} 1099*7330f729Sjoerg 1100*7330f729Sjoerg static double 1101*7330f729Sjoerg _TG_ATTRS __tg_remquo(double __x,double __y,int * __z)1102*7330f729Sjoerg __tg_remquo(double __x, double __y, int* __z) 1103*7330f729Sjoerg {return remquo(__x, __y, __z);} 1104*7330f729Sjoerg 1105*7330f729Sjoerg static long double 1106*7330f729Sjoerg _TG_ATTRS __tg_remquo(long double __x,long double __y,int * __z)1107*7330f729Sjoerg __tg_remquo(long double __x,long double __y, int* __z) 1108*7330f729Sjoerg {return remquol(__x, __y, __z);} 1109*7330f729Sjoerg 1110*7330f729Sjoerg #undef remquo 1111*7330f729Sjoerg #define remquo(__x, __y, __z) \ 1112*7330f729Sjoerg __tg_remquo(__tg_promote2((__x), (__y))(__x), \ 1113*7330f729Sjoerg __tg_promote2((__x), (__y))(__y), \ 1114*7330f729Sjoerg (__z)) 1115*7330f729Sjoerg 1116*7330f729Sjoerg // rint 1117*7330f729Sjoerg 1118*7330f729Sjoerg static float 1119*7330f729Sjoerg _TG_ATTRS __tg_rint(float __x)1120*7330f729Sjoerg __tg_rint(float __x) {return rintf(__x);} 1121*7330f729Sjoerg 1122*7330f729Sjoerg static double 1123*7330f729Sjoerg _TG_ATTRS __tg_rint(double __x)1124*7330f729Sjoerg __tg_rint(double __x) {return rint(__x);} 1125*7330f729Sjoerg 1126*7330f729Sjoerg static long double 1127*7330f729Sjoerg _TG_ATTRS __tg_rint(long double __x)1128*7330f729Sjoerg __tg_rint(long double __x) {return rintl(__x);} 1129*7330f729Sjoerg 1130*7330f729Sjoerg #undef rint 1131*7330f729Sjoerg #define rint(__x) __tg_rint(__tg_promote1((__x))(__x)) 1132*7330f729Sjoerg 1133*7330f729Sjoerg // round 1134*7330f729Sjoerg 1135*7330f729Sjoerg static float 1136*7330f729Sjoerg _TG_ATTRS __tg_round(float __x)1137*7330f729Sjoerg __tg_round(float __x) {return roundf(__x);} 1138*7330f729Sjoerg 1139*7330f729Sjoerg static double 1140*7330f729Sjoerg _TG_ATTRS __tg_round(double __x)1141*7330f729Sjoerg __tg_round(double __x) {return round(__x);} 1142*7330f729Sjoerg 1143*7330f729Sjoerg static long double 1144*7330f729Sjoerg _TG_ATTRS __tg_round(long double __x)1145*7330f729Sjoerg __tg_round(long double __x) {return roundl(__x);} 1146*7330f729Sjoerg 1147*7330f729Sjoerg #undef round 1148*7330f729Sjoerg #define round(__x) __tg_round(__tg_promote1((__x))(__x)) 1149*7330f729Sjoerg 1150*7330f729Sjoerg // scalbn 1151*7330f729Sjoerg 1152*7330f729Sjoerg static float 1153*7330f729Sjoerg _TG_ATTRS __tg_scalbn(float __x,int __y)1154*7330f729Sjoerg __tg_scalbn(float __x, int __y) {return scalbnf(__x, __y);} 1155*7330f729Sjoerg 1156*7330f729Sjoerg static double 1157*7330f729Sjoerg _TG_ATTRS __tg_scalbn(double __x,int __y)1158*7330f729Sjoerg __tg_scalbn(double __x, int __y) {return scalbn(__x, __y);} 1159*7330f729Sjoerg 1160*7330f729Sjoerg static long double 1161*7330f729Sjoerg _TG_ATTRS __tg_scalbn(long double __x,int __y)1162*7330f729Sjoerg __tg_scalbn(long double __x, int __y) {return scalbnl(__x, __y);} 1163*7330f729Sjoerg 1164*7330f729Sjoerg #undef scalbn 1165*7330f729Sjoerg #define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y) 1166*7330f729Sjoerg 1167*7330f729Sjoerg // scalbln 1168*7330f729Sjoerg 1169*7330f729Sjoerg static float 1170*7330f729Sjoerg _TG_ATTRS __tg_scalbln(float __x,long __y)1171*7330f729Sjoerg __tg_scalbln(float __x, long __y) {return scalblnf(__x, __y);} 1172*7330f729Sjoerg 1173*7330f729Sjoerg static double 1174*7330f729Sjoerg _TG_ATTRS __tg_scalbln(double __x,long __y)1175*7330f729Sjoerg __tg_scalbln(double __x, long __y) {return scalbln(__x, __y);} 1176*7330f729Sjoerg 1177*7330f729Sjoerg static long double 1178*7330f729Sjoerg _TG_ATTRS __tg_scalbln(long double __x,long __y)1179*7330f729Sjoerg __tg_scalbln(long double __x, long __y) {return scalblnl(__x, __y);} 1180*7330f729Sjoerg 1181*7330f729Sjoerg #undef scalbln 1182*7330f729Sjoerg #define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y) 1183*7330f729Sjoerg 1184*7330f729Sjoerg // tgamma 1185*7330f729Sjoerg 1186*7330f729Sjoerg static float 1187*7330f729Sjoerg _TG_ATTRS __tg_tgamma(float __x)1188*7330f729Sjoerg __tg_tgamma(float __x) {return tgammaf(__x);} 1189*7330f729Sjoerg 1190*7330f729Sjoerg static double 1191*7330f729Sjoerg _TG_ATTRS __tg_tgamma(double __x)1192*7330f729Sjoerg __tg_tgamma(double __x) {return tgamma(__x);} 1193*7330f729Sjoerg 1194*7330f729Sjoerg static long double 1195*7330f729Sjoerg _TG_ATTRS __tg_tgamma(long double __x)1196*7330f729Sjoerg __tg_tgamma(long double __x) {return tgammal(__x);} 1197*7330f729Sjoerg 1198*7330f729Sjoerg #undef tgamma 1199*7330f729Sjoerg #define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x)) 1200*7330f729Sjoerg 1201*7330f729Sjoerg // trunc 1202*7330f729Sjoerg 1203*7330f729Sjoerg static float 1204*7330f729Sjoerg _TG_ATTRS __tg_trunc(float __x)1205*7330f729Sjoerg __tg_trunc(float __x) {return truncf(__x);} 1206*7330f729Sjoerg 1207*7330f729Sjoerg static double 1208*7330f729Sjoerg _TG_ATTRS __tg_trunc(double __x)1209*7330f729Sjoerg __tg_trunc(double __x) {return trunc(__x);} 1210*7330f729Sjoerg 1211*7330f729Sjoerg static long double 1212*7330f729Sjoerg _TG_ATTRS __tg_trunc(long double __x)1213*7330f729Sjoerg __tg_trunc(long double __x) {return truncl(__x);} 1214*7330f729Sjoerg 1215*7330f729Sjoerg #undef trunc 1216*7330f729Sjoerg #define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x)) 1217*7330f729Sjoerg 1218*7330f729Sjoerg // carg 1219*7330f729Sjoerg 1220*7330f729Sjoerg static float 1221*7330f729Sjoerg _TG_ATTRS __tg_carg(float __x)1222*7330f729Sjoerg __tg_carg(float __x) {return atan2f(0.F, __x);} 1223*7330f729Sjoerg 1224*7330f729Sjoerg static double 1225*7330f729Sjoerg _TG_ATTRS __tg_carg(double __x)1226*7330f729Sjoerg __tg_carg(double __x) {return atan2(0., __x);} 1227*7330f729Sjoerg 1228*7330f729Sjoerg static long double 1229*7330f729Sjoerg _TG_ATTRS __tg_carg(long double __x)1230*7330f729Sjoerg __tg_carg(long double __x) {return atan2l(0.L, __x);} 1231*7330f729Sjoerg 1232*7330f729Sjoerg static float 1233*7330f729Sjoerg _TG_ATTRS __tg_carg(float _Complex __x)1234*7330f729Sjoerg __tg_carg(float _Complex __x) {return cargf(__x);} 1235*7330f729Sjoerg 1236*7330f729Sjoerg static double 1237*7330f729Sjoerg _TG_ATTRS __tg_carg(double _Complex __x)1238*7330f729Sjoerg __tg_carg(double _Complex __x) {return carg(__x);} 1239*7330f729Sjoerg 1240*7330f729Sjoerg static long double 1241*7330f729Sjoerg _TG_ATTRS __tg_carg(long double _Complex __x)1242*7330f729Sjoerg __tg_carg(long double _Complex __x) {return cargl(__x);} 1243*7330f729Sjoerg 1244*7330f729Sjoerg #undef carg 1245*7330f729Sjoerg #define carg(__x) __tg_carg(__tg_promote1((__x))(__x)) 1246*7330f729Sjoerg 1247*7330f729Sjoerg // cimag 1248*7330f729Sjoerg 1249*7330f729Sjoerg static float 1250*7330f729Sjoerg _TG_ATTRS __tg_cimag(float __x)1251*7330f729Sjoerg __tg_cimag(float __x) {return 0;} 1252*7330f729Sjoerg 1253*7330f729Sjoerg static double 1254*7330f729Sjoerg _TG_ATTRS __tg_cimag(double __x)1255*7330f729Sjoerg __tg_cimag(double __x) {return 0;} 1256*7330f729Sjoerg 1257*7330f729Sjoerg static long double 1258*7330f729Sjoerg _TG_ATTRS __tg_cimag(long double __x)1259*7330f729Sjoerg __tg_cimag(long double __x) {return 0;} 1260*7330f729Sjoerg 1261*7330f729Sjoerg static float 1262*7330f729Sjoerg _TG_ATTRS __tg_cimag(float _Complex __x)1263*7330f729Sjoerg __tg_cimag(float _Complex __x) {return cimagf(__x);} 1264*7330f729Sjoerg 1265*7330f729Sjoerg static double 1266*7330f729Sjoerg _TG_ATTRS __tg_cimag(double _Complex __x)1267*7330f729Sjoerg __tg_cimag(double _Complex __x) {return cimag(__x);} 1268*7330f729Sjoerg 1269*7330f729Sjoerg static long double 1270*7330f729Sjoerg _TG_ATTRS __tg_cimag(long double _Complex __x)1271*7330f729Sjoerg __tg_cimag(long double _Complex __x) {return cimagl(__x);} 1272*7330f729Sjoerg 1273*7330f729Sjoerg #undef cimag 1274*7330f729Sjoerg #define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x)) 1275*7330f729Sjoerg 1276*7330f729Sjoerg // conj 1277*7330f729Sjoerg 1278*7330f729Sjoerg static float _Complex 1279*7330f729Sjoerg _TG_ATTRS __tg_conj(float __x)1280*7330f729Sjoerg __tg_conj(float __x) {return __x;} 1281*7330f729Sjoerg 1282*7330f729Sjoerg static double _Complex 1283*7330f729Sjoerg _TG_ATTRS __tg_conj(double __x)1284*7330f729Sjoerg __tg_conj(double __x) {return __x;} 1285*7330f729Sjoerg 1286*7330f729Sjoerg static long double _Complex 1287*7330f729Sjoerg _TG_ATTRS __tg_conj(long double __x)1288*7330f729Sjoerg __tg_conj(long double __x) {return __x;} 1289*7330f729Sjoerg 1290*7330f729Sjoerg static float _Complex 1291*7330f729Sjoerg _TG_ATTRS __tg_conj(float _Complex __x)1292*7330f729Sjoerg __tg_conj(float _Complex __x) {return conjf(__x);} 1293*7330f729Sjoerg 1294*7330f729Sjoerg static double _Complex 1295*7330f729Sjoerg _TG_ATTRS __tg_conj(double _Complex __x)1296*7330f729Sjoerg __tg_conj(double _Complex __x) {return conj(__x);} 1297*7330f729Sjoerg 1298*7330f729Sjoerg static long double _Complex 1299*7330f729Sjoerg _TG_ATTRS __tg_conj(long double _Complex __x)1300*7330f729Sjoerg __tg_conj(long double _Complex __x) {return conjl(__x);} 1301*7330f729Sjoerg 1302*7330f729Sjoerg #undef conj 1303*7330f729Sjoerg #define conj(__x) __tg_conj(__tg_promote1((__x))(__x)) 1304*7330f729Sjoerg 1305*7330f729Sjoerg // cproj 1306*7330f729Sjoerg 1307*7330f729Sjoerg static float _Complex 1308*7330f729Sjoerg _TG_ATTRS __tg_cproj(float __x)1309*7330f729Sjoerg __tg_cproj(float __x) {return cprojf(__x);} 1310*7330f729Sjoerg 1311*7330f729Sjoerg static double _Complex 1312*7330f729Sjoerg _TG_ATTRS __tg_cproj(double __x)1313*7330f729Sjoerg __tg_cproj(double __x) {return cproj(__x);} 1314*7330f729Sjoerg 1315*7330f729Sjoerg static long double _Complex 1316*7330f729Sjoerg _TG_ATTRS __tg_cproj(long double __x)1317*7330f729Sjoerg __tg_cproj(long double __x) {return cprojl(__x);} 1318*7330f729Sjoerg 1319*7330f729Sjoerg static float _Complex 1320*7330f729Sjoerg _TG_ATTRS __tg_cproj(float _Complex __x)1321*7330f729Sjoerg __tg_cproj(float _Complex __x) {return cprojf(__x);} 1322*7330f729Sjoerg 1323*7330f729Sjoerg static double _Complex 1324*7330f729Sjoerg _TG_ATTRS __tg_cproj(double _Complex __x)1325*7330f729Sjoerg __tg_cproj(double _Complex __x) {return cproj(__x);} 1326*7330f729Sjoerg 1327*7330f729Sjoerg static long double _Complex 1328*7330f729Sjoerg _TG_ATTRS __tg_cproj(long double _Complex __x)1329*7330f729Sjoerg __tg_cproj(long double _Complex __x) {return cprojl(__x);} 1330*7330f729Sjoerg 1331*7330f729Sjoerg #undef cproj 1332*7330f729Sjoerg #define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x)) 1333*7330f729Sjoerg 1334*7330f729Sjoerg // creal 1335*7330f729Sjoerg 1336*7330f729Sjoerg static float 1337*7330f729Sjoerg _TG_ATTRS __tg_creal(float __x)1338*7330f729Sjoerg __tg_creal(float __x) {return __x;} 1339*7330f729Sjoerg 1340*7330f729Sjoerg static double 1341*7330f729Sjoerg _TG_ATTRS __tg_creal(double __x)1342*7330f729Sjoerg __tg_creal(double __x) {return __x;} 1343*7330f729Sjoerg 1344*7330f729Sjoerg static long double 1345*7330f729Sjoerg _TG_ATTRS __tg_creal(long double __x)1346*7330f729Sjoerg __tg_creal(long double __x) {return __x;} 1347*7330f729Sjoerg 1348*7330f729Sjoerg static float 1349*7330f729Sjoerg _TG_ATTRS __tg_creal(float _Complex __x)1350*7330f729Sjoerg __tg_creal(float _Complex __x) {return crealf(__x);} 1351*7330f729Sjoerg 1352*7330f729Sjoerg static double 1353*7330f729Sjoerg _TG_ATTRS __tg_creal(double _Complex __x)1354*7330f729Sjoerg __tg_creal(double _Complex __x) {return creal(__x);} 1355*7330f729Sjoerg 1356*7330f729Sjoerg static long double 1357*7330f729Sjoerg _TG_ATTRS __tg_creal(long double _Complex __x)1358*7330f729Sjoerg __tg_creal(long double _Complex __x) {return creall(__x);} 1359*7330f729Sjoerg 1360*7330f729Sjoerg #undef creal 1361*7330f729Sjoerg #define creal(__x) __tg_creal(__tg_promote1((__x))(__x)) 1362*7330f729Sjoerg 1363*7330f729Sjoerg #undef _TG_ATTRSp 1364*7330f729Sjoerg #undef _TG_ATTRS 1365*7330f729Sjoerg 1366*7330f729Sjoerg #endif /* __cplusplus */ 1367*7330f729Sjoerg #endif /* __has_include_next */ 1368*7330f729Sjoerg #endif /* __CLANG_TGMATH_H */ 1369