clang API Documentation

tgmath.h
Go to the documentation of this file.
00001 /*===---- tgmath.h - Standard header for type generic math ----------------===*\
00002  *
00003  * Copyright (c) 2009 Howard Hinnant
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a copy
00006  * of this software and associated documentation files (the "Software"), to deal
00007  * in the Software without restriction, including without limitation the rights
00008  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009  * copies of the Software, and to permit persons to whom the Software is
00010  * furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included in
00013  * all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021  * THE SOFTWARE.
00022  *
00023 \*===----------------------------------------------------------------------===*/
00024 
00025 #ifndef __TGMATH_H
00026 #define __TGMATH_H
00027 
00028 /* C99 7.22 Type-generic math <tgmath.h>. */
00029 #include <math.h>
00030 
00031 /* C++ handles type genericity with overloading in math.h. */
00032 #ifndef __cplusplus
00033 #include <complex.h>
00034 
00035 #define _TG_ATTRSp __attribute__((__overloadable__))
00036 #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
00037 
00038 // promotion
00039 
00040 typedef void _Argument_type_is_not_arithmetic;
00041 static _Argument_type_is_not_arithmetic __tg_promote(...)
00042   __attribute__((__unavailable__,__overloadable__));
00043 static double               _TG_ATTRSp __tg_promote(int);
00044 static double               _TG_ATTRSp __tg_promote(unsigned int);
00045 static double               _TG_ATTRSp __tg_promote(long);
00046 static double               _TG_ATTRSp __tg_promote(unsigned long);
00047 static double               _TG_ATTRSp __tg_promote(long long);
00048 static double               _TG_ATTRSp __tg_promote(unsigned long long);
00049 static float                _TG_ATTRSp __tg_promote(float);
00050 static double               _TG_ATTRSp __tg_promote(double);
00051 static long double          _TG_ATTRSp __tg_promote(long double);
00052 static float _Complex       _TG_ATTRSp __tg_promote(float _Complex);
00053 static double _Complex      _TG_ATTRSp __tg_promote(double _Complex);
00054 static long double _Complex _TG_ATTRSp __tg_promote(long double _Complex);
00055 
00056 #define __tg_promote1(__x)           (__typeof__(__tg_promote(__x)))
00057 #define __tg_promote2(__x, __y)      (__typeof__(__tg_promote(__x) + \
00058                                                  __tg_promote(__y)))
00059 #define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
00060                                                  __tg_promote(__y) + \
00061                                                  __tg_promote(__z)))
00062 
00063 // acos
00064 
00065 static float
00066     _TG_ATTRS
00067     __tg_acos(float __x) {return acosf(__x);}
00068 
00069 static double
00070     _TG_ATTRS
00071     __tg_acos(double __x) {return acos(__x);}
00072 
00073 static long double
00074     _TG_ATTRS
00075     __tg_acos(long double __x) {return acosl(__x);}
00076 
00077 static float _Complex
00078     _TG_ATTRS
00079     __tg_acos(float _Complex __x) {return cacosf(__x);}
00080 
00081 static double _Complex
00082     _TG_ATTRS
00083     __tg_acos(double _Complex __x) {return cacos(__x);}
00084 
00085 static long double _Complex
00086     _TG_ATTRS
00087     __tg_acos(long double _Complex __x) {return cacosl(__x);}
00088 
00089 #undef acos
00090 #define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
00091 
00092 // asin
00093 
00094 static float
00095     _TG_ATTRS
00096     __tg_asin(float __x) {return asinf(__x);}
00097 
00098 static double
00099     _TG_ATTRS
00100     __tg_asin(double __x) {return asin(__x);}
00101 
00102 static long double
00103     _TG_ATTRS
00104     __tg_asin(long double __x) {return asinl(__x);}
00105 
00106 static float _Complex
00107     _TG_ATTRS
00108     __tg_asin(float _Complex __x) {return casinf(__x);}
00109 
00110 static double _Complex
00111     _TG_ATTRS
00112     __tg_asin(double _Complex __x) {return casin(__x);}
00113 
00114 static long double _Complex
00115     _TG_ATTRS
00116     __tg_asin(long double _Complex __x) {return casinl(__x);}
00117 
00118 #undef asin
00119 #define asin(__x) __tg_asin(__tg_promote1((__x))(__x))
00120 
00121 // atan
00122 
00123 static float
00124     _TG_ATTRS
00125     __tg_atan(float __x) {return atanf(__x);}
00126 
00127 static double
00128     _TG_ATTRS
00129     __tg_atan(double __x) {return atan(__x);}
00130 
00131 static long double
00132     _TG_ATTRS
00133     __tg_atan(long double __x) {return atanl(__x);}
00134 
00135 static float _Complex
00136     _TG_ATTRS
00137     __tg_atan(float _Complex __x) {return catanf(__x);}
00138 
00139 static double _Complex
00140     _TG_ATTRS
00141     __tg_atan(double _Complex __x) {return catan(__x);}
00142 
00143 static long double _Complex
00144     _TG_ATTRS
00145     __tg_atan(long double _Complex __x) {return catanl(__x);}
00146 
00147 #undef atan
00148 #define atan(__x) __tg_atan(__tg_promote1((__x))(__x))
00149 
00150 // acosh
00151 
00152 static float
00153     _TG_ATTRS
00154     __tg_acosh(float __x) {return acoshf(__x);}
00155 
00156 static double
00157     _TG_ATTRS
00158     __tg_acosh(double __x) {return acosh(__x);}
00159 
00160 static long double
00161     _TG_ATTRS
00162     __tg_acosh(long double __x) {return acoshl(__x);}
00163 
00164 static float _Complex
00165     _TG_ATTRS
00166     __tg_acosh(float _Complex __x) {return cacoshf(__x);}
00167 
00168 static double _Complex
00169     _TG_ATTRS
00170     __tg_acosh(double _Complex __x) {return cacosh(__x);}
00171 
00172 static long double _Complex
00173     _TG_ATTRS
00174     __tg_acosh(long double _Complex __x) {return cacoshl(__x);}
00175 
00176 #undef acosh
00177 #define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x))
00178 
00179 // asinh
00180 
00181 static float
00182     _TG_ATTRS
00183     __tg_asinh(float __x) {return asinhf(__x);}
00184 
00185 static double
00186     _TG_ATTRS
00187     __tg_asinh(double __x) {return asinh(__x);}
00188 
00189 static long double
00190     _TG_ATTRS
00191     __tg_asinh(long double __x) {return asinhl(__x);}
00192 
00193 static float _Complex
00194     _TG_ATTRS
00195     __tg_asinh(float _Complex __x) {return casinhf(__x);}
00196 
00197 static double _Complex
00198     _TG_ATTRS
00199     __tg_asinh(double _Complex __x) {return casinh(__x);}
00200 
00201 static long double _Complex
00202     _TG_ATTRS
00203     __tg_asinh(long double _Complex __x) {return casinhl(__x);}
00204 
00205 #undef asinh
00206 #define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x))
00207 
00208 // atanh
00209 
00210 static float
00211     _TG_ATTRS
00212     __tg_atanh(float __x) {return atanhf(__x);}
00213 
00214 static double
00215     _TG_ATTRS
00216     __tg_atanh(double __x) {return atanh(__x);}
00217 
00218 static long double
00219     _TG_ATTRS
00220     __tg_atanh(long double __x) {return atanhl(__x);}
00221 
00222 static float _Complex
00223     _TG_ATTRS
00224     __tg_atanh(float _Complex __x) {return catanhf(__x);}
00225 
00226 static double _Complex
00227     _TG_ATTRS
00228     __tg_atanh(double _Complex __x) {return catanh(__x);}
00229 
00230 static long double _Complex
00231     _TG_ATTRS
00232     __tg_atanh(long double _Complex __x) {return catanhl(__x);}
00233 
00234 #undef atanh
00235 #define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x))
00236 
00237 // cos
00238 
00239 static float
00240     _TG_ATTRS
00241     __tg_cos(float __x) {return cosf(__x);}
00242 
00243 static double
00244     _TG_ATTRS
00245     __tg_cos(double __x) {return cos(__x);}
00246 
00247 static long double
00248     _TG_ATTRS
00249     __tg_cos(long double __x) {return cosl(__x);}
00250 
00251 static float _Complex
00252     _TG_ATTRS
00253     __tg_cos(float _Complex __x) {return ccosf(__x);}
00254 
00255 static double _Complex
00256     _TG_ATTRS
00257     __tg_cos(double _Complex __x) {return ccos(__x);}
00258 
00259 static long double _Complex
00260     _TG_ATTRS
00261     __tg_cos(long double _Complex __x) {return ccosl(__x);}
00262 
00263 #undef cos
00264 #define cos(__x) __tg_cos(__tg_promote1((__x))(__x))
00265 
00266 // sin
00267 
00268 static float
00269     _TG_ATTRS
00270     __tg_sin(float __x) {return sinf(__x);}
00271 
00272 static double
00273     _TG_ATTRS
00274     __tg_sin(double __x) {return sin(__x);}
00275 
00276 static long double
00277     _TG_ATTRS
00278     __tg_sin(long double __x) {return sinl(__x);}
00279 
00280 static float _Complex
00281     _TG_ATTRS
00282     __tg_sin(float _Complex __x) {return csinf(__x);}
00283 
00284 static double _Complex
00285     _TG_ATTRS
00286     __tg_sin(double _Complex __x) {return csin(__x);}
00287 
00288 static long double _Complex
00289     _TG_ATTRS
00290     __tg_sin(long double _Complex __x) {return csinl(__x);}
00291 
00292 #undef sin
00293 #define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
00294 
00295 // tan
00296 
00297 static float
00298     _TG_ATTRS
00299     __tg_tan(float __x) {return tanf(__x);}
00300 
00301 static double
00302     _TG_ATTRS
00303     __tg_tan(double __x) {return tan(__x);}
00304 
00305 static long double
00306     _TG_ATTRS
00307     __tg_tan(long double __x) {return tanl(__x);}
00308 
00309 static float _Complex
00310     _TG_ATTRS
00311     __tg_tan(float _Complex __x) {return ctanf(__x);}
00312 
00313 static double _Complex
00314     _TG_ATTRS
00315     __tg_tan(double _Complex __x) {return ctan(__x);}
00316 
00317 static long double _Complex
00318     _TG_ATTRS
00319     __tg_tan(long double _Complex __x) {return ctanl(__x);}
00320 
00321 #undef tan
00322 #define tan(__x) __tg_tan(__tg_promote1((__x))(__x))
00323 
00324 // cosh
00325 
00326 static float
00327     _TG_ATTRS
00328     __tg_cosh(float __x) {return coshf(__x);}
00329 
00330 static double
00331     _TG_ATTRS
00332     __tg_cosh(double __x) {return cosh(__x);}
00333 
00334 static long double
00335     _TG_ATTRS
00336     __tg_cosh(long double __x) {return coshl(__x);}
00337 
00338 static float _Complex
00339     _TG_ATTRS
00340     __tg_cosh(float _Complex __x) {return ccoshf(__x);}
00341 
00342 static double _Complex
00343     _TG_ATTRS
00344     __tg_cosh(double _Complex __x) {return ccosh(__x);}
00345 
00346 static long double _Complex
00347     _TG_ATTRS
00348     __tg_cosh(long double _Complex __x) {return ccoshl(__x);}
00349 
00350 #undef cosh
00351 #define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x))
00352 
00353 // sinh
00354 
00355 static float
00356     _TG_ATTRS
00357     __tg_sinh(float __x) {return sinhf(__x);}
00358 
00359 static double
00360     _TG_ATTRS
00361     __tg_sinh(double __x) {return sinh(__x);}
00362 
00363 static long double
00364     _TG_ATTRS
00365     __tg_sinh(long double __x) {return sinhl(__x);}
00366 
00367 static float _Complex
00368     _TG_ATTRS
00369     __tg_sinh(float _Complex __x) {return csinhf(__x);}
00370 
00371 static double _Complex
00372     _TG_ATTRS
00373     __tg_sinh(double _Complex __x) {return csinh(__x);}
00374 
00375 static long double _Complex
00376     _TG_ATTRS
00377     __tg_sinh(long double _Complex __x) {return csinhl(__x);}
00378 
00379 #undef sinh
00380 #define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x))
00381 
00382 // tanh
00383 
00384 static float
00385     _TG_ATTRS
00386     __tg_tanh(float __x) {return tanhf(__x);}
00387 
00388 static double
00389     _TG_ATTRS
00390     __tg_tanh(double __x) {return tanh(__x);}
00391 
00392 static long double
00393     _TG_ATTRS
00394     __tg_tanh(long double __x) {return tanhl(__x);}
00395 
00396 static float _Complex
00397     _TG_ATTRS
00398     __tg_tanh(float _Complex __x) {return ctanhf(__x);}
00399 
00400 static double _Complex
00401     _TG_ATTRS
00402     __tg_tanh(double _Complex __x) {return ctanh(__x);}
00403 
00404 static long double _Complex
00405     _TG_ATTRS
00406     __tg_tanh(long double _Complex __x) {return ctanhl(__x);}
00407 
00408 #undef tanh
00409 #define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x))
00410 
00411 // exp
00412 
00413 static float
00414     _TG_ATTRS
00415     __tg_exp(float __x) {return expf(__x);}
00416 
00417 static double
00418     _TG_ATTRS
00419     __tg_exp(double __x) {return exp(__x);}
00420 
00421 static long double
00422     _TG_ATTRS
00423     __tg_exp(long double __x) {return expl(__x);}
00424 
00425 static float _Complex
00426     _TG_ATTRS
00427     __tg_exp(float _Complex __x) {return cexpf(__x);}
00428 
00429 static double _Complex
00430     _TG_ATTRS
00431     __tg_exp(double _Complex __x) {return cexp(__x);}
00432 
00433 static long double _Complex
00434     _TG_ATTRS
00435     __tg_exp(long double _Complex __x) {return cexpl(__x);}
00436 
00437 #undef exp
00438 #define exp(__x) __tg_exp(__tg_promote1((__x))(__x))
00439 
00440 // log
00441 
00442 static float
00443     _TG_ATTRS
00444     __tg_log(float __x) {return logf(__x);}
00445 
00446 static double
00447     _TG_ATTRS
00448     __tg_log(double __x) {return log(__x);}
00449 
00450 static long double
00451     _TG_ATTRS
00452     __tg_log(long double __x) {return logl(__x);}
00453 
00454 static float _Complex
00455     _TG_ATTRS
00456     __tg_log(float _Complex __x) {return clogf(__x);}
00457 
00458 static double _Complex
00459     _TG_ATTRS
00460     __tg_log(double _Complex __x) {return clog(__x);}
00461 
00462 static long double _Complex
00463     _TG_ATTRS
00464     __tg_log(long double _Complex __x) {return clogl(__x);}
00465 
00466 #undef log
00467 #define log(__x) __tg_log(__tg_promote1((__x))(__x))
00468 
00469 // pow
00470 
00471 static float
00472     _TG_ATTRS
00473     __tg_pow(float __x, float __y) {return powf(__x, __y);}
00474 
00475 static double
00476     _TG_ATTRS
00477     __tg_pow(double __x, double __y) {return pow(__x, __y);}
00478 
00479 static long double
00480     _TG_ATTRS
00481     __tg_pow(long double __x, long double __y) {return powl(__x, __y);}
00482 
00483 static float _Complex
00484     _TG_ATTRS
00485     __tg_pow(float _Complex __x, float _Complex __y) {return cpowf(__x, __y);}
00486 
00487 static double _Complex
00488     _TG_ATTRS
00489     __tg_pow(double _Complex __x, double _Complex __y) {return cpow(__x, __y);}
00490 
00491 static long double _Complex
00492     _TG_ATTRS
00493     __tg_pow(long double _Complex __x, long double _Complex __y) 
00494     {return cpowl(__x, __y);}
00495 
00496 #undef pow
00497 #define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \
00498                                __tg_promote2((__x), (__y))(__y))
00499 
00500 // sqrt
00501 
00502 static float
00503     _TG_ATTRS
00504     __tg_sqrt(float __x) {return sqrtf(__x);}
00505 
00506 static double
00507     _TG_ATTRS
00508     __tg_sqrt(double __x) {return sqrt(__x);}
00509 
00510 static long double
00511     _TG_ATTRS
00512     __tg_sqrt(long double __x) {return sqrtl(__x);}
00513 
00514 static float _Complex
00515     _TG_ATTRS
00516     __tg_sqrt(float _Complex __x) {return csqrtf(__x);}
00517 
00518 static double _Complex
00519     _TG_ATTRS
00520     __tg_sqrt(double _Complex __x) {return csqrt(__x);}
00521 
00522 static long double _Complex
00523     _TG_ATTRS
00524     __tg_sqrt(long double _Complex __x) {return csqrtl(__x);}
00525 
00526 #undef sqrt
00527 #define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x))
00528 
00529 // fabs
00530 
00531 static float
00532     _TG_ATTRS
00533     __tg_fabs(float __x) {return fabsf(__x);}
00534 
00535 static double
00536     _TG_ATTRS
00537     __tg_fabs(double __x) {return fabs(__x);}
00538 
00539 static long double
00540     _TG_ATTRS
00541     __tg_fabs(long double __x) {return fabsl(__x);}
00542 
00543 static float
00544     _TG_ATTRS
00545     __tg_fabs(float _Complex __x) {return cabsf(__x);}
00546 
00547 static double
00548     _TG_ATTRS
00549     __tg_fabs(double _Complex __x) {return cabs(__x);}
00550 
00551 static long double
00552     _TG_ATTRS
00553     __tg_fabs(long double _Complex __x) {return cabsl(__x);}
00554 
00555 #undef fabs
00556 #define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x))
00557 
00558 // atan2
00559 
00560 static float
00561     _TG_ATTRS
00562     __tg_atan2(float __x, float __y) {return atan2f(__x, __y);}
00563 
00564 static double
00565     _TG_ATTRS
00566     __tg_atan2(double __x, double __y) {return atan2(__x, __y);}
00567 
00568 static long double
00569     _TG_ATTRS
00570     __tg_atan2(long double __x, long double __y) {return atan2l(__x, __y);}
00571 
00572 #undef atan2
00573 #define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \
00574                                    __tg_promote2((__x), (__y))(__y))
00575 
00576 // cbrt
00577 
00578 static float
00579     _TG_ATTRS
00580     __tg_cbrt(float __x) {return cbrtf(__x);}
00581 
00582 static double
00583     _TG_ATTRS
00584     __tg_cbrt(double __x) {return cbrt(__x);}
00585 
00586 static long double
00587     _TG_ATTRS
00588     __tg_cbrt(long double __x) {return cbrtl(__x);}
00589 
00590 #undef cbrt
00591 #define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x))
00592 
00593 // ceil
00594 
00595 static float
00596     _TG_ATTRS
00597     __tg_ceil(float __x) {return ceilf(__x);}
00598 
00599 static double
00600     _TG_ATTRS
00601     __tg_ceil(double __x) {return ceil(__x);}
00602 
00603 static long double
00604     _TG_ATTRS
00605     __tg_ceil(long double __x) {return ceill(__x);}
00606 
00607 #undef ceil
00608 #define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x))
00609 
00610 // copysign
00611 
00612 static float
00613     _TG_ATTRS
00614     __tg_copysign(float __x, float __y) {return copysignf(__x, __y);}
00615 
00616 static double
00617     _TG_ATTRS
00618     __tg_copysign(double __x, double __y) {return copysign(__x, __y);}
00619 
00620 static long double
00621     _TG_ATTRS
00622     __tg_copysign(long double __x, long double __y) {return copysignl(__x, __y);}
00623 
00624 #undef copysign
00625 #define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \
00626                                          __tg_promote2((__x), (__y))(__y))
00627 
00628 // erf
00629 
00630 static float
00631     _TG_ATTRS
00632     __tg_erf(float __x) {return erff(__x);}
00633 
00634 static double
00635     _TG_ATTRS
00636     __tg_erf(double __x) {return erf(__x);}
00637 
00638 static long double
00639     _TG_ATTRS
00640     __tg_erf(long double __x) {return erfl(__x);}
00641 
00642 #undef erf
00643 #define erf(__x) __tg_erf(__tg_promote1((__x))(__x))
00644 
00645 // erfc
00646 
00647 static float
00648     _TG_ATTRS
00649     __tg_erfc(float __x) {return erfcf(__x);}
00650 
00651 static double
00652     _TG_ATTRS
00653     __tg_erfc(double __x) {return erfc(__x);}
00654 
00655 static long double
00656     _TG_ATTRS
00657     __tg_erfc(long double __x) {return erfcl(__x);}
00658 
00659 #undef erfc
00660 #define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x))
00661 
00662 // exp2
00663 
00664 static float
00665     _TG_ATTRS
00666     __tg_exp2(float __x) {return exp2f(__x);}
00667 
00668 static double
00669     _TG_ATTRS
00670     __tg_exp2(double __x) {return exp2(__x);}
00671 
00672 static long double
00673     _TG_ATTRS
00674     __tg_exp2(long double __x) {return exp2l(__x);}
00675 
00676 #undef exp2
00677 #define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x))
00678 
00679 // expm1
00680 
00681 static float
00682     _TG_ATTRS
00683     __tg_expm1(float __x) {return expm1f(__x);}
00684 
00685 static double
00686     _TG_ATTRS
00687     __tg_expm1(double __x) {return expm1(__x);}
00688 
00689 static long double
00690     _TG_ATTRS
00691     __tg_expm1(long double __x) {return expm1l(__x);}
00692 
00693 #undef expm1
00694 #define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x))
00695 
00696 // fdim
00697 
00698 static float
00699     _TG_ATTRS
00700     __tg_fdim(float __x, float __y) {return fdimf(__x, __y);}
00701 
00702 static double
00703     _TG_ATTRS
00704     __tg_fdim(double __x, double __y) {return fdim(__x, __y);}
00705 
00706 static long double
00707     _TG_ATTRS
00708     __tg_fdim(long double __x, long double __y) {return fdiml(__x, __y);}
00709 
00710 #undef fdim
00711 #define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \
00712                                  __tg_promote2((__x), (__y))(__y))
00713 
00714 // floor
00715 
00716 static float
00717     _TG_ATTRS
00718     __tg_floor(float __x) {return floorf(__x);}
00719 
00720 static double
00721     _TG_ATTRS
00722     __tg_floor(double __x) {return floor(__x);}
00723 
00724 static long double
00725     _TG_ATTRS
00726     __tg_floor(long double __x) {return floorl(__x);}
00727 
00728 #undef floor
00729 #define floor(__x) __tg_floor(__tg_promote1((__x))(__x))
00730 
00731 // fma
00732 
00733 static float
00734     _TG_ATTRS
00735     __tg_fma(float __x, float __y, float __z)
00736     {return fmaf(__x, __y, __z);}
00737 
00738 static double
00739     _TG_ATTRS
00740     __tg_fma(double __x, double __y, double __z)
00741     {return fma(__x, __y, __z);}
00742 
00743 static long double
00744     _TG_ATTRS
00745     __tg_fma(long double __x,long double __y, long double __z)
00746     {return fmal(__x, __y, __z);}
00747 
00748 #undef fma
00749 #define fma(__x, __y, __z)                                \
00750         __tg_fma(__tg_promote3((__x), (__y), (__z))(__x), \
00751                  __tg_promote3((__x), (__y), (__z))(__y), \
00752                  __tg_promote3((__x), (__y), (__z))(__z))
00753 
00754 // fmax
00755 
00756 static float
00757     _TG_ATTRS
00758     __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);}
00759 
00760 static double
00761     _TG_ATTRS
00762     __tg_fmax(double __x, double __y) {return fmax(__x, __y);}
00763 
00764 static long double
00765     _TG_ATTRS
00766     __tg_fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
00767 
00768 #undef fmax
00769 #define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \
00770                                  __tg_promote2((__x), (__y))(__y))
00771 
00772 // fmin
00773 
00774 static float
00775     _TG_ATTRS
00776     __tg_fmin(float __x, float __y) {return fminf(__x, __y);}
00777 
00778 static double
00779     _TG_ATTRS
00780     __tg_fmin(double __x, double __y) {return fmin(__x, __y);}
00781 
00782 static long double
00783     _TG_ATTRS
00784     __tg_fmin(long double __x, long double __y) {return fminl(__x, __y);}
00785 
00786 #undef fmin
00787 #define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \
00788                                  __tg_promote2((__x), (__y))(__y))
00789 
00790 // fmod
00791 
00792 static float
00793     _TG_ATTRS
00794     __tg_fmod(float __x, float __y) {return fmodf(__x, __y);}
00795 
00796 static double
00797     _TG_ATTRS
00798     __tg_fmod(double __x, double __y) {return fmod(__x, __y);}
00799 
00800 static long double
00801     _TG_ATTRS
00802     __tg_fmod(long double __x, long double __y) {return fmodl(__x, __y);}
00803 
00804 #undef fmod
00805 #define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \
00806                                  __tg_promote2((__x), (__y))(__y))
00807 
00808 // frexp
00809 
00810 static float
00811     _TG_ATTRS
00812     __tg_frexp(float __x, int* __y) {return frexpf(__x, __y);}
00813 
00814 static double
00815     _TG_ATTRS
00816     __tg_frexp(double __x, int* __y) {return frexp(__x, __y);}
00817 
00818 static long double
00819     _TG_ATTRS
00820     __tg_frexp(long double __x, int* __y) {return frexpl(__x, __y);}
00821 
00822 #undef frexp
00823 #define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y)
00824 
00825 // hypot
00826 
00827 static float
00828     _TG_ATTRS
00829     __tg_hypot(float __x, float __y) {return hypotf(__x, __y);}
00830 
00831 static double
00832     _TG_ATTRS
00833     __tg_hypot(double __x, double __y) {return hypot(__x, __y);}
00834 
00835 static long double
00836     _TG_ATTRS
00837     __tg_hypot(long double __x, long double __y) {return hypotl(__x, __y);}
00838 
00839 #undef hypot
00840 #define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \
00841                                    __tg_promote2((__x), (__y))(__y))
00842 
00843 // ilogb
00844 
00845 static int
00846     _TG_ATTRS
00847     __tg_ilogb(float __x) {return ilogbf(__x);}
00848 
00849 static int
00850     _TG_ATTRS
00851     __tg_ilogb(double __x) {return ilogb(__x);}
00852 
00853 static int
00854     _TG_ATTRS
00855     __tg_ilogb(long double __x) {return ilogbl(__x);}
00856 
00857 #undef ilogb
00858 #define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x))
00859 
00860 // ldexp
00861 
00862 static float
00863     _TG_ATTRS
00864     __tg_ldexp(float __x, int __y) {return ldexpf(__x, __y);}
00865 
00866 static double
00867     _TG_ATTRS
00868     __tg_ldexp(double __x, int __y) {return ldexp(__x, __y);}
00869 
00870 static long double
00871     _TG_ATTRS
00872     __tg_ldexp(long double __x, int __y) {return ldexpl(__x, __y);}
00873 
00874 #undef ldexp
00875 #define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y)
00876 
00877 // lgamma
00878 
00879 static float
00880     _TG_ATTRS
00881     __tg_lgamma(float __x) {return lgammaf(__x);}
00882 
00883 static double
00884     _TG_ATTRS
00885     __tg_lgamma(double __x) {return lgamma(__x);}
00886 
00887 static long double
00888     _TG_ATTRS
00889     __tg_lgamma(long double __x) {return lgammal(__x);}
00890 
00891 #undef lgamma
00892 #define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x))
00893 
00894 // llrint
00895 
00896 static long long
00897     _TG_ATTRS
00898     __tg_llrint(float __x) {return llrintf(__x);}
00899 
00900 static long long
00901     _TG_ATTRS
00902     __tg_llrint(double __x) {return llrint(__x);}
00903 
00904 static long long
00905     _TG_ATTRS
00906     __tg_llrint(long double __x) {return llrintl(__x);}
00907 
00908 #undef llrint
00909 #define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x))
00910 
00911 // llround
00912 
00913 static long long
00914     _TG_ATTRS
00915     __tg_llround(float __x) {return llroundf(__x);}
00916 
00917 static long long
00918     _TG_ATTRS
00919     __tg_llround(double __x) {return llround(__x);}
00920 
00921 static long long
00922     _TG_ATTRS
00923     __tg_llround(long double __x) {return llroundl(__x);}
00924 
00925 #undef llround
00926 #define llround(__x) __tg_llround(__tg_promote1((__x))(__x))
00927 
00928 // log10
00929 
00930 static float
00931     _TG_ATTRS
00932     __tg_log10(float __x) {return log10f(__x);}
00933 
00934 static double
00935     _TG_ATTRS
00936     __tg_log10(double __x) {return log10(__x);}
00937 
00938 static long double
00939     _TG_ATTRS
00940     __tg_log10(long double __x) {return log10l(__x);}
00941 
00942 #undef log10
00943 #define log10(__x) __tg_log10(__tg_promote1((__x))(__x))
00944 
00945 // log1p
00946 
00947 static float
00948     _TG_ATTRS
00949     __tg_log1p(float __x) {return log1pf(__x);}
00950 
00951 static double
00952     _TG_ATTRS
00953     __tg_log1p(double __x) {return log1p(__x);}
00954 
00955 static long double
00956     _TG_ATTRS
00957     __tg_log1p(long double __x) {return log1pl(__x);}
00958 
00959 #undef log1p
00960 #define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x))
00961 
00962 // log2
00963 
00964 static float
00965     _TG_ATTRS
00966     __tg_log2(float __x) {return log2f(__x);}
00967 
00968 static double
00969     _TG_ATTRS
00970     __tg_log2(double __x) {return log2(__x);}
00971 
00972 static long double
00973     _TG_ATTRS
00974     __tg_log2(long double __x) {return log2l(__x);}
00975 
00976 #undef log2
00977 #define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
00978 
00979 // logb
00980 
00981 static float
00982     _TG_ATTRS
00983     __tg_logb(float __x) {return logbf(__x);}
00984 
00985 static double
00986     _TG_ATTRS
00987     __tg_logb(double __x) {return logb(__x);}
00988 
00989 static long double
00990     _TG_ATTRS
00991     __tg_logb(long double __x) {return logbl(__x);}
00992 
00993 #undef logb
00994 #define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
00995 
00996 // lrint
00997 
00998 static long
00999     _TG_ATTRS
01000     __tg_lrint(float __x) {return lrintf(__x);}
01001 
01002 static long
01003     _TG_ATTRS
01004     __tg_lrint(double __x) {return lrint(__x);}
01005 
01006 static long
01007     _TG_ATTRS
01008     __tg_lrint(long double __x) {return lrintl(__x);}
01009 
01010 #undef lrint
01011 #define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x))
01012 
01013 // lround
01014 
01015 static long
01016     _TG_ATTRS
01017     __tg_lround(float __x) {return lroundf(__x);}
01018 
01019 static long
01020     _TG_ATTRS
01021     __tg_lround(double __x) {return lround(__x);}
01022 
01023 static long
01024     _TG_ATTRS
01025     __tg_lround(long double __x) {return lroundl(__x);}
01026 
01027 #undef lround
01028 #define lround(__x) __tg_lround(__tg_promote1((__x))(__x))
01029 
01030 // nearbyint
01031 
01032 static float
01033     _TG_ATTRS
01034     __tg_nearbyint(float __x) {return nearbyintf(__x);}
01035 
01036 static double
01037     _TG_ATTRS
01038     __tg_nearbyint(double __x) {return nearbyint(__x);}
01039 
01040 static long double
01041     _TG_ATTRS
01042     __tg_nearbyint(long double __x) {return nearbyintl(__x);}
01043 
01044 #undef nearbyint
01045 #define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x))
01046 
01047 // nextafter
01048 
01049 static float
01050     _TG_ATTRS
01051     __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);}
01052 
01053 static double
01054     _TG_ATTRS
01055     __tg_nextafter(double __x, double __y) {return nextafter(__x, __y);}
01056 
01057 static long double
01058     _TG_ATTRS
01059     __tg_nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
01060 
01061 #undef nextafter
01062 #define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \
01063                                            __tg_promote2((__x), (__y))(__y))
01064 
01065 // nexttoward
01066 
01067 static float
01068     _TG_ATTRS
01069     __tg_nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
01070 
01071 static double
01072     _TG_ATTRS
01073     __tg_nexttoward(double __x, long double __y) {return nexttoward(__x, __y);}
01074 
01075 static long double
01076     _TG_ATTRS
01077     __tg_nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
01078 
01079 #undef nexttoward
01080 #define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y))
01081 
01082 // remainder
01083 
01084 static float
01085     _TG_ATTRS
01086     __tg_remainder(float __x, float __y) {return remainderf(__x, __y);}
01087 
01088 static double
01089     _TG_ATTRS
01090     __tg_remainder(double __x, double __y) {return remainder(__x, __y);}
01091 
01092 static long double
01093     _TG_ATTRS
01094     __tg_remainder(long double __x, long double __y) {return remainderl(__x, __y);}
01095 
01096 #undef remainder
01097 #define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \
01098                                            __tg_promote2((__x), (__y))(__y))
01099 
01100 // remquo
01101 
01102 static float
01103     _TG_ATTRS
01104     __tg_remquo(float __x, float __y, int* __z)
01105     {return remquof(__x, __y, __z);}
01106 
01107 static double
01108     _TG_ATTRS
01109     __tg_remquo(double __x, double __y, int* __z)
01110     {return remquo(__x, __y, __z);}
01111 
01112 static long double
01113     _TG_ATTRS
01114     __tg_remquo(long double __x,long double __y, int* __z)
01115     {return remquol(__x, __y, __z);}
01116 
01117 #undef remquo
01118 #define remquo(__x, __y, __z)                         \
01119         __tg_remquo(__tg_promote2((__x), (__y))(__x), \
01120                     __tg_promote2((__x), (__y))(__y), \
01121                     (__z))
01122 
01123 // rint
01124 
01125 static float
01126     _TG_ATTRS
01127     __tg_rint(float __x) {return rintf(__x);}
01128 
01129 static double
01130     _TG_ATTRS
01131     __tg_rint(double __x) {return rint(__x);}
01132 
01133 static long double
01134     _TG_ATTRS
01135     __tg_rint(long double __x) {return rintl(__x);}
01136 
01137 #undef rint
01138 #define rint(__x) __tg_rint(__tg_promote1((__x))(__x))
01139 
01140 // round
01141 
01142 static float
01143     _TG_ATTRS
01144     __tg_round(float __x) {return roundf(__x);}
01145 
01146 static double
01147     _TG_ATTRS
01148     __tg_round(double __x) {return round(__x);}
01149 
01150 static long double
01151     _TG_ATTRS
01152     __tg_round(long double __x) {return roundl(__x);}
01153 
01154 #undef round
01155 #define round(__x) __tg_round(__tg_promote1((__x))(__x))
01156 
01157 // scalbn
01158 
01159 static float
01160     _TG_ATTRS
01161     __tg_scalbn(float __x, int __y) {return scalbnf(__x, __y);}
01162 
01163 static double
01164     _TG_ATTRS
01165     __tg_scalbn(double __x, int __y) {return scalbn(__x, __y);}
01166 
01167 static long double
01168     _TG_ATTRS
01169     __tg_scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
01170 
01171 #undef scalbn
01172 #define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y)
01173 
01174 // scalbln
01175 
01176 static float
01177     _TG_ATTRS
01178     __tg_scalbln(float __x, long __y) {return scalblnf(__x, __y);}
01179 
01180 static double
01181     _TG_ATTRS
01182     __tg_scalbln(double __x, long __y) {return scalbln(__x, __y);}
01183 
01184 static long double
01185     _TG_ATTRS
01186     __tg_scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
01187 
01188 #undef scalbln
01189 #define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y)
01190 
01191 // tgamma
01192 
01193 static float
01194     _TG_ATTRS
01195     __tg_tgamma(float __x) {return tgammaf(__x);}
01196 
01197 static double
01198     _TG_ATTRS
01199     __tg_tgamma(double __x) {return tgamma(__x);}
01200 
01201 static long double
01202     _TG_ATTRS
01203     __tg_tgamma(long double __x) {return tgammal(__x);}
01204 
01205 #undef tgamma
01206 #define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x))
01207 
01208 // trunc
01209 
01210 static float
01211     _TG_ATTRS
01212     __tg_trunc(float __x) {return truncf(__x);}
01213 
01214 static double
01215     _TG_ATTRS
01216     __tg_trunc(double __x) {return trunc(__x);}
01217 
01218 static long double
01219     _TG_ATTRS
01220     __tg_trunc(long double __x) {return truncl(__x);}
01221 
01222 #undef trunc
01223 #define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x))
01224 
01225 // carg
01226 
01227 static float
01228     _TG_ATTRS
01229     __tg_carg(float __x) {return atan2f(0.F, __x);}
01230 
01231 static double
01232     _TG_ATTRS
01233     __tg_carg(double __x) {return atan2(0., __x);}
01234 
01235 static long double
01236     _TG_ATTRS
01237     __tg_carg(long double __x) {return atan2l(0.L, __x);}
01238 
01239 static float
01240     _TG_ATTRS
01241     __tg_carg(float _Complex __x) {return cargf(__x);}
01242 
01243 static double
01244     _TG_ATTRS
01245     __tg_carg(double _Complex __x) {return carg(__x);}
01246 
01247 static long double
01248     _TG_ATTRS
01249     __tg_carg(long double _Complex __x) {return cargl(__x);}
01250 
01251 #undef carg
01252 #define carg(__x) __tg_carg(__tg_promote1((__x))(__x))
01253 
01254 // cimag
01255 
01256 static float
01257     _TG_ATTRS
01258     __tg_cimag(float __x) {return 0;}
01259 
01260 static double
01261     _TG_ATTRS
01262     __tg_cimag(double __x) {return 0;}
01263 
01264 static long double
01265     _TG_ATTRS
01266     __tg_cimag(long double __x) {return 0;}
01267 
01268 static float
01269     _TG_ATTRS
01270     __tg_cimag(float _Complex __x) {return cimagf(__x);}
01271 
01272 static double
01273     _TG_ATTRS
01274     __tg_cimag(double _Complex __x) {return cimag(__x);}
01275 
01276 static long double
01277     _TG_ATTRS
01278     __tg_cimag(long double _Complex __x) {return cimagl(__x);}
01279 
01280 #undef cimag
01281 #define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x))
01282 
01283 // conj
01284 
01285 static float _Complex
01286     _TG_ATTRS
01287     __tg_conj(float __x) {return __x;}
01288 
01289 static double _Complex
01290     _TG_ATTRS
01291     __tg_conj(double __x) {return __x;}
01292 
01293 static long double _Complex
01294     _TG_ATTRS
01295     __tg_conj(long double __x) {return __x;}
01296 
01297 static float _Complex
01298     _TG_ATTRS
01299     __tg_conj(float _Complex __x) {return conjf(__x);}
01300 
01301 static double _Complex
01302     _TG_ATTRS
01303     __tg_conj(double _Complex __x) {return conj(__x);}
01304 
01305 static long double _Complex
01306     _TG_ATTRS
01307     __tg_conj(long double _Complex __x) {return conjl(__x);}
01308 
01309 #undef conj
01310 #define conj(__x) __tg_conj(__tg_promote1((__x))(__x))
01311 
01312 // cproj
01313 
01314 static float _Complex
01315     _TG_ATTRS
01316     __tg_cproj(float __x) {return cprojf(__x);}
01317 
01318 static double _Complex
01319     _TG_ATTRS
01320     __tg_cproj(double __x) {return cproj(__x);}
01321 
01322 static long double _Complex
01323     _TG_ATTRS
01324     __tg_cproj(long double __x) {return cprojl(__x);}
01325 
01326 static float _Complex
01327     _TG_ATTRS
01328     __tg_cproj(float _Complex __x) {return cprojf(__x);}
01329 
01330 static double _Complex
01331     _TG_ATTRS
01332     __tg_cproj(double _Complex __x) {return cproj(__x);}
01333 
01334 static long double _Complex
01335     _TG_ATTRS
01336     __tg_cproj(long double _Complex __x) {return cprojl(__x);}
01337 
01338 #undef cproj
01339 #define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x))
01340 
01341 // creal
01342 
01343 static float
01344     _TG_ATTRS
01345     __tg_creal(float __x) {return __x;}
01346 
01347 static double
01348     _TG_ATTRS
01349     __tg_creal(double __x) {return __x;}
01350 
01351 static long double
01352     _TG_ATTRS
01353     __tg_creal(long double __x) {return __x;}
01354 
01355 static float
01356     _TG_ATTRS
01357     __tg_creal(float _Complex __x) {return crealf(__x);}
01358 
01359 static double
01360     _TG_ATTRS
01361     __tg_creal(double _Complex __x) {return creal(__x);}
01362 
01363 static long double
01364     _TG_ATTRS
01365     __tg_creal(long double _Complex __x) {return creall(__x);}
01366 
01367 #undef creal
01368 #define creal(__x) __tg_creal(__tg_promote1((__x))(__x))
01369 
01370 #undef _TG_ATTRSp
01371 #undef _TG_ATTRS
01372 
01373 #endif /* __cplusplus */
01374 #endif /* __TGMATH_H */