
1 Jun
2007
1 Jun
'07
7:48 p.m.
Jonathan Franklin wrote:
FWIW, sending the double value to std::cout works as expected: double d = 72.35; std::string s = boost::lexical_cast<std::string>(d); printf("%s\n", s.c_str()); // prints 72.34999999999999 std::cout << d << std::endl; // prints 72.35
because default precision is 6. Try to set it to numeric_limits<double>::digits10 + 1. -- Alexander Nasonov http://nasonov.blogspot.com Even peace may be purchased at too high a price. -- Benjamin Franklin -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote