From arthur@Smallworld.co.uk Thu Aug 19 09:02:28 1993
From: arthur@Smallworld.co.uk (Arthur Chance)
Newsgroups: comp.sys.sun.misc
Subject: Re: Sun claims XDR is broken!
Date: 19 Aug 1993 11:21:49 GMT
Organization: Smallworld Systems Ltd.
Distribution: world
NNTP-Posting-Host: gold.smallworld.co.uk

In article <24u20g$5mh@kong.gsfc.nasa.gov>, maher@kong.gsfc.nasa.gov (552) writes:
> >From (top of) page 111, Chapter 5, Network Programming Guide (Rev A,
> 3/27/90), SunOS manuals:
> (concerning xdr_float() )
> "Note: Since the numbers are represented in IEEE ..., routines may fail
> when decoding a valid IEEE representation into a machine-specific
> representation, or vice-versa"
> 
> Huh?  Does "fail" mean "loss of precision" (which can happen)?
> Obviously, xdr_float() is not broken, but what does this mean?
> 
> Anyone got a clue?

This isn't an XDR problem, it's what happens any time you try to convert
between two different f.p. representations. Consider IEEE doubles and VAX
D format doubles. IEEE has a maximum value of around 10**308, VAX D format
has a max around 10**38. Any IEEE value between these two limits cannot be
converted correctly to a VAX D value (I don't know whether you'd call it
loss of precision - I think it's far more severe). There's also the special
IEEE values (+/-Infinity and all those NaNs) which often don't have analogues
in older f.p. formats like VAX f.p. (IBM 370, etc ...)

Hope this helps.

From barmar@think.com Fri Aug 20 09:31:04 1993
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.sys.sun.misc
Subject: Re: Sun claims XDR is broken!
Date: 19 Aug 1993 14:31:03 -0400
Organization: Thinking Machines Corporation, Cambridge MA, USA
Distribution: world

In article <24u20g$5mh@kong.gsfc.nasa.gov> maher@kong.gsfc.nasa.gov (552) writes:
>(concerning xdr_float() )
>"Note: Since the numbers are represented in IEEE ..., routines may fail
>when decoding a valid IEEE representation into a machine-specific
>representation, or vice-versa"
>
>Huh?  Does "fail" mean "loss of precision" (which can happen)?

I think it means "fail to decode, and return FALSE to indicate that this
happened."

A good example would be sending a NaN, Infinity, or -0.0 to a machine that
doesn't support them in its floating point representation.  The recipient's
XDR implementation might handle -0.0 by translating it to 0.0, but the
others would probably just fail to be decoded.

Another example would be a floating point number whose exponent is of
greater magnitude than the recipient's representation can handle.

Of course, precision loss due to conversion is to be expected, so this
shouldn't cause xdr_float() to fail.

