Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: lionel@quark.enet.dec.com (Steve Lionel)
Subject: Re: Help - DEC floating point format?
Date: 10 Mar 1995 18:05:01 GMT	[thread overview]
Message-ID: <3jq4cd$rm0@jac.zko.dec.com> (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)

I'll assume it's a VAX, though some PDP-11s had similar layouts.

Single-precision:

	Exponent: 8 bits, bias 128, bits 7:14 (little-endian)
	Mantissa: 24 bits, normalized, MSB hidden, 0<m<=0.5
	  MSB 7 bits are in bits 0-6, little-endian; next 16 bits are in 16-31.
	Sign: 1 bit (zero for positive, one for negative): bit 15
	Zero: sign and exponent zero, mantissa ignored

	seeeeeeeemmmmmmm   Bits 0:15
	mmmmmmmmmmmmmmmm   Bits 16:31

Double-precision (D_float):

	Just like single precision but with an extra 32 bits of mantissa
	in bits 32-47 and 48-63

These are the most common formats.

The tricky part is that the mantissa layout is strange - the most significant
bits are in the lowest-addressed bytes.  This layout "looked" normal on
the 16-bit PDP-11, but seems strange on a 32-bit system.  For conversion
to IEEE, don't forget the different position of the radix point and the
different exponent bias.

For single precision, you could probably get by with swapping the 16-bit
words and multiplying by 4. 
-- 

Steve Lionel                      Mail: lionel@quark.enet.dec.com
DEC Fortran Development           WWW:  http://www.digital.com/info/slionel.html
Digital Equipment Corporation     CompuServe: 75263,3001
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698             "Free advice is worth every cent"

For a summary of Digital's Internet services, send mail to info@digital.com


      parent reply	other threads:[~1995-03-10 18:05 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
1995-03-10 19:45   ` fairfield
1995-03-10 18:05 ` Steve Lionel [this message]
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