Newsgroups: comp.unix.questions
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: passing floats in inet socket-based IPC
Message-ID: <1990Nov29.224651.26522@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <1990Nov26.164122.6152@noose.ecn.purdue.edu>
Date: Thu, 29 Nov 90 22:46:51 GMT

In article <1990Nov26.164122.6152@noose.ecn.purdue.edu> luj@delta.ecn.purdue.edu (Jun Lu) writes:
>Is there a quick/neat way to passing floats in inet socket-based IPC, just
>like we "routinely" do for passing ints on "popular" architectures( with
>just some hton or ntoh conversions) ?

In a word, no.  There is too much diversity in floating-point formats to
admit of any graceful general solution that's also quick and simple.
About the best you can do is convert to IEEE format, since that conversion
is a no-op on increasingly many machines, and then deal with the byte
order in much the same way as for integers.  However, conversions to and
from IEEE format can be costly on non-IEEE machines.

ASCII is probably simpler unless you've got pre-canned IEEE conversions
(which I believe XDR does).
-- 
"The average pointer, statistically,    |Henry Spencer at U of Toronto Zoology
points somewhere in X." -Hugh Redelmeier| henry@zoo.toronto.edu   utzoo!henry
