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