:man| Alphabetical   Categories   About us 
 
TGMATH (3) | C library functions | Unix Manual Pages | :man

NAME

tgmath - "type-generic macros"

CONTENTS

Synopsis
Description
Standards
History
Bugs

SYNOPSIS


.In tgmath.h

DESCRIPTION

The header
.In tgmath.h provides type-generic macros for
.In math.h and
.In complex.h functions that have
.Vt float (suffixed with f),
.Vt double and
.Vt "long double" (suffixed with l) versions. The arguments that vary across the three functions and have type
.Vt float , double and
.Vt "long double" , respectively, are called "generic arguments".

The following rules describe which function is actually called if a type-generic macro is invoked. If any generic argument has type
.Vt "long double" or
.Vt "long double complex" , the
.Vt "long double" function is called. Else, if any generic argument has type
.Vt double , "double complex" or an integer type, the
.Vt double version is invoked. Otherwise, the macro expands to the
.Vt float implementation.

For the macros in the following table, both real and complex functions exist. The real functions are prototyped in
.In math.h and the complex equivalents in
.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
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
.In complex.h and
.In math.h .

STANDARDS

The header
.In tgmath.h conforms to -isoC-99.

HISTORY

The header
.In tgmath.h first appeared in
.Fx 5.3 .

BUGS

The header
.In 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
.In math.h or
.In complex.h as they are not yet implemented.

August 14, 2004 TGMATH (3)
shtml">manServer 1.07 from tgmath.3 using doc macros.


Share this page

     Follow us

Facebook Twitter Google+ LinkedIn


 
Created by Blin Media, 2008-2013