Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][conversion] 1.34.1 upgrade to 1.39 lexical_cast
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-08-19 00:13:36


On Tue, Aug 18, 2009 at 9:12 PM, Ryan McConnehey<mccorywork_at_[hidden]> wrote:
> 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 ); }

I think it is just representing it in full accuracy now where it did
not used to. I think there is something to control that though... Do
not really recall, I use Boost.Spirit.Karma/QI now instead of
lexical_cast, a lot faster.


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