From: fairfield@sldb6.slac.stanford.edu
Subject: Re: Help - DEC floating point format?
Date: Fri, 10 Mar 1995 19:45:49 GMT [thread overview]
Message-ID: <1995Mar10.114549.1@sldb6.slac.stanford.edu> (raw)
In-Reply-To: bschor.44.03CD5D35@vms.cis.pitt.edu
In article <bschor.44.03CD5D35@vms.cis.pitt.edu>,
bschor@vms.cis.pitt.edu (Bob Schor) writes:
[question about PDP/VAX floating point format deleted]
>
> 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.
I think it's confusing to say this is an "endian" problem since
both Intel, and PDP & VAX, use "little-endian" addressing. You
could say it's _similar_ to an endian problem, but it applies only
to the floating point format and only at word (16-bit) granularity.
The reason for this seemingly odd format is that it allowed the
word that contains the sign bit (MSB word) of the 4-byte float to
sit in R0 and set the hardware status register flags on the PDP (and
VAX). If the float was constructed in the "natural" 4-byte order,
the sign bit would appear in R1, would not set the flags
appropriately (for a float) and the test for negative or zero would
have had to be done in software (slowing things down a lot!). It's
a bit of a hack, but it makes sense for the hardware on which it was
developed (and the VAX hardware maintained compatibility with the
PDP format).
Secondly, it's not a "hidden precision" problem (I think you
meant hidden _bit_, BTW), but rather a different choice of
_normalization_. Both IEEE and PDP/VAX floating point formats use a
"hidden bit" in the mantissa, but IEEE chose to normalize as 1.bbbb
whereas PDP and VAX use 0.1bbbb (and only the "bbbb" are represented
in the mantissa bits). In addition, IEEE chose to use a bias of 127
(versus 128 on PDP/VAX) for the 8 bits of exponent which gave them
(1) symmetric value range and (2) some extra exponent values which
can be used for NaN, Inf, etc. So you get one factor of 2 from the
binary normalization and a second factor of 2 from the exponent
bias, resulting in a factor-of-4 difference between IEEE and
(re-ordered) PDP/VAX float. Single precision only, BTW.
> 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.
Nice prescription.
-Ken
--
Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
SLAC, P.O.Box 4349, MS 46 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
Stanford, CA 94309 | Voice: 415-926-2924 FAX: 415-926-3515
-------------------------------------------------------------------------
These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
next prev parent reply other threads:[~1995-03-10 19:45 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 [this message]
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