Boost logo

Boost :

Subject: Re: [boost] [serialization] How are floating point values handled?
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-08-07 15:19:17


John Maddock wrote:
> The current
> default situation is to print just 5 digits, and that certainly
> doesn't get close!

Hmmm - that surprises me. I look at the code in the file
basic_text_oprimitive.hpp and I find:

void save(const float t)
{
    // must be a user mistake - can't serialize un-initialized data
    if(os.fail())
        boost::serialization::throw_exception(
        archive_exception(archive_exception::output_stream_error)
    );
    os << std::setprecision(std::numeric_limits<float>::digits10 + 2);
    os << t;
}

Is this code not correct? Note that I added in 2 extra digits. Or
is this code not getting invoked? Let me know.

Robert Ramey


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