Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-07-30 19:15:00


on Wed Jul 30 2008, Michael Linck <mgl-AT-absolute-performance.com> wrote:

> Andreas Ries wrote:
>> Hi,
>> I'm using the borland toolset 5.8.2 under Win XP and have a problem
>> doing the following:
>>
>> double val = 795.6352;
>> string result = boost::lexical_cast <string> (val);
>>
>> the resulting string is: "795.63520000000005" with boost 1_35_0
>> the resulting string is: "795.6352000000001" with boost_1_34_0
>> Can anybody help?
>
> This describes a bug I just found as well. I didn't see any follow
> up to this message when I looked through my archived boost mail.
> Looks like boost::lexical_cast for double and float got broken between
> boost 1_33 and boost 1_34 and now changes the precision of the cast
> and introduces error, and this was never fixed. This could cause
> havoc on the application I'm maintaining, which uses lexical _cast
> extensively and expects a precision of 2 so our users don't ever have
> to look at a number like the ones above. Unfortunately, I can't
> revert to boost 1_33 because we switched to Visual Studio 9 for our
> windows port. We build on gcc 4.1.2 on Unix platforms and, as I
> already mentioned VS9 on Windows, and we get this problem everywhere.
> Is there a workaround for this or a fix in the pipeline? If not, I
> guess it's time to write our own string wrappers again, so we know
> what it's going to do >hurghle<.

Please enter a ticket for this at http://svn.boost.org so it doesn't get
lost; thanks!

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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