
If you want attention, it's always a good idea to put the library name
in the subject line. Cheers,
on Mon Nov 26 2007, "Laurence Bunnage"
I am currently maintaining a project written using Borland C++ Builder version 6 build 10.166 and boost version 1.32.
I found I had a reoccuring problem in my code whereby the output from lexical_cast<string> (any_double) was not at the precision I was expecting. It started off OK, but after a while it changed. I have tracked it down to some of my code which I simplified to that shown below.
The first cast, in the try block, works correctly with the output value d = 5.0 and no assert
The second cast, in the catch statement, returns a value of d = 5.00000013628211 and asserts.
With the assert removed, all subsequent calls to lexical_cast continue to give similar results.
try
{
double d = boost::lexical_cast<double>(boost::lexical_caststd::string(5.0));
assert(d == 5.0);
throw std::runtime_error("Not enough points in peak");
}
catch (std::exception& e)
{
double d = boost::lexical_cast<double>(boost::lexical_caststd::string(5.0));
assert(d == 5.0);
}
I have searched the boost website for similar problems and have not found anything (doesn’t mean it’s not there, just I haven’t found it)
Any help, especially a solution or work around would be greatly appreciated.
NOTE at this time, due to the current state of the project, I would prefer not to have to upgrade to a newer version of the boost library.
Laurence Bunnage
Software Engineer
e-mail: Laurence.Bunnage@teraview.com
TeraView Limited
Registered in England
Registered Office: Platinum Building, St John's Innovation Park, Cambridge CB4 0WS
Registered Number: 04126946
VAT Number: 770 8883 84
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com