Boost Users :
Subject: [Boost-users] [serialization] nans and infinite floats in text based archives...
From: François Mauger (mauger_at_[hidden])
Date: 2009-03-07 21:53:36
Hi serializers, archivers, boosters and Robert,
I've used boost:serialization (boost 1.34.1 under Linux ubuntu and/or
SL4,, gcc 4.2) for one year. Thanks to this excellent library, our team
store critical experimental data (3 TB using zipped text archives).
Up to now, I met no problem with text/XML archives as all the
stored double values pass the 'isnormal' check.
Now my new data analysis programs needs to (de)serialize doubles
even if they are NaNs or infinites (for it makes sense for me).
Unfortunately, the load method for double fails while reading
'nan' (or 'inf') from the input for this is the standard behavior
of the ostream with "! isnormal" doubles.
After studying the source code for boost text oriented I/O archives
in the hope to find a fix for my problem,
I made an attempt to make boost aware of nans and +/-infs in
a pragmatic way (I mean trying to save time and storage but keep
the information and get rid of the stream error exception).
I attached a tiny tarball to show the hack I've done.
I'm not sure at all this is be a definitively good and elegant approach to
handle nans within text based archives. So I'd appreciate
to get some feedback and comments from Robert or any expert in
this field. As I work only with Linux, gcc and 1.34.1, this approach
is likely not to be portable... but maybe this could initiate
some work to fix it in an official way.
thanks for your attention and for all this very very
-- Francois Mauger Laboratoire de Physique Corpusculaire de Caen et Universite de Caen ENSICAEN - 6, Boulevard du Marechal Juin, 14050 CAEN Cedex, FRANCE e-mail: mauger_at_[hidden] tel.: (0/+33) 2 31 45 25 12 fax: (0/+33) 2 31 45 25 49
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