From: lionel@quark.enet.dec.com (Steve Lionel)
Subject: Re: Help: Any VAX floating point emulation lib. for non-VAX machine
Date: 1 Sep 1994 15:18:04 GMT [thread overview]
Message-ID: <344rbc$4d5@jac.zko.dec.com> (raw)
In-Reply-To: 1994Aug31.095400.1@slacvx.slac.stanford.edu
In article <1994Aug31.095400.1@slacvx.slac.stanford.edu>,
fairfield@slacvx.slac.stanford.edu writes:
|>In article <CvE5Hn.ApA@world.std.com>,
|> jg1ifj@world.std.com (Hisa Noguchi) writes:
|>> Does anyone know of the any VAX floating point emulation library for non-VAX
|>> system (esp. for PC).
|>>
|>> I'm porting a VAX program to PC which using a single precision floating point
|>> in many places. Because of the FPU differences, VAX and PC give different
|>> rounding error. It is not negligible for the single precision for this app.
|>> Unfortunately I can't modify VAX program (out of my control) to use double
|>> precision to reduce the differences.
|>
|> Since a VAX F_float (single precision floating point) has the
|> same precision as an IEEE Single (used by Intel processors), and
|> since the VAX and IEEE singles have _almost_ the same range, you
|> shouldn't (in principle) have to do anything. However, the Intel,
|> especially if you have a math co-processor, is likely to keep more
|> precision in the intermediate results, and I would expect that is
|> the difference you are seeing. I believe there is a way to get your
|> compiler (you didn't say which language) to truncate or round
|> intermediate results back to single precision. That should
|> reproduce the VAX results...
It's not that simple. VAX and IEEE FP round differently when the infinite
precision result is exactly halfway between two representable values. VAX
will round "away from zero" (positive numbers round up, negative numbers
round down), but the default IEEE mode is "round to even" which causes it
to pick whichever representable value has a LSB of zero. I have seen an
application where this difference in a single operation created wildly
different final results. Of course, the application itself was written with
a complete lack of understanding of floating point weaknesses and the need
to maintain extra precision (not to mention that you should avoid rounding
results and feeding those back into future iterations).
I can believe that Hisa's application is dependent on VAX rounding to obtain
the "desired" results. Unfortunately, I have no idea what can be done
to mimic the VAX behavior on the Intel system. I would think that, unless
the application has made the same mistakes as the one I mentioned above, that
the differences should be minor. An important factor, not mentioned so far,
is the quality of the math library, if used. On VAX we take pride in the
accurate results of the math library, and have spent many years making sure
they're "good to the last bit". Some vendors don't take quite so much care.
--
Steve Lionel Mail: lionel@quark.enet.dec.com
DEC Fortran Development WWW: http://www.digital.com/info/slionel.html
Digital Equipment Corporation
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
prev parent reply other threads:[~1994-09-01 15:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CvE5Hn.ApA@world.std.com>
1994-08-31 17:54 ` Help: Any VAX floating point emulation lib. for non-VAX machine fairfield
1994-09-01 15:18 ` 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