[comp.sys.sgi] xdr double precision

davis@MASIG2.OCEAN.FSU.EDU (Alan Davis) (08/15/89)

I have been trying to get a set of functions working on an IRIS 3130 that
utilizes the rpc/xdr library routines to transfer data between different
machines.  Unfortunately, xdr_double(), which is supposed to handle double
precision data does not work when the data being passed is of type "long float".
The routine will work with single precision (ie, float and double) which leads
me to wonder if SGI has compiled the library with double set to the default
of single precision?  If this is so, can the xdr routines be used to transmitt
real double precision data (8 bytes)?

Second question.  I have noted many deficiencies in SGI's implementation of
the C compiler and the run-time libraries on the 3xxx machines (besides the
one mentioned above).  We are anticipating the purchase of a 4D machine and
I would like to hear comments on the C compiler and libraries on these machines.
Specifically, is the compiler an ANSI standard version and do the libraries
contain a complete set of functions included in either SYS V.3 or BSD4.3?

--
          Alan Davis                |
Mesoscale Air-Sea Interaction Group | TCP/IP davis@masig1.ocean.fsu.edu
    Florida State University        |             (128.186.3.1)
    435 OSB  Meteorology Annex      | SPAN   scri::"davis@masig1.ocean.fsu.edu"
    Tallahassee, FL 32306-3041      | BITNET davis%masig1.ocean.fsu.edu@cunyvm
         (904) 644-3798             |
_______________________________________________________________________________

goss@SNOW-WHITE.MERIT-TECH.COM (Mike Goss) (08/16/89)

Regarding the message:
> From: Alan Davis <davis@masig2.ocean.fsu.edu>
> Message-Id: <8908151555.AA14363@masig2.ocean.fsu.edu>
> Subject: xdr double precision
> 
> I have been trying to get a set of functions working on an IRIS 3130 that
> utilizes the rpc/xdr library routines to transfer data between different
> machines.  Unfortunately, xdr_double(), which is supposed to handle double
> precision data does not work when the data being passed is of type "long float".
> The routine will work with single precision (ie, float and double) which leads
> me to wonder if SGI has compiled the library with double set to the default
> of single precision?  If this is so, can the xdr routines be used to transmitt
> real double precision data (8 bytes)?
> 
> Second question.  I have noted many deficiencies in SGI's implementation of
> the C compiler and the run-time libraries on the 3xxx machines (besides the
> one mentioned above).  We are anticipating the purchase of a 4D machine and
> I would like to hear comments on the C compiler and libraries on these machines.
> Specifically, is the compiler an ANSI standard version and do the libraries
> contain a complete set of functions included in either SYS V.3 or BSD4.3?

As you surmise, not only the C libraries but also the C compiler on the 
IRIS 2xxx and 3xxx series treat the type "double" as equivalent to
"float" (32 bit floating point).  Type "long float" must be used
to get 64 bit float point.  There is a special set of math library functions
which start with the characters "_l" that can be used for "long float" data.

This is not very well documented, and caused me great problems when I first
tried to port programs requiring 64 bit floating point to an older IRIS.
I'm not familiar with the rpc/xdr libraries, so I can't help you there.

The good news is that most of the wierd features of the 3xxx series
C compiler are gone on the 4D series.  The C compiler on the 4D 
series is more consistent with the rest of the world.  
Type "double" is 64 bit floating point, and the library
routines expect "double" for floating point arguments.  There is a set
of special math functions starting with the letter "f" (for example,
"fsqrt") which can be called with "float" arguments; otherwise, the
regular library routines (such as "sqrt") will still promote "float"
arguments to "double".  The compiler also has an option (-float)
to let it do floating point arithmetic in 32 bit precision if
all arguments to an expression are 32 bits.

As to other C compiler features, the C compiler
has some, but not all, of the features of the draft ANSI standard.
It has some of the important features, such as function prototypes,
but is lacking others, such as being able to use type "void *" for
generic pointers.  The header (.h) files don't yet conform to the
ANSI standard.  Overall, the compiler is fairly typical of the
industry de-facto standard (a blend of K&R and draft ANSI).
I would presume that if the draft ANSI standard
ever gets approved, then MIPS and/or SGI will update the compiler
to implement the full ANSI standard.
I should also mention that the 4D C compiler has quite a good
optimizer, and the CPU floating point is incredibly fast.


------------------------------
Mike Goss
Merit Technology Inc.
(214)733-7018
goss@snow-white.merit-tech.com