Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] nans and infinite floats in textbased archives...
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-03-08 00:54:58

The serialization library text archives depend upon an underlying
stream to render output and parse input. So what is needed
is a stream that can render NaNs and other such values in
a portable way. A library containing such a stream has
passed review and been accepted into boost. As far as
I can tell, it has yet to be checked into the SVN system. The
version reviewed can be found in the vault:

Hopefully, this can help address your circumstances.

Robert Ramey

François Mauger wrote:
> 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
> useful material.
> regards
> frc
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at