<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - reading a long double from a stream is out by a factor of 10"
   href="http://llvm.org/bugs/show_bug.cgi?id=15751">15751</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>reading a long double from a stream is out by a factor of 10
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>hhinnant@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>john@johnmaddock.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This issue is causing most of the Boost.Math lib tests to fail, sample code is:

int main(int argc, char** argv)
{
   std::stringstream ss;
   long double r3;
   ss << "304888344611713860501504000000";
   ss >> r3;

   std::cout << std::setprecision(std::numeric_limits<long
double>::max_digits10) << r3 << std::endl;

   r3 = 304888344611713860501504000000.0L;
   std::cout << std::setprecision(std::numeric_limits<long
double>::max_digits10) << r3 << std::endl;

   return 0;
}

Which outputs:

3.04888344611713860494e+28
3.04888344611713860494e+29

Note how the value read from the stream is 10 times too small :-(

The issue still occurs if I append a ".0" to the input string.

Platform is Ubuntu Linux, latest clang and libc++ SVN Trunk.  Same issue with
last release as well.   GCC/libstdc++ and MSVC both handle this fine.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>