Type-Generic Macros
The type-generic macros defined in header file tgmath.h are unified names that can be used to call the different mathematical functions for specific real and complex floating types.
If a given function is defined for real or for both real and complex
floating types, then the type-generic macro name is the same as the
name of the function version with type double.
(The real function modf() is an exception,
however, for which there is no type-generic macro.)
The type-generic macros always call the function that matches the type of the arguments. For example:
complex z = 1.0 + 2.1*I; cos( z ); // Calls ccos() ceil( 7.1L ); // Calls ceill()
Type-generic macros are also defined for the complex functions for
which there are no corresponding real functions:
carg(), conj(),
creal(), cimag(), and
cproj(). These macros always call the
corresponding complex function, if the argument is a real
floating-point number or a complex number.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access