title: Inconsistent stringstream behavior when parsing doubles in libc++ and glibc
body: <p>When compiling the following sample with <a href="https://wandbox.org/permlink/dFGIKu1NcU3lhMyv" rel="nofollow noreferrer">gcc</a> and <a href="https://wandbox.org/permlink/yIkRhMHf20XR4UjG" rel="nofollow noreferrer">clang</a>...</p>
  
  <pre><code>#include &lt;sstream&gt;
  #include &lt;iostream&gt;
  
  int main() {
      double val;
      std::stringstream ss("6.93758e-310");
      ss &gt;&gt; val;
  
      std::cout &lt;&lt; "fail: " &lt;&lt; ss.fail() &lt;&lt; std::endl
  }
  
  </code></pre>
  
  <p>...I get different behavior:</p>
  
  <ol>
  <li>With gcc, the stream's failbit <code>ss.fail()</code> is not set, while </li>
  <li>for clang it is set</li>
  </ol>
  
  <p>It might be relevant to note that in both cases, <code>errno</code> is set to <code>ERANGE</code>.</p>
  
  <p>Also, locally I get the same behavior with clang and gcc, unless I explicitly use libc++ with clang (<code>-stdlib=libc++</code>) instead of glibc.</p>
  
  <p>I am not sure what the correct behavior is, but it feels to me like it should be consistent.</p>