Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tgmath(3) [netbsd man page]

TGMATH(3)						   BSD Library Functions Manual 						 TGMATH(3)

NAME
tgmath -- type-generic macros SYNOPSIS
#include <tgmath.h> DESCRIPTION
The header <tgmath.h> provides type-generic macros for <math.h> and <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 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 equiva- lent is called. Macro Real function Complex function acos() acos(3) cacos(3) asin() asin(3) casin(3) atan() atan(3) catan(3) acosh() acosh(3) cacosh(3) asinh() asinh(3) casinh(3) atanh() atanh(3) catanh(3) cos() cos(3) ccos(3) sin() sin(3) csin(3) tan() tan(3) ctan(3) cosh() cosh(3) ccosh(3) sinh() sinh(3) csinh(3) tanh() tanh(3) ctanh(3) exp() exp(3) cexp(3) log() log(3) clog(3) pow() pow(3) cpow(3) sqrt() sqrt(3) csqrt(3) fabs() fabs(3) cabs(3) No complex functions exist for the following macros, so passing a complex value to a generic argument invokes undefined behaviour: atan2(3) fma() llround() remainder(3) cbrt(3) fmax(3) log10(3) remquo() ceil(3) fmin(3) log1p(3) rint(3) copysign(3) fmod(3) log2(3) round(3) erf(3) frexp(3) logb(3) scalbn(3) erfc(3) hypot(3) lrint(3) tgamma() exp2(3) ilogb(3) lround() trunc(3) expm1(3) ldexp(3) nextafter(3) fdim(3) lgamma(3) floor(3) llrint(3) The following macros always expand to a complex function: carg(3) cimag(3) conj(3) cproj() creal(3) This header includes <complex.h> and <math.h>. STANDARDS
The header <tgmath.h> conforms to ISO/IEC 9899:1999 (``ISO C99''). AUTHORS
Matt Thomas <matt@3am-software.com> BUGS
The header <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 <math.h> or <complex.h> as they are not yet implemented. BSD
December 14, 2010 BSD

Check Out this Related Man Page

tgmath.h(3HEAD) 						      Headers							   tgmath.h(3HEAD)

NAME
tgmath.h, tgmath - type-generic macros SYNOPSIS
#include <tgmath.h> DESCRIPTION
The <tgmath.h> header includes the headers <math.h> and <complex.h> and defines several type-generic macros. Of the functions contained within the <math.h> and <complex.h> headers without an f (float) or l (long double) suffix, several have one or more parameters whose corresponding real type is double. For each such function except modf(3M), there is a corresponding type-generic macro. The parameters whose corresponding real type is double in the function synopsis are generic parameters. Use of the macro invokes a function whose corresponding real type and type domain are determined by the arguments for the generic parameters. Use of the macro invokes a function whose generic parameters have the corresponding real type determined as follows: o First, if any argument for generic parameters has type long double, the type determined is long double. o Otherwise, if any argument for generic parameters has type double or is of integer type, the type determined is double. o Otherwise, the type determined is float. For each unsuffixed function in the <math.h> header for which there is a function in the <complex.h> header with the same name except for a c prefix, the corresponding type-generic macro (for both functions) has the same name as the function in the <math.h> header. The corre- sponding type-generic macro for fabs() and cabs() is fabs(). <math.h> Function <complex.h> Function Type-Generic Macro acos() cacos() acos() asin() casin() asin() atan() catan() atan() acosh() cacosh() acosh() asinh() casinh() asinh() atanh() catanh() atanh() cos() ccos() cos() sin() csin() sin() tan() ctan() tan() cosh() ccosh() cosh() sinh() csinh() sinh() tanh() ctanh() tanh() exp() cexp() exp() log() clog() log() pow() cpow() pow() sqrt() csqrt() sqrt() fabs() cfabs() fabs() If at least one argument for a generic parameter is complex, then use of the macro invokes a complex function; otherwise, use of the macro invokes a real function. For each unsuffixed function in the <math.h> header without a c-prefixed counterpart in the <complex.h> header, the corresponding type- generic macro has the same name as the function. These type-generic macros are: 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() floor() llrint() nexttoward() If all arguments for generic parameters are real, then use of the macro invokes a real function; otherwise, use of the macro results in undefined behavior. For each unsuffixed function in the <complex.h> header that is not a c-prefixed counterpart to a function in the <math.h> header, the cor- responding type-generic macro has the same name as the function. These type-generic macros are: carg() cimag() conj() cproj() creal() Use of the macro with any real or complex argument invokes a complex function. USAGE
Functions invoked by use of type-generic macros are invoked with the declarations listed below. #include <tgmath.h> int n; float f; double d; long double ld; float complex fc; double complex dc; long double complex ldc; The following are the type-generic macros that invoke the functions that are invoked with the preceding declarations. Macro Use Invokes exp(n) exp(n), the function acosh(f) acoshf(f) sin(d) sin(d), the function atan(ld) atanl(ld) log(fc) clogf(fc) sqrt(dc) csqrt(dc) pow(ldc,f) cpowl(ldc, f) remainder(n,n) remainder(n, n), the function nextafter(d,f) nextafter(d, f), the function nexttoward(f,ld) nexttowardf(f, ld) copysign(n,ld) copysignl(n, ld) ceil(fc) undefined behavior rint(dc) undefined behavior fmax(ldc,ld) undefined behavior carg(n) carg(n), the function cproj(f) cprojf(f) creal(d) creal(d), the function cimag(ld) cimagl(ld) cabs(fc) cabsf(fc) carg(dc) carg(dc), the function cproj(ldc) cprojl(ldc) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
modf(3M), complex.h(3HEAD), math.h(3HEAD), cabs(3M), fabs(3M), attributes(5), standards(5) SunOS 5.10 17 Dec 2003 tgmath.h(3HEAD)
Man Page