From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10239c,895b65025d75f836 X-Google-Attributes: gid10239c,public X-Google-Thread: 1164f8,895b65025d75f836 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-08-30 06:42:11 PST Path: bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!news.duke.edu!concert!bigblue.oit.unc.edu!not-for-mail From: Bob.Schaefer@launchpad.unc.edu (oBob Schaefer) Newsgroups: comp.sys.dec,vmsnet.sources.d Subject: Re: C code to convert DEC floating pt to IEEE floating pt Date: 30 Aug 1994 09:31:14 -0400 Organization: The University of North Carolina at Chapel Hill, the Experimental Bulletin Board Service. Sender: bbs@lambada.oit.unc.edu Message-ID: <33vcb2$o0k@lambada.oit.unc.edu> References: NNTP-Posting-Host: lambada.oit.unc.edu Keywords: DEC, floating-point, IEEE, format Xref: bga.com comp.sys.dec:5542 vmsnet.sources.d:527 In article , Mark M Mehl 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. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --