For the next code snippet
std::cout<<boost::lexical_cast<std::string>(2.34)<<std::endl
I get the following output:
2.3399999999999999
If i do
double d = 2.34; std::stringstream ss; ss<<d; std::string s = ss.str(); cout<<s<<endl;
I get the following output:
2.34
Why is this happening? Obviously, I'm looking for the last output presentation, not the first.
Thanks,
source share