#150 problems reading in to long double


The following code snippet is a boiled down test case from Boost lexical_cast:

const char* p = "2.718281828459045235360287471352662497757247093e0";
std::stringstream s;
s << p;
long double x;
s >> x;

When x is type long double (and compiled with VC8) it gets the spurious value 5.6611421590039250e-015, but when x is declared as a double it does work as expected.

Any ideas?

Thanks, John Maddock.


  • Francois Dumont

    Francois Dumont - 2007-10-14
    • assigned_to: nobody --> dums
  • Francois Dumont

    Francois Dumont - 2007-10-16
    • status: open --> pending
  • Francois Dumont

    Francois Dumont - 2007-10-16

    Logged In: YES
    Originator: NO

    I made several weeks ago a code review of floating point parsing. I had detected several issues and fix it in trunk. Your test case is working just fine with this version.

    I don't think I will have time to put those fixes in 5.1 branch, I hope you won't mind waiting for 5.2.


  • Petr Ovtchenkov

    Petr Ovtchenkov - 2007-10-16

    Logged In: YES
    Originator: NO

    This test pass on Linux/gcc too, so trunk is fine, IMO.

  • John Maddock

    John Maddock - 2007-10-17
    • status: pending --> open
  • John Maddock

    John Maddock - 2007-10-17

    Logged In: YES
    Originator: YES

    No problem waiting for 5.2: I have to support older STLport versions in any case.

    Thanks for looking into this, John Maddock.

  • Francois Dumont

    Francois Dumont - 2007-10-23
    • status: open --> closed

Log in to post a comment.