Boost logo

Boost :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2006-03-15 05:46:16


Paul A Bristow wrote:

>As far as I recollect, VS 7.1 also worked correctly for all FP types, so I
>would surmise that the number of digits used for serialisation is
>insufficient? For double, it should be 17. There do appear to be 17
>digits, so I am slightly puzzled.
>
>But:
>
> I:\boost-06-01-13-0500\boost\archive\basic_text_oprimitive.hpp(124)
>
>uses
>
>os << std::setprecision(std::numeric_limits<double>::digits10 + 2);
>
>and I suggest that this should be:
>
>os << std::setprecision(2 + std::numeric_limits<double>::digits *
>3030/10000);
>
>
Yes, fair enough, but that wouldn't make any difference in this case.
The problem is clearly with the *de*serialisation.

Tracing back through the functions, this seems to be the function (in
basic_text_iprimitive.hpp) that reads doubles from XML files:

    void load(T & t)
    {
        if(is.fail())
            
boost::throw_exception(archive_exception(archive_exception::stream_error));
        is >> t;
    }

This suggests that it is a broken feature of Microsoft's operator>> for
doubles read from filestreams.

Paul


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