Boost logo

Boost Users :

From: Bo Peng (ben.bob_at_[hidden])
Date: 2008-08-27 16:38:12


> I have an alternate suggestion: what about continued fractions? Turn the
> floating point value into a list of integers. This works no matter what
> f.p. systems the source and destination use. You just need a portable
> integer serialization format.

Then why cannot we use IEEE745 format for float serialization on all systems?

1. If a systems is IEEE745 compatible, serialize float numbers
directly. This will work 99.9% of the times, and will be very
efficient.
2. If a system is not IEEE745 compatible, to serialize a float number,
we write the number as 32 or 64 continuous bits, in IEEE745 format, to
de-serialize a float number, we read the number in IEEE745 formats and
write in native float format. An intermediate string representation
can be used for the translations.

I mean, these continuous IEEE745 bits are equivalent to your "portable
integer serialization format", but will be much more efficient on
IEEE745 compatible systems.

Cheers,
Bo


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