tgmath.h
The header tgmath.h includes the headers math.h and complex.h and defines a number of type-generic macros. This requires the compiler that is designed to support C99.
Use of the macro invokes a function whose corresponding
real type and type domain are determined by the arguments for the
generic parameters. If there is more than one real floating type
argument, usual arithmetic conversions are applied to the real floating
type arguments so that they have compatible types. Then,
- If any argument has type _Decimal128, the type determined is _Decimal128.
- Otherwise, if any argument has type _Decimal64, the type determined is _Decimal64.
- Otherwise, if any argument has type _Decimal32, the type determined is _Decimal32.
- Otherwise, if any argument has type long double, the type determined is long double.
- Otherwise, if any argument has type double or is of integer type, the type determined is double.
- Otherwise, if none of the above the type determined is float.
All the functions in math.h and complex.h have their corresponding
type generic macros in this header where if for a function in math.h,
there is a corresponding c prefixed function in complex.h, then the
corresponding type generic macro has the same name as the one in math.h.
The macros are:
acos | acosh | asin | asinh | atan | atan2 |
---|---|---|---|---|---|
atanh | carg | cbrt | ceil | cimag | conj |
copysign | cos | cosh | cproj | creal | erf |
erfc | exp | exp2 | expm1 | fabs | fdim |
floor | fma | fmax | fmin | fmod | frexp |
hypot | ilogb | ldexp | lgamma | llrint | llround |
log | log10 | log1p | log2 | logb | lrint |
lround | nearbyint | nextafter | nexttoward | pow | remainder |
remquo | rint | round | scalbln | scalbn | sin |
sinh | sqrt | tan | tanh | tgamma | trunc |
quantize() | samequantum() |
[1] The following type-generic macros are not supported for decimal-floating point types: carg(), cimag(), conj(), cproj(), creal().
Restrictions:
- This header does not support the _FP_MODE_VARIABLE feature test macro.
- This header is not supported for C++ applications.
For example:
- The macro exp(int n) invokes the function exp(int n)
- The macro acosh(float f) invokes the function acoshf(float f)
- The macro log(float complex fc) invokes the complex function clogf(float complex fc)
- The macro pow(double complex dc, float f) invokes cpow(double complex dc, float f)
)