title: strtod underflow, return value != 0
body: <p>Here's my test code:</p>
  
  <pre><code>errno = 0;
  d = strtod("1.8011670033376514e-308", NULL);
  </code></pre>
  
  <p>With this code, I get <code>d == 1.8011670033376514e-308</code> and <code>errno == ERANGE</code>.</p>
  
  <p>From strtod(3):</p>
  
  <blockquote>
    <p>If the correct value would cause overflow, plus or minus <code>HUGE_VAL</code> (<code>HUGE_VALF</code>, <code>HUGE_VALL</code>) is returned (according to the sign of the value), and <code>ERANGE</code> is stored in <code>errno</code>.  If the correct value would cause underflow, zero is returned and <code>ERANGE</code> is stored in <code>errno</code>.</p>
  </blockquote>
  
  <p>So, it seems to me that either <code>errno</code> should be zero (no error) or <code>d</code> should be zero (underflow).</p>
  
  <p>Is this a bug, or am I missing something? This happens for many different versions of eglibc and gcc.</p>