Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Bob.Schaefer@launchpad.unc.edu (o\bBob Schaefer)
Subject: Re: C code to convert DEC floating pt to IEEE floating pt
Date: 30 Aug 1994 09:31:14 -0400	[thread overview]
Message-ID: <33vcb2$o0k@lambada.oit.unc.edu> (raw)
In-Reply-To: mehl.778198445@biner3.ameslab.gov

In article <mehl.778198445@biner3.ameslab.gov>,
Mark M Mehl <mehl@iastate.edu> wrote:
>
>We're interested in some C code to convert DEC floating pt (VAX & PDP)
>to IEEE floating point format (PCes).
>

Mark,
  I believe the following two routines are what you are looking for.  They
go from IEEE to VAX and VAX to IEEE.

ieeetodec(float *ieee_val, float *dec_val))
{
	register unsigned long dec_result;
	register unsigned long ieee;

	ieee = *((unsigned long *)ieee_val);
	dec_result = (ieee >> 16) | (ieee << 16);
	dec_result += 0x00000100;

	*((unsigned long *)dec_val) = dec_result;
}

dectoieee(float *dec_val, float *ieee_val)
{
	register unsigned long dec;
	register unsigned long ieee_result;

	dec = *((unsigned long *) dec_val);
	ieee_result = (dec >> 16) | (dec << 16);
	ieee_result -= 0x01000000;

	*((unsigned long *)ieee_val) = ieee_result;
}

hope this helped you out.  I'm not sure if this will get you right to a PC
or not, its from a document about a Motorola controller.

Bob Schaefer
Bob.Schaefer@launchpad.unc.edu



-- 
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Launchpad is an experimental internet BBS. The views of its users do not 
necessarily represent those of UNC-Chapel Hill, OIT, or the SysOps.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


  reply	other threads:[~1994-08-30 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-08-29 22:14 C code to convert DEC floating pt to IEEE floating pt Mark M Mehl
1994-08-30 13:31 ` o\bBob Schaefer [this message]
1994-08-30 13:43 ` Bob Koehler
1994-08-31  7:13 ` Hennie van Niekerk
1994-09-01 22:52   ` Mark M Mehl
1994-09-07 15:46   ` Realtime Data Aquisition Software Joe Stam
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox