Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-06-01 15:48:15


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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk