Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][conversion] 1.34.1 upgrade to 1.39 lexical_cast
From: Ryan McConnehey (mccorywork_at_[hidden])
Date: 2009-08-18 23:12:25


I have code that converts, using lexical_cast, some numeric values to
strings. When upgrading from boost 1.34.1 to 1.39 some of my float and
double test values changed. For example the numeric value 1111.11
converts to the string value "1111.11" in boost 1.34.1. In boost 1.39
the numeric value 1111.11 converts to the string value
"1111.1099999999999". I find it odd that some values give this long
string representation but other values convert exactly (1222.22 for
example). Can someone tell me what changed from 1.34.1 to 1.39. I'm
pretty sure it has to be the underling code in boost since I used
Microsoft Visual Studio 2005 IDE for building my project with both boost
versions.

The code I'm using is as follows:

template <typename T>
std::string convertValueToText(T const& value) const
{ return boost::lexical_cast<std::string>( value ); }

Ryan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net