[comp.protocols.ibm] IBM, IEEE conversion

marc@spix7.depr.bull.fr ( Marc PARIGOT ) (12/18/89)

	Hello,

I'm looking, for RPC purpose, a simple and fast way to convert IBM floatting point format number into IEEE format number and vice-versa:

	-------------------------        ----------------------------
	|s| exp |  mantissa     |  <==>  |   mantissa      | exp  |s|
	-------------------------        ----------------------------
		fibm                             fieee


 fibm = (-1)**s * (16)**(exp1-64) * mantissa1
 fieee = (-1)**s * 2**(exp2-127) * mantissa2

 ibm_to_ieee(exp1, mantissa1, &exp2, &mantissa2);
 ieee_to_ibm(exp2, mantissa2, &exp1, &mantissa1);

		Thanks for your time.

					Marc (E.mail: Marc.Parigot@depr.bull.fr)

marc@bpe2.spix7.depr.bull.FR (Marc PARIGOT) (12/18/89)

        Hello,

I'm looking, for RPC purpose, a simple and fast way to convert IBM floatting
        point format number into IEEE format number and vice-versa:

        -------------------------        ----------------------------
        |s| exp |  mantissa     |  <==>  |   mantissa      | exp  |s|
        -------------------------        ----------------------------
                fibm                             fieee


 fibm = (-1)**s * (16)**(exp1-64) * mantissa1
 fieee = (-1)**s * 2**(exp2-127) * mantissa2

 ibm_to_ieee(exp1, mantissa1, &exp2, &mantissa2);
 ieee_to_ibm(exp2, mantissa2, &exp1, &mantissa1);

                Thanks for your time.

                                        Marc (E.mail: Marc.Parigot@depr.bull.fr)

ehrlich@cs.psu.edu (Daniel Ehrlich) (12/20/89)

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 <ehrlich@cs.psu.edu>
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 <c9h@hcx.psu.edu>

news@PSUVAX1.CS.PSU.EDU (Daniel Ehrlich) (12/20/89)

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 <ehrlich@cs.psu.edu>
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 <c9h@hcx.psu.edu>