Re: Network byte order and floating-point numbers

From: Reinder Verlinde (reinder_at_verlinde.invalid)
Date: 06/13/04


Date: Sun, 13 Jun 2004 17:53:42 +0200

In article <pan.2004.06.07.01.35.23.59926@lionsanctuary.net>,
 Owen Jacobson <angstrom@lionsanctuary.net> wrote:

> the actual protocol is based on sending struct{...}s over the connection.

If you mean that you write sizeof( aStruct) bytes, passing a pointer to
aStruct: that is not even portable between equal-endian systems.
Different systems, compilers or even compiler settings will lead to
different padding inside structures.

> Is there a standard binary format/byte ordering for sending
> floating-point numbers over a network connection

Your best bet probably is to use a text-based format.

Second-best, but possibly good enough would be a IEEE floating point
format. Study your compilers to see whether they support it. You will
still have to do do endian conversion.

Reinder