For the following piece of code
std::cout<<boost::lexical_cast<std::string>(2.34)<<std::endl
i get the following output:
2.3399999999999999
Whereas 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 am looking for the latter's output representation, and not the former.
Thanks,