Boost logo

Boost :

From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-03-15 10:23:50


 

| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Janek Kozicki
| Sent: 15 March 2006 12:56
| To: boost_at_[hidden]
| Subject: Re: [boost] [serialization]
| Serialisation/deserialisation offloating-point values
|
| Paul A Bristow said: (by the date of Wed, 15 Mar 2006
| 11:00:23 -0000)
|
| > | 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::st
| > | ream_error));
| > | is >> t;
| > | }
| > |
| > | This suggests that it is a broken feature of Microsoft's
| > | operator>> for doubles read from filestreams.
|
|
| why not just read the string, ans use boost::lexical_cast<double> ?
|
| --
| Janek Kozicki

I fear that lexical_cast uses the same method of reading from a stringstream
:-((

And that our testing of lexical_cast is insufficient to catch it.

Some very rough tests of lexical_cast suggest that several percent of not
very random double values fail to loopback ( 1 bit wrong), but I don't have
time to work on this at present.

IMO this seems a Microsoft problem/feature.

Paul

-- 
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
Phone and SMS text +44 1539 561830, Mobile and SMS text +44 7714 330204
mailto: pbristow_at_[hidden]  http://www.hetp.u-net.com/index.html
http://www.hetp.u-net.com/Paul%20A%20Bristow%20info.html

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