Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Re: Help: Any VAX floating point emulation lib. for non-VAX machine
       [not found] <CvE5Hn.ApA@world.std.com>
@ 1994-08-31 17:54 ` fairfield
  1994-09-01 15:18   ` Steve Lionel
  0 siblings, 1 reply; 2+ messages in thread
From: fairfield @ 1994-08-31 17:54 UTC (permalink / raw)


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.
> 
> Speed is not issue this time, but the target is to get a same (almost) data
> without modifying the VAX program.
> 
> It is a common practices to emulate x87 FPU for the x86sx machines. I hope
> somebody has similar library for VAX floating point. Right ?
> 
> Any help, suggestion or info. would be appreciated.

        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...

        -Ken
-- 
 Dr. Kenneth H. Fairfield    |   Internet: Fairfield@Slac.Stanford.Edu
 SLAC, P.O.Box 4349, MS 98   |   DECnet:   45537::FAIRFIELD (45537=SLACVX)
 Stanford, CA   94309        |   Voice: (415) 926-2924  FAX: (415) 926-4335
 ----------------------------------------------------------------------------
 These opinions are mine, not SLAC's, Stanford's, nor the DOE's...


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Help: Any VAX floating point emulation lib. for non-VAX machine
  1994-08-31 17:54 ` Help: Any VAX floating point emulation lib. for non-VAX machine fairfield
@ 1994-09-01 15:18   ` Steve Lionel
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Lionel @ 1994-09-01 15:18 UTC (permalink / raw)



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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-09-01 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox