tgmath(3)

NAME

tgmath - type-generic macros

SYNOPSIS

#include <tgmath.h>

DESCRIPTION

The header #include <tgmath.h>
provides type-generic macros for #include <math.h> and #include <complex.h>
functions that have float (suffixed with f), double and long
double (suffixed with l) versions. The arguments that vary across the
three functions and have type float, double and long double, respec
tively, are
called generic arguments.
The following rules describe which function is actually
called if a typegeneric 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 inte
ger 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 #include
<math.h>
and the complex equivalents in 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()
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() nextbyint()
trunc()
fdim() lgamma() nextafter() floor() llrint() nexttoward()
The following macros always expand to a complex function:

carg() cimag() conj() cproj()
creal()
This header includes #include <complex.h> and

STANDARDS

The header #include <tgmath.h>
conforms to ISO/IEC 9899:1999 (``ISO C99'').

HISTORY

The header #include <tgmath.h>
first appeared in FreeBSD 5.3.

BUGS

The header #include <tgmath.h>
cannot be implemented with strictly conforming C code and
needs special
compiler support. The current implementation only works for
GCC.
Many of the functions mentioned here are not prototyped in
#include
<math.h>
or #include <complex.h>
as they are not yet implemented.
BSD August 14, 2004
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout