Re: Q: Portable Ada floating-point binary I/O ?



On Sat, 26 Aug 2006 21:02:47 +0200, Gautier wrote:

Does somebody know about a way of doing floating-point I/O which
is portable across architectures (endianesses etc.) and a little
bit more compact than the representation with digits ?

For network communications we send binary exponent and mantissa as signed
integers and then assemble them using corresponding floating-point
attributes. Integers are sent in a variable length format, which along with
a moderate compression effect, allows us to vary the mantissa length. So it
becomes independent on how many bits the mantissa has on the given host.

However, the problem is - what does "portable" mean here? Range and
precision cannot be portable, unless types aren't communicated as well.

If yes, is there an open-source Ada package doing it ?

Alas, it isn't. But it is easy to implement.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Q: Portable Ada floating-point binary I/O ?
    ... > For network communications we send binary exponent and mantissa as signed ... allows us to vary the mantissa length. ... is there an open-source Ada package doing it? ...
    (comp.lang.ada)
  • Re: 5-byte numbers
    ... to all newer OS/2 ones, ... I don't know for 100% sure what the mantissa is. ... also introduces an additional rounding problem. ... assuming 15 digits are readable with an "E" in there. ...
    (comp.os.os2.programmer.misc)
  • Re: BigNum -- Floating Point
    ... > mantissa and exponent. ... In that the current implementation already uses 32-bit "digits", ... (in one design I'm considering) ...
    (comp.programming)
  • Re: Complete RPL object type table
    ... Although HP allocated 20 bits for the DIGITS setting, ... The "LongFloat" library ... ddddddd....ddddddddd - mantissa digits ... - length of exponent and its sign + 5 ...
    (comp.sys.hp48)
  • Re: How to output FLOAT(18) in full form by E-format in VA PL/I?
    ... s=18 (all mantissa's digits). ... File input contains ... I don't worry about 4 digit mantissa in IEEE. ... why I can't use Edescriptor? ...
    (comp.lang.pl1)