Xref: utzoo comp.lang.c:29343 comp.unix.ultrix:3670 comp.sys.ibm.pc:51869 comp.sources.wanted:11979 Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!ames!ncar!noao!tody From: tody@noao.edu (Doug Tody CCS) Newsgroups: comp.lang.c,comp.unix.ultrix,comp.sys.ibm.pc,comp.sources.wanted Subject: Re: Routine to convert between IEEE and VAX floating point ? Message-ID: <1990Jun3.084602.1662@noao.edu> Date: 3 Jun 90 08:46:02 GMT References: <1023@rna.UUCP> Organization: National Optical Astronomy Observatories, Tucson, AZ, USA Lines: 27 From article <1023@rna.UUCP>, by dan@rna.UUCP (Dan Ts'o): > > Does anyone have a C routine to convert from IEEE floating point > to VAX D format floating point ? This depends upon what cpu you want to perform the conversion on. If you want to convert to or from IEEE on a VAX cpu then I have some VAX assembler routines which can do this (more efficiently than in C, due to the need to bit shift a 64 bit quantity). > Failing that or anything similar, does anyone have a concise > description of the IEEE floating point format so I can write my own routine... The main reference is the IEEE floating standard document. I don't have the document number handy, but you can order it from IEEE. An IEEE double is 64 bits like a VAX D double, but the exponent is 11 bits rather than 8 for VAX D format (VAX G format is also 11 bits), there is a *4 (or /4) factor due to a difference in the normalization of the mantissa, and the bytes are spped. Converting IEEE single to VAX F is much simpler, all you do is byte swap and multiply or divide by 4.0. -- Doug Tody, National Optical Astronomy Observatories, Tucson AZ, 602-325-9217 UUCP: {arizona,decvax,ncar}!noao!tody or uunet!noao.edu!tody Internet: tody@noao.edu SPAN/HEPNET: NOAO::TODY (NOAO=5355)