Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!PSUVAX1.CS.PSU.EDU!news From: news@PSUVAX1.CS.PSU.EDU (Daniel Ehrlich) Newsgroups: comp.protocols.ibm Subject: Re: IBM, IEEE conversion Message-ID: <8912192008.AA15402@lilac.berkeley.edu> Date: 19 Dec 89 19:32:47 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Daniel Ehrlich Organization: The Internet Lines: 27 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