&gt; <i>In C++, you can get the former limit using std::numeric_limits&lt;double&gt;::digits10, and the latter using std::numeric_limits&lt;double&gt;::max_digits10.</i><p>Also, via GCC specific constants:<p><pre><code>  $ echo | gcc -E -dM - | grep -E &#x27;(FLT|DBL).*DIG&#x27;
  #define __DBL_DIG__ 15
  #define __FLT_MANT_DIG__ 24
  #define __LDBL_MANT_DIG__ 64
  #define __FLT_DIG__ 6
  #define __DBL_MANT_DIG__ 53
  #define __DBL_DECIMAL_DIG__ 17
  #define __LDBL_DIG__ 18
  #define __FLT_DECIMAL_DIG__ 9
</code></pre>
__DBL_DIG__ versus __DBL_DECIMAL_DIG__. Useful to know.<p>__DBL_DECIMAL_DIG__ corresponds to DBL_DECIMAL_DIG which was added to C in C11.<p>In C90 or C99 we can do some hack like:<p><pre><code>  #if DBL_DECIMAL_DIG
  use this
  #elif __DBL_DECIMAL_DIG__
  use this from gcc.
  #else
  fall back on DBL_DIG + 2
  #endif</code></pre>