From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Clark Cianfarini
Sent: 30 January 2015 14:45
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Serialization] XML: float format is scientific instead of human-readable since Boost 1.57
On Fri, Jan 30, 2015 at 4:04 AM, Frank Stähr wrote:
Here a reminder to my most important question:
On 28.01.2015 at 18:07, Frank Stähr wrote:
Not really, this just makes it harder to read or edit XMLs now.
Is it possible for us to write the “old” XML format?
So I guess no?
The way our company chose to create human-readable XML is to serialize strings instead of doubles or floats. We used a stringstream with std::setprecision to get a certain number of decimal places. The number has a chance of being slightly different after de-serialization and pulling it out of the stringstream, just like the old serialization method. This is okay for us, as we need human-readable XML more than exact round tripping.
Frank Stahr might also consider using 32-bit floats instead of double - if the precision of 6 decimal digits is enough.
This could much reduce the max number of decimal digits from 17 to 9
for 32-bit float max_digits10 = 9 and the guaranteed digits10 is 6
for 64-bit double max_digits10 = 15 and the guaranteed digits10 is 17
HTH too.
Paul
---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830