Android O SDK.
[android_tools.git] / sdk / build-tools / 26.0.0 / renderscript / clang-include / tgmath.h
blob318e1185feee72db8a5bfa3eca64ef41b3ea06ce
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
21 * THE SOFTWARE.
23 \*===----------------------------------------------------------------------===*/
25 #ifndef __TGMATH_H
26 #define __TGMATH_H
28 /* C99 7.22 Type-generic math <tgmath.h>. */
29 #include <math.h>
31 /* C++ handles type genericity with overloading in math.h. */
32 #ifndef __cplusplus
33 #include <complex.h>
35 #define _TG_ATTRSp __attribute__((__overloadable__))
36 #define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
38 // promotion
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) + \
58 __tg_promote(__y)))
59 #define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
60 __tg_promote(__y) + \
61 __tg_promote(__z)))
63 // acos
65 static float
66 _TG_ATTRS
67 __tg_acos(float __x) {return acosf(__x);}
69 static double
70 _TG_ATTRS
71 __tg_acos(double __x) {return acos(__x);}
73 static long double
74 _TG_ATTRS
75 __tg_acos(long double __x) {return acosl(__x);}
77 static float _Complex
78 _TG_ATTRS
79 __tg_acos(float _Complex __x) {return cacosf(__x);}
81 static double _Complex
82 _TG_ATTRS
83 __tg_acos(double _Complex __x) {return cacos(__x);}
85 static long double _Complex
86 _TG_ATTRS
87 __tg_acos(long double _Complex __x) {return cacosl(__x);}
89 #undef acos
90 #define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
92 // asin
94 static float
95 _TG_ATTRS
96 __tg_asin(float __x) {return asinf(__x);}
98 static double
99 _TG_ATTRS
100 __tg_asin(double __x) {return asin(__x);}
102 static long double
103 _TG_ATTRS
104 __tg_asin(long double __x) {return asinl(__x);}
106 static float _Complex
107 _TG_ATTRS
108 __tg_asin(float _Complex __x) {return casinf(__x);}
110 static double _Complex
111 _TG_ATTRS
112 __tg_asin(double _Complex __x) {return casin(__x);}
114 static long double _Complex
115 _TG_ATTRS
116 __tg_asin(long double _Complex __x) {return casinl(__x);}
118 #undef asin
119 #define asin(__x) __tg_asin(__tg_promote1((__x))(__x))
121 // atan
123 static float
124 _TG_ATTRS
125 __tg_atan(float __x) {return atanf(__x);}
127 static double
128 _TG_ATTRS
129 __tg_atan(double __x) {return atan(__x);}
131 static long double
132 _TG_ATTRS
133 __tg_atan(long double __x) {return atanl(__x);}
135 static float _Complex
136 _TG_ATTRS
137 __tg_atan(float _Complex __x) {return catanf(__x);}
139 static double _Complex
140 _TG_ATTRS
141 __tg_atan(double _Complex __x) {return catan(__x);}
143 static long double _Complex
144 _TG_ATTRS
145 __tg_atan(long double _Complex __x) {return catanl(__x);}
147 #undef atan
148 #define atan(__x) __tg_atan(__tg_promote1((__x))(__x))
150 // acosh
152 static float
153 _TG_ATTRS
154 __tg_acosh(float __x) {return acoshf(__x);}
156 static double
157 _TG_ATTRS
158 __tg_acosh(double __x) {return acosh(__x);}
160 static long double
161 _TG_ATTRS
162 __tg_acosh(long double __x) {return acoshl(__x);}
164 static float _Complex
165 _TG_ATTRS
166 __tg_acosh(float _Complex __x) {return cacoshf(__x);}
168 static double _Complex
169 _TG_ATTRS
170 __tg_acosh(double _Complex __x) {return cacosh(__x);}
172 static long double _Complex
173 _TG_ATTRS
174 __tg_acosh(long double _Complex __x) {return cacoshl(__x);}
176 #undef acosh
177 #define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x))
179 // asinh
181 static float
182 _TG_ATTRS
183 __tg_asinh(float __x) {return asinhf(__x);}
185 static double
186 _TG_ATTRS
187 __tg_asinh(double __x) {return asinh(__x);}
189 static long double
190 _TG_ATTRS
191 __tg_asinh(long double __x) {return asinhl(__x);}
193 static float _Complex
194 _TG_ATTRS
195 __tg_asinh(float _Complex __x) {return casinhf(__x);}
197 static double _Complex
198 _TG_ATTRS
199 __tg_asinh(double _Complex __x) {return casinh(__x);}
201 static long double _Complex
202 _TG_ATTRS
203 __tg_asinh(long double _Complex __x) {return casinhl(__x);}
205 #undef asinh
206 #define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x))
208 // atanh
210 static float
211 _TG_ATTRS
212 __tg_atanh(float __x) {return atanhf(__x);}
214 static double
215 _TG_ATTRS
216 __tg_atanh(double __x) {return atanh(__x);}
218 static long double
219 _TG_ATTRS
220 __tg_atanh(long double __x) {return atanhl(__x);}
222 static float _Complex
223 _TG_ATTRS
224 __tg_atanh(float _Complex __x) {return catanhf(__x);}
226 static double _Complex
227 _TG_ATTRS
228 __tg_atanh(double _Complex __x) {return catanh(__x);}
230 static long double _Complex
231 _TG_ATTRS
232 __tg_atanh(long double _Complex __x) {return catanhl(__x);}
234 #undef atanh
235 #define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x))
237 // cos
239 static float
240 _TG_ATTRS
241 __tg_cos(float __x) {return cosf(__x);}
243 static double
244 _TG_ATTRS
245 __tg_cos(double __x) {return cos(__x);}
247 static long double
248 _TG_ATTRS
249 __tg_cos(long double __x) {return cosl(__x);}
251 static float _Complex
252 _TG_ATTRS
253 __tg_cos(float _Complex __x) {return ccosf(__x);}
255 static double _Complex
256 _TG_ATTRS
257 __tg_cos(double _Complex __x) {return ccos(__x);}
259 static long double _Complex
260 _TG_ATTRS
261 __tg_cos(long double _Complex __x) {return ccosl(__x);}
263 #undef cos
264 #define cos(__x) __tg_cos(__tg_promote1((__x))(__x))
266 // sin
268 static float
269 _TG_ATTRS
270 __tg_sin(float __x) {return sinf(__x);}
272 static double
273 _TG_ATTRS
274 __tg_sin(double __x) {return sin(__x);}
276 static long double
277 _TG_ATTRS
278 __tg_sin(long double __x) {return sinl(__x);}
280 static float _Complex
281 _TG_ATTRS
282 __tg_sin(float _Complex __x) {return csinf(__x);}
284 static double _Complex
285 _TG_ATTRS
286 __tg_sin(double _Complex __x) {return csin(__x);}
288 static long double _Complex
289 _TG_ATTRS
290 __tg_sin(long double _Complex __x) {return csinl(__x);}
292 #undef sin
293 #define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
295 // tan
297 static float
298 _TG_ATTRS
299 __tg_tan(float __x) {return tanf(__x);}
301 static double
302 _TG_ATTRS
303 __tg_tan(double __x) {return tan(__x);}
305 static long double
306 _TG_ATTRS
307 __tg_tan(long double __x) {return tanl(__x);}
309 static float _Complex
310 _TG_ATTRS
311 __tg_tan(float _Complex __x) {return ctanf(__x);}
313 static double _Complex
314 _TG_ATTRS
315 __tg_tan(double _Complex __x) {return ctan(__x);}
317 static long double _Complex
318 _TG_ATTRS
319 __tg_tan(long double _Complex __x) {return ctanl(__x);}
321 #undef tan
322 #define tan(__x) __tg_tan(__tg_promote1((__x))(__x))
324 // cosh
326 static float
327 _TG_ATTRS
328 __tg_cosh(float __x) {return coshf(__x);}
330 static double
331 _TG_ATTRS
332 __tg_cosh(double __x) {return cosh(__x);}
334 static long double
335 _TG_ATTRS
336 __tg_cosh(long double __x) {return coshl(__x);}
338 static float _Complex
339 _TG_ATTRS
340 __tg_cosh(float _Complex __x) {return ccoshf(__x);}
342 static double _Complex
343 _TG_ATTRS
344 __tg_cosh(double _Complex __x) {return ccosh(__x);}
346 static long double _Complex
347 _TG_ATTRS
348 __tg_cosh(long double _Complex __x) {return ccoshl(__x);}
350 #undef cosh
351 #define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x))
353 // sinh
355 static float
356 _TG_ATTRS
357 __tg_sinh(float __x) {return sinhf(__x);}
359 static double
360 _TG_ATTRS
361 __tg_sinh(double __x) {return sinh(__x);}
363 static long double
364 _TG_ATTRS
365 __tg_sinh(long double __x) {return sinhl(__x);}
367 static float _Complex
368 _TG_ATTRS
369 __tg_sinh(float _Complex __x) {return csinhf(__x);}
371 static double _Complex
372 _TG_ATTRS
373 __tg_sinh(double _Complex __x) {return csinh(__x);}
375 static long double _Complex
376 _TG_ATTRS
377 __tg_sinh(long double _Complex __x) {return csinhl(__x);}
379 #undef sinh
380 #define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x))
382 // tanh
384 static float
385 _TG_ATTRS
386 __tg_tanh(float __x) {return tanhf(__x);}
388 static double
389 _TG_ATTRS
390 __tg_tanh(double __x) {return tanh(__x);}
392 static long double
393 _TG_ATTRS
394 __tg_tanh(long double __x) {return tanhl(__x);}
396 static float _Complex
397 _TG_ATTRS
398 __tg_tanh(float _Complex __x) {return ctanhf(__x);}
400 static double _Complex
401 _TG_ATTRS
402 __tg_tanh(double _Complex __x) {return ctanh(__x);}
404 static long double _Complex
405 _TG_ATTRS
406 __tg_tanh(long double _Complex __x) {return ctanhl(__x);}
408 #undef tanh
409 #define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x))
411 // exp
413 static float
414 _TG_ATTRS
415 __tg_exp(float __x) {return expf(__x);}
417 static double
418 _TG_ATTRS
419 __tg_exp(double __x) {return exp(__x);}
421 static long double
422 _TG_ATTRS
423 __tg_exp(long double __x) {return expl(__x);}
425 static float _Complex
426 _TG_ATTRS
427 __tg_exp(float _Complex __x) {return cexpf(__x);}
429 static double _Complex
430 _TG_ATTRS
431 __tg_exp(double _Complex __x) {return cexp(__x);}
433 static long double _Complex
434 _TG_ATTRS
435 __tg_exp(long double _Complex __x) {return cexpl(__x);}
437 #undef exp
438 #define exp(__x) __tg_exp(__tg_promote1((__x))(__x))
440 // log
442 static float
443 _TG_ATTRS
444 __tg_log(float __x) {return logf(__x);}
446 static double
447 _TG_ATTRS
448 __tg_log(double __x) {return log(__x);}
450 static long double
451 _TG_ATTRS
452 __tg_log(long double __x) {return logl(__x);}
454 static float _Complex
455 _TG_ATTRS
456 __tg_log(float _Complex __x) {return clogf(__x);}
458 static double _Complex
459 _TG_ATTRS
460 __tg_log(double _Complex __x) {return clog(__x);}
462 static long double _Complex
463 _TG_ATTRS
464 __tg_log(long double _Complex __x) {return clogl(__x);}
466 #undef log
467 #define log(__x) __tg_log(__tg_promote1((__x))(__x))
469 // pow
471 static float
472 _TG_ATTRS
473 __tg_pow(float __x, float __y) {return powf(__x, __y);}
475 static double
476 _TG_ATTRS
477 __tg_pow(double __x, double __y) {return pow(__x, __y);}
479 static long double
480 _TG_ATTRS
481 __tg_pow(long double __x, long double __y) {return powl(__x, __y);}
483 static float _Complex
484 _TG_ATTRS
485 __tg_pow(float _Complex __x, float _Complex __y) {return cpowf(__x, __y);}
487 static double _Complex
488 _TG_ATTRS
489 __tg_pow(double _Complex __x, double _Complex __y) {return cpow(__x, __y);}
491 static long double _Complex
492 _TG_ATTRS
493 __tg_pow(long double _Complex __x, long double _Complex __y)
494 {return cpowl(__x, __y);}
496 #undef pow
497 #define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \
498 __tg_promote2((__x), (__y))(__y))
500 // sqrt
502 static float
503 _TG_ATTRS
504 __tg_sqrt(float __x) {return sqrtf(__x);}
506 static double
507 _TG_ATTRS
508 __tg_sqrt(double __x) {return sqrt(__x);}
510 static long double
511 _TG_ATTRS
512 __tg_sqrt(long double __x) {return sqrtl(__x);}
514 static float _Complex
515 _TG_ATTRS
516 __tg_sqrt(float _Complex __x) {return csqrtf(__x);}
518 static double _Complex
519 _TG_ATTRS
520 __tg_sqrt(double _Complex __x) {return csqrt(__x);}
522 static long double _Complex
523 _TG_ATTRS
524 __tg_sqrt(long double _Complex __x) {return csqrtl(__x);}
526 #undef sqrt
527 #define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x))
529 // fabs
531 static float
532 _TG_ATTRS
533 __tg_fabs(float __x) {return fabsf(__x);}
535 static double
536 _TG_ATTRS
537 __tg_fabs(double __x) {return fabs(__x);}
539 static long double
540 _TG_ATTRS
541 __tg_fabs(long double __x) {return fabsl(__x);}
543 static float
544 _TG_ATTRS
545 __tg_fabs(float _Complex __x) {return cabsf(__x);}
547 static double
548 _TG_ATTRS
549 __tg_fabs(double _Complex __x) {return cabs(__x);}
551 static long double
552 _TG_ATTRS
553 __tg_fabs(long double _Complex __x) {return cabsl(__x);}
555 #undef fabs
556 #define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x))
558 // atan2
560 static float
561 _TG_ATTRS
562 __tg_atan2(float __x, float __y) {return atan2f(__x, __y);}
564 static double
565 _TG_ATTRS
566 __tg_atan2(double __x, double __y) {return atan2(__x, __y);}
568 static long double
569 _TG_ATTRS
570 __tg_atan2(long double __x, long double __y) {return atan2l(__x, __y);}
572 #undef atan2
573 #define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \
574 __tg_promote2((__x), (__y))(__y))
576 // cbrt
578 static float
579 _TG_ATTRS
580 __tg_cbrt(float __x) {return cbrtf(__x);}
582 static double
583 _TG_ATTRS
584 __tg_cbrt(double __x) {return cbrt(__x);}
586 static long double
587 _TG_ATTRS
588 __tg_cbrt(long double __x) {return cbrtl(__x);}
590 #undef cbrt
591 #define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x))
593 // ceil
595 static float
596 _TG_ATTRS
597 __tg_ceil(float __x) {return ceilf(__x);}
599 static double
600 _TG_ATTRS
601 __tg_ceil(double __x) {return ceil(__x);}
603 static long double
604 _TG_ATTRS
605 __tg_ceil(long double __x) {return ceill(__x);}
607 #undef ceil
608 #define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x))
610 // copysign
612 static float
613 _TG_ATTRS
614 __tg_copysign(float __x, float __y) {return copysignf(__x, __y);}
616 static double
617 _TG_ATTRS
618 __tg_copysign(double __x, double __y) {return copysign(__x, __y);}
620 static long double
621 _TG_ATTRS
622 __tg_copysign(long double __x, long double __y) {return copysignl(__x, __y);}
624 #undef copysign
625 #define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \
626 __tg_promote2((__x), (__y))(__y))
628 // erf
630 static float
631 _TG_ATTRS
632 __tg_erf(float __x) {return erff(__x);}
634 static double
635 _TG_ATTRS
636 __tg_erf(double __x) {return erf(__x);}
638 static long double
639 _TG_ATTRS
640 __tg_erf(long double __x) {return erfl(__x);}
642 #undef erf
643 #define erf(__x) __tg_erf(__tg_promote1((__x))(__x))
645 // erfc
647 static float
648 _TG_ATTRS
649 __tg_erfc(float __x) {return erfcf(__x);}
651 static double
652 _TG_ATTRS
653 __tg_erfc(double __x) {return erfc(__x);}
655 static long double
656 _TG_ATTRS
657 __tg_erfc(long double __x) {return erfcl(__x);}
659 #undef erfc
660 #define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x))
662 // exp2
664 static float
665 _TG_ATTRS
666 __tg_exp2(float __x) {return exp2f(__x);}
668 static double
669 _TG_ATTRS
670 __tg_exp2(double __x) {return exp2(__x);}
672 static long double
673 _TG_ATTRS
674 __tg_exp2(long double __x) {return exp2l(__x);}
676 #undef exp2
677 #define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x))
679 // expm1
681 static float
682 _TG_ATTRS
683 __tg_expm1(float __x) {return expm1f(__x);}
685 static double
686 _TG_ATTRS
687 __tg_expm1(double __x) {return expm1(__x);}
689 static long double
690 _TG_ATTRS
691 __tg_expm1(long double __x) {return expm1l(__x);}
693 #undef expm1
694 #define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x))
696 // fdim
698 static float
699 _TG_ATTRS
700 __tg_fdim(float __x, float __y) {return fdimf(__x, __y);}
702 static double
703 _TG_ATTRS
704 __tg_fdim(double __x, double __y) {return fdim(__x, __y);}
706 static long double
707 _TG_ATTRS
708 __tg_fdim(long double __x, long double __y) {return fdiml(__x, __y);}
710 #undef fdim
711 #define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \
712 __tg_promote2((__x), (__y))(__y))
714 // floor
716 static float
717 _TG_ATTRS
718 __tg_floor(float __x) {return floorf(__x);}
720 static double
721 _TG_ATTRS
722 __tg_floor(double __x) {return floor(__x);}
724 static long double
725 _TG_ATTRS
726 __tg_floor(long double __x) {return floorl(__x);}
728 #undef floor
729 #define floor(__x) __tg_floor(__tg_promote1((__x))(__x))
731 // fma
733 static float
734 _TG_ATTRS
735 __tg_fma(float __x, float __y, float __z)
736 {return fmaf(__x, __y, __z);}
738 static double
739 _TG_ATTRS
740 __tg_fma(double __x, double __y, double __z)
741 {return fma(__x, __y, __z);}
743 static long double
744 _TG_ATTRS
745 __tg_fma(long double __x,long double __y, long double __z)
746 {return fmal(__x, __y, __z);}
748 #undef fma
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))
754 // fmax
756 static float
757 _TG_ATTRS
758 __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);}
760 static double
761 _TG_ATTRS
762 __tg_fmax(double __x, double __y) {return fmax(__x, __y);}
764 static long double
765 _TG_ATTRS
766 __tg_fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
768 #undef fmax
769 #define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \
770 __tg_promote2((__x), (__y))(__y))
772 // fmin
774 static float
775 _TG_ATTRS
776 __tg_fmin(float __x, float __y) {return fminf(__x, __y);}
778 static double
779 _TG_ATTRS
780 __tg_fmin(double __x, double __y) {return fmin(__x, __y);}
782 static long double
783 _TG_ATTRS
784 __tg_fmin(long double __x, long double __y) {return fminl(__x, __y);}
786 #undef fmin
787 #define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \
788 __tg_promote2((__x), (__y))(__y))
790 // fmod
792 static float
793 _TG_ATTRS
794 __tg_fmod(float __x, float __y) {return fmodf(__x, __y);}
796 static double
797 _TG_ATTRS
798 __tg_fmod(double __x, double __y) {return fmod(__x, __y);}
800 static long double
801 _TG_ATTRS
802 __tg_fmod(long double __x, long double __y) {return fmodl(__x, __y);}
804 #undef fmod
805 #define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \
806 __tg_promote2((__x), (__y))(__y))
808 // frexp
810 static float
811 _TG_ATTRS
812 __tg_frexp(float __x, int* __y) {return frexpf(__x, __y);}
814 static double
815 _TG_ATTRS
816 __tg_frexp(double __x, int* __y) {return frexp(__x, __y);}
818 static long double
819 _TG_ATTRS
820 __tg_frexp(long double __x, int* __y) {return frexpl(__x, __y);}
822 #undef frexp
823 #define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y)
825 // hypot
827 static float
828 _TG_ATTRS
829 __tg_hypot(float __x, float __y) {return hypotf(__x, __y);}
831 static double
832 _TG_ATTRS
833 __tg_hypot(double __x, double __y) {return hypot(__x, __y);}
835 static long double
836 _TG_ATTRS
837 __tg_hypot(long double __x, long double __y) {return hypotl(__x, __y);}
839 #undef hypot
840 #define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \
841 __tg_promote2((__x), (__y))(__y))
843 // ilogb
845 static int
846 _TG_ATTRS
847 __tg_ilogb(float __x) {return ilogbf(__x);}
849 static int
850 _TG_ATTRS
851 __tg_ilogb(double __x) {return ilogb(__x);}
853 static int
854 _TG_ATTRS
855 __tg_ilogb(long double __x) {return ilogbl(__x);}
857 #undef ilogb
858 #define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x))
860 // ldexp
862 static float
863 _TG_ATTRS
864 __tg_ldexp(float __x, int __y) {return ldexpf(__x, __y);}
866 static double
867 _TG_ATTRS
868 __tg_ldexp(double __x, int __y) {return ldexp(__x, __y);}
870 static long double
871 _TG_ATTRS
872 __tg_ldexp(long double __x, int __y) {return ldexpl(__x, __y);}
874 #undef ldexp
875 #define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y)
877 // lgamma
879 static float
880 _TG_ATTRS
881 __tg_lgamma(float __x) {return lgammaf(__x);}
883 static double
884 _TG_ATTRS
885 __tg_lgamma(double __x) {return lgamma(__x);}
887 static long double
888 _TG_ATTRS
889 __tg_lgamma(long double __x) {return lgammal(__x);}
891 #undef lgamma
892 #define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x))
894 // llrint
896 static long long
897 _TG_ATTRS
898 __tg_llrint(float __x) {return llrintf(__x);}
900 static long long
901 _TG_ATTRS
902 __tg_llrint(double __x) {return llrint(__x);}
904 static long long
905 _TG_ATTRS
906 __tg_llrint(long double __x) {return llrintl(__x);}
908 #undef llrint
909 #define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x))
911 // llround
913 static long long
914 _TG_ATTRS
915 __tg_llround(float __x) {return llroundf(__x);}
917 static long long
918 _TG_ATTRS
919 __tg_llround(double __x) {return llround(__x);}
921 static long long
922 _TG_ATTRS
923 __tg_llround(long double __x) {return llroundl(__x);}
925 #undef llround
926 #define llround(__x) __tg_llround(__tg_promote1((__x))(__x))
928 // log10
930 static float
931 _TG_ATTRS
932 __tg_log10(float __x) {return log10f(__x);}
934 static double
935 _TG_ATTRS
936 __tg_log10(double __x) {return log10(__x);}
938 static long double
939 _TG_ATTRS
940 __tg_log10(long double __x) {return log10l(__x);}
942 #undef log10
943 #define log10(__x) __tg_log10(__tg_promote1((__x))(__x))
945 // log1p
947 static float
948 _TG_ATTRS
949 __tg_log1p(float __x) {return log1pf(__x);}
951 static double
952 _TG_ATTRS
953 __tg_log1p(double __x) {return log1p(__x);}
955 static long double
956 _TG_ATTRS
957 __tg_log1p(long double __x) {return log1pl(__x);}
959 #undef log1p
960 #define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x))
962 // log2
964 static float
965 _TG_ATTRS
966 __tg_log2(float __x) {return log2f(__x);}
968 static double
969 _TG_ATTRS
970 __tg_log2(double __x) {return log2(__x);}
972 static long double
973 _TG_ATTRS
974 __tg_log2(long double __x) {return log2l(__x);}
976 #undef log2
977 #define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
979 // logb
981 static float
982 _TG_ATTRS
983 __tg_logb(float __x) {return logbf(__x);}
985 static double
986 _TG_ATTRS
987 __tg_logb(double __x) {return logb(__x);}
989 static long double
990 _TG_ATTRS
991 __tg_logb(long double __x) {return logbl(__x);}
993 #undef logb
994 #define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
996 // lrint
998 static long
999 _TG_ATTRS
1000 __tg_lrint(float __x) {return lrintf(__x);}
1002 static long
1003 _TG_ATTRS
1004 __tg_lrint(double __x) {return lrint(__x);}
1006 static long
1007 _TG_ATTRS
1008 __tg_lrint(long double __x) {return lrintl(__x);}
1010 #undef lrint
1011 #define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x))
1013 // lround
1015 static long
1016 _TG_ATTRS
1017 __tg_lround(float __x) {return lroundf(__x);}
1019 static long
1020 _TG_ATTRS
1021 __tg_lround(double __x) {return lround(__x);}
1023 static long
1024 _TG_ATTRS
1025 __tg_lround(long double __x) {return lroundl(__x);}
1027 #undef lround
1028 #define lround(__x) __tg_lround(__tg_promote1((__x))(__x))
1030 // nearbyint
1032 static float
1033 _TG_ATTRS
1034 __tg_nearbyint(float __x) {return nearbyintf(__x);}
1036 static double
1037 _TG_ATTRS
1038 __tg_nearbyint(double __x) {return nearbyint(__x);}
1040 static long double
1041 _TG_ATTRS
1042 __tg_nearbyint(long double __x) {return nearbyintl(__x);}
1044 #undef nearbyint
1045 #define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x))
1047 // nextafter
1049 static float
1050 _TG_ATTRS
1051 __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);}
1053 static double
1054 _TG_ATTRS
1055 __tg_nextafter(double __x, double __y) {return nextafter(__x, __y);}
1057 static long double
1058 _TG_ATTRS
1059 __tg_nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
1061 #undef nextafter
1062 #define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \
1063 __tg_promote2((__x), (__y))(__y))
1065 // nexttoward
1067 static float
1068 _TG_ATTRS
1069 __tg_nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
1071 static double
1072 _TG_ATTRS
1073 __tg_nexttoward(double __x, long double __y) {return nexttoward(__x, __y);}
1075 static long double
1076 _TG_ATTRS
1077 __tg_nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
1079 #undef nexttoward
1080 #define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y))
1082 // remainder
1084 static float
1085 _TG_ATTRS
1086 __tg_remainder(float __x, float __y) {return remainderf(__x, __y);}
1088 static double
1089 _TG_ATTRS
1090 __tg_remainder(double __x, double __y) {return remainder(__x, __y);}
1092 static long double
1093 _TG_ATTRS
1094 __tg_remainder(long double __x, long double __y) {return remainderl(__x, __y);}
1096 #undef remainder
1097 #define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \
1098 __tg_promote2((__x), (__y))(__y))
1100 // remquo
1102 static float
1103 _TG_ATTRS
1104 __tg_remquo(float __x, float __y, int* __z)
1105 {return remquof(__x, __y, __z);}
1107 static double
1108 _TG_ATTRS
1109 __tg_remquo(double __x, double __y, int* __z)
1110 {return remquo(__x, __y, __z);}
1112 static long double
1113 _TG_ATTRS
1114 __tg_remquo(long double __x,long double __y, int* __z)
1115 {return remquol(__x, __y, __z);}
1117 #undef remquo
1118 #define remquo(__x, __y, __z) \
1119 __tg_remquo(__tg_promote2((__x), (__y))(__x), \
1120 __tg_promote2((__x), (__y))(__y), \
1121 (__z))
1123 // rint
1125 static float
1126 _TG_ATTRS
1127 __tg_rint(float __x) {return rintf(__x);}
1129 static double
1130 _TG_ATTRS
1131 __tg_rint(double __x) {return rint(__x);}
1133 static long double
1134 _TG_ATTRS
1135 __tg_rint(long double __x) {return rintl(__x);}
1137 #undef rint
1138 #define rint(__x) __tg_rint(__tg_promote1((__x))(__x))
1140 // round
1142 static float
1143 _TG_ATTRS
1144 __tg_round(float __x) {return roundf(__x);}
1146 static double
1147 _TG_ATTRS
1148 __tg_round(double __x) {return round(__x);}
1150 static long double
1151 _TG_ATTRS
1152 __tg_round(long double __x) {return roundl(__x);}
1154 #undef round
1155 #define round(__x) __tg_round(__tg_promote1((__x))(__x))
1157 // scalbn
1159 static float
1160 _TG_ATTRS
1161 __tg_scalbn(float __x, int __y) {return scalbnf(__x, __y);}
1163 static double
1164 _TG_ATTRS
1165 __tg_scalbn(double __x, int __y) {return scalbn(__x, __y);}
1167 static long double
1168 _TG_ATTRS
1169 __tg_scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
1171 #undef scalbn
1172 #define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y)
1174 // scalbln
1176 static float
1177 _TG_ATTRS
1178 __tg_scalbln(float __x, long __y) {return scalblnf(__x, __y);}
1180 static double
1181 _TG_ATTRS
1182 __tg_scalbln(double __x, long __y) {return scalbln(__x, __y);}
1184 static long double
1185 _TG_ATTRS
1186 __tg_scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
1188 #undef scalbln
1189 #define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y)
1191 // tgamma
1193 static float
1194 _TG_ATTRS
1195 __tg_tgamma(float __x) {return tgammaf(__x);}
1197 static double
1198 _TG_ATTRS
1199 __tg_tgamma(double __x) {return tgamma(__x);}
1201 static long double
1202 _TG_ATTRS
1203 __tg_tgamma(long double __x) {return tgammal(__x);}
1205 #undef tgamma
1206 #define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x))
1208 // trunc
1210 static float
1211 _TG_ATTRS
1212 __tg_trunc(float __x) {return truncf(__x);}
1214 static double
1215 _TG_ATTRS
1216 __tg_trunc(double __x) {return trunc(__x);}
1218 static long double
1219 _TG_ATTRS
1220 __tg_trunc(long double __x) {return truncl(__x);}
1222 #undef trunc
1223 #define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x))
1225 // carg
1227 static float
1228 _TG_ATTRS
1229 __tg_carg(float __x) {return atan2f(0.F, __x);}
1231 static double
1232 _TG_ATTRS
1233 __tg_carg(double __x) {return atan2(0., __x);}
1235 static long double
1236 _TG_ATTRS
1237 __tg_carg(long double __x) {return atan2l(0.L, __x);}
1239 static float
1240 _TG_ATTRS
1241 __tg_carg(float _Complex __x) {return cargf(__x);}
1243 static double
1244 _TG_ATTRS
1245 __tg_carg(double _Complex __x) {return carg(__x);}
1247 static long double
1248 _TG_ATTRS
1249 __tg_carg(long double _Complex __x) {return cargl(__x);}
1251 #undef carg
1252 #define carg(__x) __tg_carg(__tg_promote1((__x))(__x))
1254 // cimag
1256 static float
1257 _TG_ATTRS
1258 __tg_cimag(float __x) {return 0;}
1260 static double
1261 _TG_ATTRS
1262 __tg_cimag(double __x) {return 0;}
1264 static long double
1265 _TG_ATTRS
1266 __tg_cimag(long double __x) {return 0;}
1268 static float
1269 _TG_ATTRS
1270 __tg_cimag(float _Complex __x) {return cimagf(__x);}
1272 static double
1273 _TG_ATTRS
1274 __tg_cimag(double _Complex __x) {return cimag(__x);}
1276 static long double
1277 _TG_ATTRS
1278 __tg_cimag(long double _Complex __x) {return cimagl(__x);}
1280 #undef cimag
1281 #define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x))
1283 // conj
1285 static float _Complex
1286 _TG_ATTRS
1287 __tg_conj(float __x) {return __x;}
1289 static double _Complex
1290 _TG_ATTRS
1291 __tg_conj(double __x) {return __x;}
1293 static long double _Complex
1294 _TG_ATTRS
1295 __tg_conj(long double __x) {return __x;}
1297 static float _Complex
1298 _TG_ATTRS
1299 __tg_conj(float _Complex __x) {return conjf(__x);}
1301 static double _Complex
1302 _TG_ATTRS
1303 __tg_conj(double _Complex __x) {return conj(__x);}
1305 static long double _Complex
1306 _TG_ATTRS
1307 __tg_conj(long double _Complex __x) {return conjl(__x);}
1309 #undef conj
1310 #define conj(__x) __tg_conj(__tg_promote1((__x))(__x))
1312 // cproj
1314 static float _Complex
1315 _TG_ATTRS
1316 __tg_cproj(float __x) {return cprojf(__x);}
1318 static double _Complex
1319 _TG_ATTRS
1320 __tg_cproj(double __x) {return cproj(__x);}
1322 static long double _Complex
1323 _TG_ATTRS
1324 __tg_cproj(long double __x) {return cprojl(__x);}
1326 static float _Complex
1327 _TG_ATTRS
1328 __tg_cproj(float _Complex __x) {return cprojf(__x);}
1330 static double _Complex
1331 _TG_ATTRS
1332 __tg_cproj(double _Complex __x) {return cproj(__x);}
1334 static long double _Complex
1335 _TG_ATTRS
1336 __tg_cproj(long double _Complex __x) {return cprojl(__x);}
1338 #undef cproj
1339 #define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x))
1341 // creal
1343 static float
1344 _TG_ATTRS
1345 __tg_creal(float __x) {return __x;}
1347 static double
1348 _TG_ATTRS
1349 __tg_creal(double __x) {return __x;}
1351 static long double
1352 _TG_ATTRS
1353 __tg_creal(long double __x) {return __x;}
1355 static float
1356 _TG_ATTRS
1357 __tg_creal(float _Complex __x) {return crealf(__x);}
1359 static double
1360 _TG_ATTRS
1361 __tg_creal(double _Complex __x) {return creal(__x);}
1363 static long double
1364 _TG_ATTRS
1365 __tg_creal(long double _Complex __x) {return creall(__x);}
1367 #undef creal
1368 #define creal(__x) __tg_creal(__tg_promote1((__x))(__x))
1370 #undef _TG_ATTRSp
1371 #undef _TG_ATTRS
1373 #endif /* __cplusplus */
1374 #endif /* __TGMATH_H */