Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!news From: ehrlich@cs.psu.edu (Daniel Ehrlich) Newsgroups: comp.protocols.ibm Subject: Re: IBM, IEEE conversion Message-ID: <1989Dec19.193247.18961@psuvax1.cs.psu.edu> Date: 19 Dec 89 19:32:47 GMT References: <229@bull.bull.fr> Sender: news@psuvax1.cs.psu.edu (Usenet) Organization: Computer Science Department, Penn State University Lines: 27 In-Reply-To: marc@spix7.depr.bull.fr's message of 18 Dec 89 10:42:00 GMT In article <229@bull.bull.fr> marc@spix7.depr.bull.fr ( Marc PARIGOT ) writes: Marc> I'm looking, for RPC purpose, a simple and fast way to convert IBM Marc> floatting point format number into IEEE format number and vice-versa: Marc> ------------------------- ---------------------------- Marc> |s| exp | mantissa | <==> | mantissa | exp |s| Marc> ------------------------- ---------------------------- Marc> fibm fieee Marc> fibm = (-1)**s * (16)**(exp1-64) * mantissa1 Marc> fieee = (-1)**s * 2**(exp2-127) * mantissa2 Marc> ibm_to_ieee(exp1, mantissa1, &exp2, &mantissa2); Marc> ieee_to_ibm(exp2, mantissa2, &exp1, &mantissa1); You should be able to use the XDR routines that come with the SUN RPC library. The convert from `native' numbers to IEEE floating point and back. Not sure where they are documented in IBM land, but they are in the Network Programming manual for a Sun. -- Dan Ehrlich Quote of the month: "And I have quite a bit of experience on mainframes. I learned C, Pascal, and Assembler on various mainframes, including PDPs, VAXen, an IBM AS/9000." -- Charles M Hannum II