Main index | Section 3 | Options |
#include <tgmath.h>
The following rules describe which function is actually called if a type-generic macro is invoked. If any generic argument has type long double or long double complex, the long double function is called. Else, if any generic argument has type double, double complex or an integer type, the double version is invoked. Otherwise, the macro expands to the float implementation.
For the macros in the following table, both real and complex functions exist. The real functions are prototyped in <math.h> and the complex equivalents in <complex.h>. The complex function is called if any of the generic arguments is a complex value. Otherwise, the real equivalent is called.
Macro | real function | complex function |
acos() | acos() | cacos() |
asin() | asin() | casin() |
atan() | atan() | catan() |
acosh() | acosh() | cacosh() |
asinh() | asinh() | casinh() |
atanh() | atanh() | catanh() |
cos() | cos() | ccos() |
sin() | sin() | csin() |
tan() | tan() | ctan() |
cosh() | cosh() | ccosh() |
sinh() | sinh() | csinh() |
tanh() | tanh() | ctanh() |
exp() | exp() | cexp() |
log() | log() | clog() |
pow() | pow() | cpow() |
sqrt() | sqrt() | csqrt() |
fabs() | fabs() | cabs() |
No complex functions exist for the following macros, so passing a complex value to a generic argument invokes undefined behaviour:
atan2() | fma() | llround() | remainder() |
cbrt() | fmax() | log10() | remquo() |
ceil() | fmin() | log1p() | rint() |
copysign() | fmod() | log2() | round() |
erf() | frexp() | logb() | scalbn() |
erfc() | hypot() | lrint() | scalbln() |
exp2() | ilogb() | lround() | tgamma() |
expm1() | ldexp() | nearbyint() | trunc() |
fdim() | lgamma() | nextafter() | amp; |
floor() | llrint() | nexttoward() | amp; |
The following macros always expand to a complex function:
carg() | cimag() | conj() | cproj() | creal() |
This header includes <complex.h> and <math.h>.
TGMATH (3) | January 4, 2012 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.