Network standard for floating point numbers?

Network standard for floating point numbers?

Post by Peter Johanss » Tue, 10 Aug 1993 06:58:57

I'm writing a network application where I need to pass double
precision floating point values between many different architectures.
Is there a good/standard way of doing this?

I have noticed that SGI and SPARC machines use the same internal
formats, and DEC (r2k, r3k) machines use the same format, but with the
byte ordering reversed.  I _could_ cast the double value to an
unsigned long and then send it through htonl() and ntohl(), but that
would cause all sorts of problems if I ever came across a machine that
used some other form of internal representation.

Any suggestions?

Please reply via e-mail; I will summarize to the net.

Peter Johansson


1. Network standard for floating point numbers? [summary]

[ I'm sorry I couldn't thread this to my original posting, but it
expired on our news server. ]

I would like to thank everyone who replied.  The nearly unanimous

gave the best summary:

The xdr library seems to be available on every machine that supports
nfs and rpc -- just about everybody these days.  xdr uses the IEEE-754
standard for floating point, so the conversion from double is a no-op
for most machines.

Given the near universal usage of IEEE-754 representation, a fact I
was previously unaware of, I have decided to use it directly in my
protocol.  To keep things simple, I have decided not to use the xdr
library until such time as a conversion to IEEE-754 is actually

Peter Johansson

2. GCC: Missing Libraries

3. egcs compatibility with IEEE floating point standard

4. Apache API question

5. support for ieee754 floating point standard under Linux

6. netlink socket option in kernel

7. Question on floating-point numbers

8. outband securid access

9. How to represent floating point numbers with German format

10. Expr and floating point numbers

11. How to sort floating point number

12. script to compare two floating point numbers or expressions

13. Working with floating point numbers