# **[](https://en.cppreference.com/w/c/header/float)** defines platform-specific floating-point limits: `DBL_EPSILON` (smallest difference from 1.0), `DBL_MAX`, `DBL_MIN`, and precision constants. Essential for writing numerically robust code across platforms. Use `DBL_EPSILON` as the basis for floating-point comparisons instead of exact equality. ## Example This example demonstrates machine epsilon and shows the limits of floating-point representation. ```c // compile: gcc -o floatexample floatexample.c // run: ./floatexample // description: query floating-point limits and test epsilon #include #include #include int main() { printf("DBL_EPSILON = %.2e\n", DBL_EPSILON); printf("1.0 + DBL_EPSILON != 1.0: %s\n", (1.0 + DBL_EPSILON != 1.0) ? "true" : "false"); printf("1.0 + DBL_EPSILON/2 != 1.0: %s\n", (1.0 + DBL_EPSILON/2 != 1.0) ? "true" : "false"); printf("DBL_MAX = %.6e\n", DBL_MAX); printf("DBL_MIN = %.6e\n", DBL_MIN); printf("DBL_DIG = %d decimal digits\n", DBL_DIG); return 0; } ``` ## Common macros **Double precision:** - `DBL_EPSILON`: smallest x where 1.0 + x != 1.0 - `DBL_MAX`, `DBL_MIN`: largest/smallest representable values - `DBL_DIG`: decimal digits of precision - `DBL_MANT_DIG`: mantissa digits - `DBL_MAX_EXP`, `DBL_MIN_EXP`: exponent bounds **Float versions** (FLT_* prefix): - `FLT_EPSILON`, `FLT_MAX`, `FLT_MIN`, etc. **Long double versions** (LDBL_* prefix): - `LDBL_EPSILON`, `LDBL_MAX`, `LDBL_MIN`, etc.