On this page
DBL_EPSILON
Prev: CHAR_BIT | Up: limits.h | Next: ctype.h
Rel: limits.h, stdint, stdbool & limits Guide
Ref: cppreference — DBL_EPSILON
Tags: #public #prog #c #stdlib #limits #tier/specialized
Include
#include <limits.h>
Signature & Overview
#include <float.h> /* DBL_EPSILON, DBL_MAX */
Difference between 1.0 and the next representable double (~2.22e-16).
Notes & Pitfalls
- Smallest
doubleesuch that1.0 + e != 1.0(~2.22e-16): Scale byfmax(fabs(a), fabs(b))for relative float comparisons.
Example
#include <assert.h>
#include <float.h>
int main(void) { assert(1.0 + DBL_EPSILON > 1.0); }
Linked from
Related notes
- tuts/c/stdlib/limits/CHAR_BIT Linked here; links to this page; shared tags: #c, #limits, #prog, #stdlib, #tier
- tuts/c/stdlib/limits Linked here; links to this page; shared tags: #c, #limits, #prog, #stdlib
- tuts/c/stdlib/ctype Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/stdint_stdbool_and_limits Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/limits/INT_MAX shared tags: #c, #limits, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isalpha shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isdigit shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isspace shared tags: #c, #prog, #stdlib, #tier