Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: bschor@vms.cis.pitt.edu (Bob Schor)
Subject: Re: Help - DEC floating point format?
Date: Fri, 10 Mar 1995 11:56:54 UNDEFINED	[thread overview]
Message-ID: <bschor.44.03CD5D35@vms.cis.pitt.edu> (raw)
In-Reply-To: D56Lq2.8Mx@demon.co.uk

In article <D56Lq2.8Mx@demon.co.uk> Andrew Gibbs <agi%bsesoft@Britain.EU.net> 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


  parent reply	other threads:[~1995-03-10 11:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-09 16:27 Help - DEC floating point format? Andrew Gibbs
1995-03-10  9:36 ` Dr Ivan D Reid, �SR Facility, PSI
1995-03-10 11:56 ` Bob Schor [this message]
1995-03-10 19:45   ` fairfield
1995-03-10 18:05 ` Steve Lionel
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