http://llvm.org/bugs/show_bug.cgi?id=15751

            Bug ID: 15751
           Summary: reading a long double from a stream is out by a factor
                    of 10
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to