1 /*===---- tgmath.h - Standard header for type generic math ----------------===*\
3 * Copyright (c) 2009 Howard Hinnant
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 \*===----------------------------------------------------------------------===*/
28 /* C99 7.22 Type-generic math <tgmath.h>. */
31 /* C++ handles type genericity with overloading in math.h. */
35 #define _TG_ATTRSp __attribute__((__overloadable__))
36 #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
40 typedef void _Argument_type_is_not_arithmetic
;
41 static _Argument_type_is_not_arithmetic
__tg_promote(...)
42 __attribute__((__unavailable__
,__overloadable__
));
43 static double _TG_ATTRSp
__tg_promote(int);
44 static double _TG_ATTRSp
__tg_promote(unsigned int);
45 static double _TG_ATTRSp
__tg_promote(long);
46 static double _TG_ATTRSp
__tg_promote(unsigned long);
47 static double _TG_ATTRSp
__tg_promote(long long);
48 static double _TG_ATTRSp
__tg_promote(unsigned long long);
49 static float _TG_ATTRSp
__tg_promote(float);
50 static double _TG_ATTRSp
__tg_promote(double);
51 static long double _TG_ATTRSp
__tg_promote(long double);
52 static float _Complex _TG_ATTRSp
__tg_promote(float _Complex
);
53 static double _Complex _TG_ATTRSp
__tg_promote(double _Complex
);
54 static long double _Complex _TG_ATTRSp
__tg_promote(long double _Complex
);
56 #define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
57 #define __tg_promote2(__x, __y) (__typeof__(__tg_promote(__x) + \
59 #define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
67 __tg_acos(float __x
) {return acosf(__x
);}
71 __tg_acos(double __x
) {return acos(__x
);}
75 __tg_acos(long double __x
) {return acosl(__x
);}
79 __tg_acos(float _Complex __x
) {return cacosf(__x
);}
81 static double _Complex
83 __tg_acos(double _Complex __x
) {return cacos(__x
);}
85 static long double _Complex
87 __tg_acos(long double _Complex __x
) {return cacosl(__x
);}
90 #define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
96 __tg_asin(float __x
) {return asinf(__x
);}
100 __tg_asin(double __x
) {return asin(__x
);}
104 __tg_asin(long double __x
) {return asinl(__x
);}
106 static float _Complex
108 __tg_asin(float _Complex __x
) {return casinf(__x
);}
110 static double _Complex
112 __tg_asin(double _Complex __x
) {return casin(__x
);}
114 static long double _Complex
116 __tg_asin(long double _Complex __x
) {return casinl(__x
);}
119 #define asin(__x) __tg_asin(__tg_promote1((__x))(__x))
125 __tg_atan(float __x
) {return atanf(__x
);}
129 __tg_atan(double __x
) {return atan(__x
);}
133 __tg_atan(long double __x
) {return atanl(__x
);}
135 static float _Complex
137 __tg_atan(float _Complex __x
) {return catanf(__x
);}
139 static double _Complex
141 __tg_atan(double _Complex __x
) {return catan(__x
);}
143 static long double _Complex
145 __tg_atan(long double _Complex __x
) {return catanl(__x
);}
148 #define atan(__x) __tg_atan(__tg_promote1((__x))(__x))
154 __tg_acosh(float __x
) {return acoshf(__x
);}
158 __tg_acosh(double __x
) {return acosh(__x
);}
162 __tg_acosh(long double __x
) {return acoshl(__x
);}
164 static float _Complex
166 __tg_acosh(float _Complex __x
) {return cacoshf(__x
);}
168 static double _Complex
170 __tg_acosh(double _Complex __x
) {return cacosh(__x
);}
172 static long double _Complex
174 __tg_acosh(long double _Complex __x
) {return cacoshl(__x
);}
177 #define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x))
183 __tg_asinh(float __x
) {return asinhf(__x
);}
187 __tg_asinh(double __x
) {return asinh(__x
);}
191 __tg_asinh(long double __x
) {return asinhl(__x
);}
193 static float _Complex
195 __tg_asinh(float _Complex __x
) {return casinhf(__x
);}
197 static double _Complex
199 __tg_asinh(double _Complex __x
) {return casinh(__x
);}
201 static long double _Complex
203 __tg_asinh(long double _Complex __x
) {return casinhl(__x
);}
206 #define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x))
212 __tg_atanh(float __x
) {return atanhf(__x
);}
216 __tg_atanh(double __x
) {return atanh(__x
);}
220 __tg_atanh(long double __x
) {return atanhl(__x
);}
222 static float _Complex
224 __tg_atanh(float _Complex __x
) {return catanhf(__x
);}
226 static double _Complex
228 __tg_atanh(double _Complex __x
) {return catanh(__x
);}
230 static long double _Complex
232 __tg_atanh(long double _Complex __x
) {return catanhl(__x
);}
235 #define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x))
241 __tg_cos(float __x
) {return cosf(__x
);}
245 __tg_cos(double __x
) {return cos(__x
);}
249 __tg_cos(long double __x
) {return cosl(__x
);}
251 static float _Complex
253 __tg_cos(float _Complex __x
) {return ccosf(__x
);}
255 static double _Complex
257 __tg_cos(double _Complex __x
) {return ccos(__x
);}
259 static long double _Complex
261 __tg_cos(long double _Complex __x
) {return ccosl(__x
);}
264 #define cos(__x) __tg_cos(__tg_promote1((__x))(__x))
270 __tg_sin(float __x
) {return sinf(__x
);}
274 __tg_sin(double __x
) {return sin(__x
);}
278 __tg_sin(long double __x
) {return sinl(__x
);}
280 static float _Complex
282 __tg_sin(float _Complex __x
) {return csinf(__x
);}
284 static double _Complex
286 __tg_sin(double _Complex __x
) {return csin(__x
);}
288 static long double _Complex
290 __tg_sin(long double _Complex __x
) {return csinl(__x
);}
293 #define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
299 __tg_tan(float __x
) {return tanf(__x
);}
303 __tg_tan(double __x
) {return tan(__x
);}
307 __tg_tan(long double __x
) {return tanl(__x
);}
309 static float _Complex
311 __tg_tan(float _Complex __x
) {return ctanf(__x
);}
313 static double _Complex
315 __tg_tan(double _Complex __x
) {return ctan(__x
);}
317 static long double _Complex
319 __tg_tan(long double _Complex __x
) {return ctanl(__x
);}
322 #define tan(__x) __tg_tan(__tg_promote1((__x))(__x))
328 __tg_cosh(float __x
) {return coshf(__x
);}
332 __tg_cosh(double __x
) {return cosh(__x
);}
336 __tg_cosh(long double __x
) {return coshl(__x
);}
338 static float _Complex
340 __tg_cosh(float _Complex __x
) {return ccoshf(__x
);}
342 static double _Complex
344 __tg_cosh(double _Complex __x
) {return ccosh(__x
);}
346 static long double _Complex
348 __tg_cosh(long double _Complex __x
) {return ccoshl(__x
);}
351 #define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x))
357 __tg_sinh(float __x
) {return sinhf(__x
);}
361 __tg_sinh(double __x
) {return sinh(__x
);}
365 __tg_sinh(long double __x
) {return sinhl(__x
);}
367 static float _Complex
369 __tg_sinh(float _Complex __x
) {return csinhf(__x
);}
371 static double _Complex
373 __tg_sinh(double _Complex __x
) {return csinh(__x
);}
375 static long double _Complex
377 __tg_sinh(long double _Complex __x
) {return csinhl(__x
);}
380 #define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x))
386 __tg_tanh(float __x
) {return tanhf(__x
);}
390 __tg_tanh(double __x
) {return tanh(__x
);}
394 __tg_tanh(long double __x
) {return tanhl(__x
);}
396 static float _Complex
398 __tg_tanh(float _Complex __x
) {return ctanhf(__x
);}
400 static double _Complex
402 __tg_tanh(double _Complex __x
) {return ctanh(__x
);}
404 static long double _Complex
406 __tg_tanh(long double _Complex __x
) {return ctanhl(__x
);}
409 #define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x))
415 __tg_exp(float __x
) {return expf(__x
);}
419 __tg_exp(double __x
) {return exp(__x
);}
423 __tg_exp(long double __x
) {return expl(__x
);}
425 static float _Complex
427 __tg_exp(float _Complex __x
) {return cexpf(__x
);}
429 static double _Complex
431 __tg_exp(double _Complex __x
) {return cexp(__x
);}
433 static long double _Complex
435 __tg_exp(long double _Complex __x
) {return cexpl(__x
);}
438 #define exp(__x) __tg_exp(__tg_promote1((__x))(__x))
444 __tg_log(float __x
) {return logf(__x
);}
448 __tg_log(double __x
) {return log(__x
);}
452 __tg_log(long double __x
) {return logl(__x
);}
454 static float _Complex
456 __tg_log(float _Complex __x
) {return clogf(__x
);}
458 static double _Complex
460 __tg_log(double _Complex __x
) {return clog(__x
);}
462 static long double _Complex
464 __tg_log(long double _Complex __x
) {return clogl(__x
);}
467 #define log(__x) __tg_log(__tg_promote1((__x))(__x))
473 __tg_pow(float __x
, float __y
) {return powf(__x
, __y
);}
477 __tg_pow(double __x
, double __y
) {return pow(__x
, __y
);}
481 __tg_pow(long double __x
, long double __y
) {return powl(__x
, __y
);}
483 static float _Complex
485 __tg_pow(float _Complex __x
, float _Complex __y
) {return cpowf(__x
, __y
);}
487 static double _Complex
489 __tg_pow(double _Complex __x
, double _Complex __y
) {return cpow(__x
, __y
);}
491 static long double _Complex
493 __tg_pow(long double _Complex __x
, long double _Complex __y
)
494 {return cpowl(__x
, __y
);}
497 #define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \
498 __tg_promote2((__x), (__y))(__y))
504 __tg_sqrt(float __x
) {return sqrtf(__x
);}
508 __tg_sqrt(double __x
) {return sqrt(__x
);}
512 __tg_sqrt(long double __x
) {return sqrtl(__x
);}
514 static float _Complex
516 __tg_sqrt(float _Complex __x
) {return csqrtf(__x
);}
518 static double _Complex
520 __tg_sqrt(double _Complex __x
) {return csqrt(__x
);}
522 static long double _Complex
524 __tg_sqrt(long double _Complex __x
) {return csqrtl(__x
);}
527 #define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x))
533 __tg_fabs(float __x
) {return fabsf(__x
);}
537 __tg_fabs(double __x
) {return fabs(__x
);}
541 __tg_fabs(long double __x
) {return fabsl(__x
);}
545 __tg_fabs(float _Complex __x
) {return cabsf(__x
);}
549 __tg_fabs(double _Complex __x
) {return cabs(__x
);}
553 __tg_fabs(long double _Complex __x
) {return cabsl(__x
);}
556 #define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x))
562 __tg_atan2(float __x
, float __y
) {return atan2f(__x
, __y
);}
566 __tg_atan2(double __x
, double __y
) {return atan2(__x
, __y
);}
570 __tg_atan2(long double __x
, long double __y
) {return atan2l(__x
, __y
);}
573 #define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \
574 __tg_promote2((__x), (__y))(__y))
580 __tg_cbrt(float __x
) {return cbrtf(__x
);}
584 __tg_cbrt(double __x
) {return cbrt(__x
);}
588 __tg_cbrt(long double __x
) {return cbrtl(__x
);}
591 #define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x))
597 __tg_ceil(float __x
) {return ceilf(__x
);}
601 __tg_ceil(double __x
) {return ceil(__x
);}
605 __tg_ceil(long double __x
) {return ceill(__x
);}
608 #define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x))
614 __tg_copysign(float __x
, float __y
) {return copysignf(__x
, __y
);}
618 __tg_copysign(double __x
, double __y
) {return copysign(__x
, __y
);}
622 __tg_copysign(long double __x
, long double __y
) {return copysignl(__x
, __y
);}
625 #define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \
626 __tg_promote2((__x), (__y))(__y))
632 __tg_erf(float __x
) {return erff(__x
);}
636 __tg_erf(double __x
) {return erf(__x
);}
640 __tg_erf(long double __x
) {return erfl(__x
);}
643 #define erf(__x) __tg_erf(__tg_promote1((__x))(__x))
649 __tg_erfc(float __x
) {return erfcf(__x
);}
653 __tg_erfc(double __x
) {return erfc(__x
);}
657 __tg_erfc(long double __x
) {return erfcl(__x
);}
660 #define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x))
666 __tg_exp2(float __x
) {return exp2f(__x
);}
670 __tg_exp2(double __x
) {return exp2(__x
);}
674 __tg_exp2(long double __x
) {return exp2l(__x
);}
677 #define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x))
683 __tg_expm1(float __x
) {return expm1f(__x
);}
687 __tg_expm1(double __x
) {return expm1(__x
);}
691 __tg_expm1(long double __x
) {return expm1l(__x
);}
694 #define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x))
700 __tg_fdim(float __x
, float __y
) {return fdimf(__x
, __y
);}
704 __tg_fdim(double __x
, double __y
) {return fdim(__x
, __y
);}
708 __tg_fdim(long double __x
, long double __y
) {return fdiml(__x
, __y
);}
711 #define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \
712 __tg_promote2((__x), (__y))(__y))
718 __tg_floor(float __x
) {return floorf(__x
);}
722 __tg_floor(double __x
) {return floor(__x
);}
726 __tg_floor(long double __x
) {return floorl(__x
);}
729 #define floor(__x) __tg_floor(__tg_promote1((__x))(__x))
735 __tg_fma(float __x
, float __y
, float __z
)
736 {return fmaf(__x
, __y
, __z
);}
740 __tg_fma(double __x
, double __y
, double __z
)
741 {return fma(__x
, __y
, __z
);}
745 __tg_fma(long double __x
,long double __y
, long double __z
)
746 {return fmal(__x
, __y
, __z
);}
749 #define fma(__x, __y, __z) \
750 __tg_fma(__tg_promote3((__x), (__y), (__z))(__x), \
751 __tg_promote3((__x), (__y), (__z))(__y), \
752 __tg_promote3((__x), (__y), (__z))(__z))
758 __tg_fmax(float __x
, float __y
) {return fmaxf(__x
, __y
);}
762 __tg_fmax(double __x
, double __y
) {return fmax(__x
, __y
);}
766 __tg_fmax(long double __x
, long double __y
) {return fmaxl(__x
, __y
);}
769 #define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \
770 __tg_promote2((__x), (__y))(__y))
776 __tg_fmin(float __x
, float __y
) {return fminf(__x
, __y
);}
780 __tg_fmin(double __x
, double __y
) {return fmin(__x
, __y
);}
784 __tg_fmin(long double __x
, long double __y
) {return fminl(__x
, __y
);}
787 #define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \
788 __tg_promote2((__x), (__y))(__y))
794 __tg_fmod(float __x
, float __y
) {return fmodf(__x
, __y
);}
798 __tg_fmod(double __x
, double __y
) {return fmod(__x
, __y
);}
802 __tg_fmod(long double __x
, long double __y
) {return fmodl(__x
, __y
);}
805 #define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \
806 __tg_promote2((__x), (__y))(__y))
812 __tg_frexp(float __x
, int* __y
) {return frexpf(__x
, __y
);}
816 __tg_frexp(double __x
, int* __y
) {return frexp(__x
, __y
);}
820 __tg_frexp(long double __x
, int* __y
) {return frexpl(__x
, __y
);}
823 #define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y)
829 __tg_hypot(float __x
, float __y
) {return hypotf(__x
, __y
);}
833 __tg_hypot(double __x
, double __y
) {return hypot(__x
, __y
);}
837 __tg_hypot(long double __x
, long double __y
) {return hypotl(__x
, __y
);}
840 #define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \
841 __tg_promote2((__x), (__y))(__y))
847 __tg_ilogb(float __x
) {return ilogbf(__x
);}
851 __tg_ilogb(double __x
) {return ilogb(__x
);}
855 __tg_ilogb(long double __x
) {return ilogbl(__x
);}
858 #define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x))
864 __tg_ldexp(float __x
, int __y
) {return ldexpf(__x
, __y
);}
868 __tg_ldexp(double __x
, int __y
) {return ldexp(__x
, __y
);}
872 __tg_ldexp(long double __x
, int __y
) {return ldexpl(__x
, __y
);}
875 #define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y)
881 __tg_lgamma(float __x
) {return lgammaf(__x
);}
885 __tg_lgamma(double __x
) {return lgamma(__x
);}
889 __tg_lgamma(long double __x
) {return lgammal(__x
);}
892 #define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x))
898 __tg_llrint(float __x
) {return llrintf(__x
);}
902 __tg_llrint(double __x
) {return llrint(__x
);}
906 __tg_llrint(long double __x
) {return llrintl(__x
);}
909 #define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x))
915 __tg_llround(float __x
) {return llroundf(__x
);}
919 __tg_llround(double __x
) {return llround(__x
);}
923 __tg_llround(long double __x
) {return llroundl(__x
);}
926 #define llround(__x) __tg_llround(__tg_promote1((__x))(__x))
932 __tg_log10(float __x
) {return log10f(__x
);}
936 __tg_log10(double __x
) {return log10(__x
);}
940 __tg_log10(long double __x
) {return log10l(__x
);}
943 #define log10(__x) __tg_log10(__tg_promote1((__x))(__x))
949 __tg_log1p(float __x
) {return log1pf(__x
);}
953 __tg_log1p(double __x
) {return log1p(__x
);}
957 __tg_log1p(long double __x
) {return log1pl(__x
);}
960 #define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x))
966 __tg_log2(float __x
) {return log2f(__x
);}
970 __tg_log2(double __x
) {return log2(__x
);}
974 __tg_log2(long double __x
) {return log2l(__x
);}
977 #define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
983 __tg_logb(float __x
) {return logbf(__x
);}
987 __tg_logb(double __x
) {return logb(__x
);}
991 __tg_logb(long double __x
) {return logbl(__x
);}
994 #define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
1000 __tg_lrint(float __x
) {return lrintf(__x
);}
1004 __tg_lrint(double __x
) {return lrint(__x
);}
1008 __tg_lrint(long double __x
) {return lrintl(__x
);}
1011 #define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x))
1017 __tg_lround(float __x
) {return lroundf(__x
);}
1021 __tg_lround(double __x
) {return lround(__x
);}
1025 __tg_lround(long double __x
) {return lroundl(__x
);}
1028 #define lround(__x) __tg_lround(__tg_promote1((__x))(__x))
1034 __tg_nearbyint(float __x
) {return nearbyintf(__x
);}
1038 __tg_nearbyint(double __x
) {return nearbyint(__x
);}
1042 __tg_nearbyint(long double __x
) {return nearbyintl(__x
);}
1045 #define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x))
1051 __tg_nextafter(float __x
, float __y
) {return nextafterf(__x
, __y
);}
1055 __tg_nextafter(double __x
, double __y
) {return nextafter(__x
, __y
);}
1059 __tg_nextafter(long double __x
, long double __y
) {return nextafterl(__x
, __y
);}
1062 #define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \
1063 __tg_promote2((__x), (__y))(__y))
1069 __tg_nexttoward(float __x
, long double __y
) {return nexttowardf(__x
, __y
);}
1073 __tg_nexttoward(double __x
, long double __y
) {return nexttoward(__x
, __y
);}
1077 __tg_nexttoward(long double __x
, long double __y
) {return nexttowardl(__x
, __y
);}
1080 #define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y))
1086 __tg_remainder(float __x
, float __y
) {return remainderf(__x
, __y
);}
1090 __tg_remainder(double __x
, double __y
) {return remainder(__x
, __y
);}
1094 __tg_remainder(long double __x
, long double __y
) {return remainderl(__x
, __y
);}
1097 #define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \
1098 __tg_promote2((__x), (__y))(__y))
1104 __tg_remquo(float __x
, float __y
, int* __z
)
1105 {return remquof(__x
, __y
, __z
);}
1109 __tg_remquo(double __x
, double __y
, int* __z
)
1110 {return remquo(__x
, __y
, __z
);}
1114 __tg_remquo(long double __x
,long double __y
, int* __z
)
1115 {return remquol(__x
, __y
, __z
);}
1118 #define remquo(__x, __y, __z) \
1119 __tg_remquo(__tg_promote2((__x), (__y))(__x), \
1120 __tg_promote2((__x), (__y))(__y), \
1127 __tg_rint(float __x
) {return rintf(__x
);}
1131 __tg_rint(double __x
) {return rint(__x
);}
1135 __tg_rint(long double __x
) {return rintl(__x
);}
1138 #define rint(__x) __tg_rint(__tg_promote1((__x))(__x))
1144 __tg_round(float __x
) {return roundf(__x
);}
1148 __tg_round(double __x
) {return round(__x
);}
1152 __tg_round(long double __x
) {return roundl(__x
);}
1155 #define round(__x) __tg_round(__tg_promote1((__x))(__x))
1161 __tg_scalbn(float __x
, int __y
) {return scalbnf(__x
, __y
);}
1165 __tg_scalbn(double __x
, int __y
) {return scalbn(__x
, __y
);}
1169 __tg_scalbn(long double __x
, int __y
) {return scalbnl(__x
, __y
);}
1172 #define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y)
1178 __tg_scalbln(float __x
, long __y
) {return scalblnf(__x
, __y
);}
1182 __tg_scalbln(double __x
, long __y
) {return scalbln(__x
, __y
);}
1186 __tg_scalbln(long double __x
, long __y
) {return scalblnl(__x
, __y
);}
1189 #define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y)
1195 __tg_tgamma(float __x
) {return tgammaf(__x
);}
1199 __tg_tgamma(double __x
) {return tgamma(__x
);}
1203 __tg_tgamma(long double __x
) {return tgammal(__x
);}
1206 #define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x))
1212 __tg_trunc(float __x
) {return truncf(__x
);}
1216 __tg_trunc(double __x
) {return trunc(__x
);}
1220 __tg_trunc(long double __x
) {return truncl(__x
);}
1223 #define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x))
1229 __tg_carg(float __x
) {return atan2f(0.F
, __x
);}
1233 __tg_carg(double __x
) {return atan2(0., __x
);}
1237 __tg_carg(long double __x
) {return atan2l(0.L
, __x
);}
1241 __tg_carg(float _Complex __x
) {return cargf(__x
);}
1245 __tg_carg(double _Complex __x
) {return carg(__x
);}
1249 __tg_carg(long double _Complex __x
) {return cargl(__x
);}
1252 #define carg(__x) __tg_carg(__tg_promote1((__x))(__x))
1258 __tg_cimag(float __x
) {return 0;}
1262 __tg_cimag(double __x
) {return 0;}
1266 __tg_cimag(long double __x
) {return 0;}
1270 __tg_cimag(float _Complex __x
) {return cimagf(__x
);}
1274 __tg_cimag(double _Complex __x
) {return cimag(__x
);}
1278 __tg_cimag(long double _Complex __x
) {return cimagl(__x
);}
1281 #define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x))
1285 static float _Complex
1287 __tg_conj(float __x
) {return __x
;}
1289 static double _Complex
1291 __tg_conj(double __x
) {return __x
;}
1293 static long double _Complex
1295 __tg_conj(long double __x
) {return __x
;}
1297 static float _Complex
1299 __tg_conj(float _Complex __x
) {return conjf(__x
);}
1301 static double _Complex
1303 __tg_conj(double _Complex __x
) {return conj(__x
);}
1305 static long double _Complex
1307 __tg_conj(long double _Complex __x
) {return conjl(__x
);}
1310 #define conj(__x) __tg_conj(__tg_promote1((__x))(__x))
1314 static float _Complex
1316 __tg_cproj(float __x
) {return cprojf(__x
);}
1318 static double _Complex
1320 __tg_cproj(double __x
) {return cproj(__x
);}
1322 static long double _Complex
1324 __tg_cproj(long double __x
) {return cprojl(__x
);}
1326 static float _Complex
1328 __tg_cproj(float _Complex __x
) {return cprojf(__x
);}
1330 static double _Complex
1332 __tg_cproj(double _Complex __x
) {return cproj(__x
);}
1334 static long double _Complex
1336 __tg_cproj(long double _Complex __x
) {return cprojl(__x
);}
1339 #define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x))
1345 __tg_creal(float __x
) {return __x
;}
1349 __tg_creal(double __x
) {return __x
;}
1353 __tg_creal(long double __x
) {return __x
;}
1357 __tg_creal(float _Complex __x
) {return crealf(__x
);}
1361 __tg_creal(double _Complex __x
) {return creal(__x
);}
1365 __tg_creal(long double _Complex __x
) {return creall(__x
);}
1368 #define creal(__x) __tg_creal(__tg_promote1((__x))(__x))
1373 #endif /* __cplusplus */
1374 #endif /* __TGMATH_H */