[illumos-Developer] Ugh... xdr_{float,double} problems

Bill Sommerfeld sommerfeld at hamachi.org
Mon Jan 31 16:14:52 PST 2011


On 01/31/11 15:34, Garrett D'Amore wrote:
> It sounds like all the main CPU targets support IEEE 754. The only
> reasonable (?) question IMO is S390. Roland? Neale?

There is an extensive discussion of floating point formats at:

http://www.quadibloc.com/comp/cp0201.htm

There is definitely a least one "IBM" floating point encoding out there.

Apollo's NCS RPC protocol (which is about as old as xdr) supported four 
different floating point format tags: IEEE, Vax, Cray, and IBM (mainframe).

My conclusion from the time I spent working in the group at apollo that 
did NCS is that you're generally better off avoiding the use of floating 
point numbers in wire protocols if at all humanly possible.  Lossless 
conversion between formats is often impossible, and a round-trip 
conversion between formats is likely to give you back a slightly 
different number.

Probably best to let sleeping dogs lie here..

						- Bill



More information about the Developer mailing list