Boost logo

Boost Users :

From: Pfligersdorffer, Christian (Christian.Pfligersdorffer_at_[hidden])
Date: 2008-08-28 02:48:51


Bo Peng on Wednesday, August 27, 2008 10:38 PM:

>> 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.

A splendid idea! Btw it's IEEE754... ;) But yeah, let's take it for the
portable binary archive's standard for floating point values. Machines
using a different notion may contribute a conversion algorithm or simply
throw an exception. However, the intermediate string approach would be a
last resort in my view.

Regards,

-- 
Christian Pfligersdorffer
Software Engineering
http://www.eos.info

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