|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-15 11:04:56
As has been noted, the serialization library inherits the behavior of
the basic_stream library used in its implementation. One could
try another library - e.g. STLPort. If you need a solution for some
specific datum in a specific application you could apply the
binary_object wrapper and serialize the binary representation
of the double. Of course you're back the the problem of
portable representation of floats - another problem discussed
on this list which has never arrived at a successful resolution.
Robert Ramey
John Maddock wrote:
>> Using 100 tests with nextafter, starting with the value you found
>> faulty, I find 38 failures (all one bit wrong on input) - about the
>> one third I found in previous tests.
>
> Oh shucks: I wonder would this be solved by using the solution I
> often see
> in the literature when an author wants to give a binary floating
> point value exactly: which is to represent it as an integer + a base
> 2 exponent. Values in that form can be serialised/deserialised
> exactly using ldexp/frexp, but unfortunately aren't very human
> readable (or rather are open to mis-interpretation because the
> exponent is a power of 2 not 10). This
> format is similar to the "A" format specifier in the C99 version of
> printf, and I believe the code is quite simple as well BTW,
>
> John.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk