Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9810: boost serialization: deserialization from boost txt archive fails on -nan for double
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-14 21:31:49
#9810: boost serialization: deserialization from boost txt archive fails on -nan
for double
--------------------------------+---------------------------
Reporter: florian.burkart@⦠| Owner: ramey
Type: Feature Requests | Status: reopened
Milestone: To Be Determined | Component: serialization
Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+---------------------------
Comment (by hdeanclark@â¦):
I was taken by this behaviour also (in Serialization 1.60). Serialization
was fine (to binary, text, and XML), but deserialization of text and XML
choke due to NaN and +-Inf. A workaround is to imbue the stream with a
facet so that non-finite values are correctly parsed [1]. Boost.Math
provides such a facet: boost::math::nonfinite_num_get (and ...put). See
documentation at [2].
There is a nice posting at [3] showing how to use this facet and where to
provide the Boost Serialization codecvt option.
---
[1] Note that NaN payloads are not necessarily restored exactly, but they
will be restored to _some_ NaN, depending on the platform. (I believe this
issue was a major factor in omission from Serialization.) See the facet
documentation for more information.
[2]
http://www.boost.org/doc/libs/1_50_0/libs/math/doc/sf_and_dist/html/math_toolkit/utils/fp_facets/intro.html
[3] http://stackoverflow.com/questions/22203496/deserialization-of-non-
finite-floating-point-numbers-fails-even-with-appropriate
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9810#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC