source: Daodan/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/11.2.0/include/tgmath.h@ 1171

Last change on this file since 1171 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 5.3 KB
Line 
1/* Copyright (C) 2004-2021 Free Software Foundation, Inc.
2 Contributed by Apple, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23<http://www.gnu.org/licenses/>. */
24
25/*
26 * ISO C Standard: 7.22 Type-generic math <tgmath.h>
27 */
28
29#ifndef _TGMATH_H
30#define _TGMATH_H
31
32#include <math.h>
33
34#ifndef __cplusplus
35#include <complex.h>
36
37/* Naming convention: generic macros are defining using
38 __TGMATH_CPLX*, __TGMATH_REAL*, and __TGMATH_CPLX_ONLY. _CPLX
39 means the generic argument(s) may be real or complex, _REAL means
40 real only, _CPLX means complex only. If there is no suffix, we are
41 defining a function of one argument. If the suffix is _n
42 it is a function of n arguments. We only define these macros for
43 values of n that are needed. */
44
45#define __TGMATH_CPLX(z,R,C) \
46 __builtin_tgmath (R##f, R, R##l, C##f, C, C##l, (z))
47
48#define __TGMATH_CPLX_2(z1,z2,R,C) \
49 __builtin_tgmath (R##f, R, R##l, C##f, C, C##l, (z1), (z2))
50
51#define __TGMATH_REAL(x,R) \
52 __builtin_tgmath (R##f, R, R##l, (x))
53#define __TGMATH_REAL_2(x,y,R) \
54 __builtin_tgmath (R##f, R, R##l, (x), (y))
55#define __TGMATH_REAL_3(x,y,z,R) \
56 __builtin_tgmath (R##f, R, R##l, (x), (y), (z))
57#define __TGMATH_CPLX_ONLY(z,C) \
58 __builtin_tgmath (C##f, C, C##l, (z))
59
60/* Functions defined in both <math.h> and <complex.h> (7.22p4) */
61#define acos(z) __TGMATH_CPLX(z, acos, cacos)
62#define asin(z) __TGMATH_CPLX(z, asin, casin)
63#define atan(z) __TGMATH_CPLX(z, atan, catan)
64#define acosh(z) __TGMATH_CPLX(z, acosh, cacosh)
65#define asinh(z) __TGMATH_CPLX(z, asinh, casinh)
66#define atanh(z) __TGMATH_CPLX(z, atanh, catanh)
67#define cos(z) __TGMATH_CPLX(z, cos, ccos)
68#define sin(z) __TGMATH_CPLX(z, sin, csin)
69#define tan(z) __TGMATH_CPLX(z, tan, ctan)
70#define cosh(z) __TGMATH_CPLX(z, cosh, ccosh)
71#define sinh(z) __TGMATH_CPLX(z, sinh, csinh)
72#define tanh(z) __TGMATH_CPLX(z, tanh, ctanh)
73#define exp(z) __TGMATH_CPLX(z, exp, cexp)
74#define log(z) __TGMATH_CPLX(z, log, clog)
75#define pow(z1,z2) __TGMATH_CPLX_2(z1, z2, pow, cpow)
76#define sqrt(z) __TGMATH_CPLX(z, sqrt, csqrt)
77#define fabs(z) __TGMATH_CPLX(z, fabs, cabs)
78
79/* Functions defined in <math.h> only (7.22p5) */
80#define atan2(x,y) __TGMATH_REAL_2(x, y, atan2)
81#define cbrt(x) __TGMATH_REAL(x, cbrt)
82#define ceil(x) __TGMATH_REAL(x, ceil)
83#define copysign(x,y) __TGMATH_REAL_2(x, y, copysign)
84#define erf(x) __TGMATH_REAL(x, erf)
85#define erfc(x) __TGMATH_REAL(x, erfc)
86#define exp2(x) __TGMATH_REAL(x, exp2)
87#define expm1(x) __TGMATH_REAL(x, expm1)
88#define fdim(x,y) __TGMATH_REAL_2(x, y, fdim)
89#define floor(x) __TGMATH_REAL(x, floor)
90#define fma(x,y,z) __TGMATH_REAL_3(x, y, z, fma)
91#define fmax(x,y) __TGMATH_REAL_2(x, y, fmax)
92#define fmin(x,y) __TGMATH_REAL_2(x, y, fmin)
93#define fmod(x,y) __TGMATH_REAL_2(x, y, fmod)
94#define frexp(x,y) __TGMATH_REAL_2(x, y, frexp)
95#define hypot(x,y) __TGMATH_REAL_2(x, y, hypot)
96#define ilogb(x) __TGMATH_REAL(x, ilogb)
97#define ldexp(x,y) __TGMATH_REAL_2(x, y, ldexp)
98#define lgamma(x) __TGMATH_REAL(x, lgamma)
99#define llrint(x) __TGMATH_REAL(x, llrint)
100#define llround(x) __TGMATH_REAL(x, llround)
101#define log10(x) __TGMATH_REAL(x, log10)
102#define log1p(x) __TGMATH_REAL(x, log1p)
103#define log2(x) __TGMATH_REAL(x, log2)
104#define logb(x) __TGMATH_REAL(x, logb)
105#define lrint(x) __TGMATH_REAL(x, lrint)
106#define lround(x) __TGMATH_REAL(x, lround)
107#define nearbyint(x) __TGMATH_REAL(x, nearbyint)
108#define nextafter(x,y) __TGMATH_REAL_2(x, y, nextafter)
109#define nexttoward(x,y) __TGMATH_REAL_2(x, y, nexttoward)
110#define remainder(x,y) __TGMATH_REAL_2(x, y, remainder)
111#define remquo(x,y,z) __TGMATH_REAL_3(x, y, z, remquo)
112#define rint(x) __TGMATH_REAL(x, rint)
113#define round(x) __TGMATH_REAL(x, round)
114#define scalbn(x,y) __TGMATH_REAL_2(x, y, scalbn)
115#define scalbln(x,y) __TGMATH_REAL_2(x, y, scalbln)
116#define tgamma(x) __TGMATH_REAL(x, tgamma)
117#define trunc(x) __TGMATH_REAL(x, trunc)
118
119/* Functions defined in <complex.h> only (7.22p6) */
120#define carg(z) __TGMATH_CPLX_ONLY(z, carg)
121#define cimag(z) __TGMATH_CPLX_ONLY(z, cimag)
122#define conj(z) __TGMATH_CPLX_ONLY(z, conj)
123#define cproj(z) __TGMATH_CPLX_ONLY(z, cproj)
124#define creal(z) __TGMATH_CPLX_ONLY(z, creal)
125
126#endif /* __cplusplus */
127#endif /* _TGMATH_H */
Note: See TracBrowser for help on using the repository browser.