Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] XML: float format is scientific instead of human-readable since Boost 1.57
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2015-01-29 05:30:45


> -----Original Message-----
> From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Frank Stähr
> Sent: 28 January 2015 17:07
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [Serialization] XML: float format is scientific instead of human-readable since
> Boost 1.57
>
> Am 28.01.2015 um 16:16 schrieb Robert Ramey:
> > Frank Stähr wrote
> >> I compiled it with VS 2013 for 32 bit. The output file has the line:
> >> <m_accuracy>
> >> 2.99999999999999990e-002
> >> </m_accuracy>
> >> In Boost 1.55 it was much better human-readable: 0.03.
> >
> > This is surely an unintended side effect of changes to guarantee
> > correct "round tripping"
> > of floating point numbers. That is that the the floating point number
> > read in is bit for bit the same as the floating point number written
> > out.
>
> Yes, I read about "round tripping" in some mail archives, thanks for clarification.
> In my opinion it would be more sensible to use the format options from the ofstream. This would suit
> much more elegant to the std … but anyway, I am not familiar with round tripping …

As long as you don't mind the risk (small but not zero) that some values in your archive will be slightly different after de-serialization.

I'd worry about that personally. Most would assume that it won't happen?

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

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