liveBook · Manning

Tgmath.h

tgmath.h is the C standard header providing type-generic macros that select mathematical functions according to argument types.

How 2 Manning books explain it

Modern C

tgmath.h is the C standard header that provides type-generic macros for mathematical functions.

How it is used
Provides one type-generic interface for invoking mathematical operations across numeric argument types.
How deep it goes
Explains type-based dispatch and surveys function families, but defers detailed descriptions of the complete macro set.
Examples
Uses fabs in an iterative Heron approximation that computes multiplicative inverses and tests absolute error against a tolerance.
What you can do after
Apply it via <tgmath.h> macros and select established numerical operations instead of reimplementing them by hand.

Read how Modern C explains tgmath.h →

Modern C, Third Edition

tgmath is the C type-generic mathematics facility that provides interfaces selecting numerical functions according to argument types.

How it is used
Provides type-appropriate interfaces for numerical calculations while reducing the need to select floating-point variants manually.
How deep it goes
Explains argument-based dispatch and implementation rationale, but does not enumerate every macro or specify dispatch mechanics in detail.
Examples
Uses fabs in a Heron-approximation loop that computes multiplicative inverses from command-line numbers.
What you can do after
Apply it via <tgmath.h> macros and choose established numerical interfaces instead of reimplementing floating-point operations.

Read how Modern C, Third Edition explains tgmath.h →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.