From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ab02531b71c8f5fd X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1995-03-10 09:22:45 PST Path: bga.com!news.sprintlink.net!cs.utexas.edu!swrinde!gatech!newsfeed.pitt.edu!ehdup-e-4.rmt.net.pitt.edu!bschor From: bschor@vms.cis.pitt.edu (Bob Schor) Newsgroups: comp.sys.dec Subject: Re: Help - DEC floating point format? Date: Fri, 10 Mar 1995 11:56:54 UNDEFINED Organization: University of Pittsburgh Message-ID: References: NNTP-Posting-Host: ehdup-e-4.rmt.net.pitt.edu X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #1] In article Andrew Gibbs writes: >Excuse my ignorance but I'm trying to read some datafiles into a PC. >They claim to be floating point and were obtained originally on an >instrument based on some sort of DEC computer (PDP/Vax??). All my >attempts to read this data result in garbage and I would like to know >if the floating point format used is non-IEEE, and if so what is it? >(bit allocations for mantissa/exponent/sign(s) etc) >Thanks for any assistance, >Andrew Gibbs >agi%bsesoft@Britain.EU.net The PDP-11 single-precision floating point format is similar to the PC single precision format. There are two differences -- an "endian" problem and a "hidden precision" problem. Assume you have a four-byte PDP-11 single-precision floating point number. Do the following: 1) Store the number into a PC floating point variable, but in word-reversed order. That is, the first 16 bits (word) from the PDP go into the second 16 bits on the PC, and vice versa. This solves the "endian" problem. 2) Divide the (PC) floating point number by 4. This solves the hidden bit problem. You should now have, in the PC, the representation of the PDP's floating point value. That is, if a Fortran program on the PDP read the PDP value and wrote out 3.14159, then the transformed (word-swapped, divided-by-4) value written out by a PC Fortran program would also be 3.14159. Going the other way is left as a (trivial) exercise for the reader. Bob Schor US DECUS RT-11/TSX+ Working Group Chair