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